mboudreau
2017-05-18 14:23
has joined #general

jose
2017-05-18 16:28
has joined #general

uglyog
2017-05-18 22:36
has joined #general

mboudreau
2017-05-22 02:43
I'm sick today, so I'm spending the time looking at website stuff :slightly_smiling_face:

uglyog
2017-06-01 06:05
who can answer Pact .Net questions?


mboudreau
2017-06-01 08:23
Not me :/

jose
2017-06-01 08:38
Certainly not me

bethskurrie
2018-03-24 03:32
has joined #general

andrewspinks
2018-03-24 09:14
has joined #general

neil
2018-03-24 09:22
has joined #general

matt.fellows
2018-03-24 11:15
has joined #general

matt.fellows
2018-03-24 11:15
:wave:

marko
2018-03-25 21:23
has joined #general

matt.fellows
2018-03-25 21:50
Just confirming - are we thinking of opening this up to the public or is it just for maintainers?

bethskurrie
2018-03-25 21:51
I assumed public

matt.fellows
2018-03-25 21:51
ok cool

matt.fellows
2018-03-25 21:51
I can create a Heroku setup page to make it easy for people to join

mboudreau
2018-03-25 21:54
I was going to do it, but go ahead if you're keen

matt.fellows
2018-03-25 21:56
keen is a strong word

matt.fellows
2018-03-25 21:56
if you have time, go for it :slightly_smiling_face:

mboudreau
2018-03-25 22:29
Will do :)

andrewcfitzgerald
2018-03-26 02:44
has joined #general

andrewcfitzgerald
2018-03-26 02:45
:wave:

matt.fellows
2018-03-26 02:51
:wave:

slack1
2018-03-26 04:08
has joined #general

bethskurrie
2018-03-26 06:08
:wave:

dennis
2018-03-26 08:41
has joined #general

abubics
2018-03-27 00:55
has joined #general

abubics
2018-03-27 00:56
hey guys, what?s going on

bethskurrie
2018-03-27 02:13
There was no party til you arrived @abubics

andrewcfitzgerald
2018-03-27 03:28
`+:party_parrot:`

bethskurrie
2018-03-27 03:29
Oh no! No party parrot!

bethskurrie
2018-03-27 03:29
Maybe you have to pay Slack for the party parrot.

andrewcfitzgerald
2018-03-27 03:31
ha, new slack pricing model: all features are free, emojis and gifs unlocked by microtransactions

bethskurrie
2018-03-27 03:56
I know a social media platform that has a revenue model pretty much exactly that!

abubics
2018-03-27 05:06
:party_parrot::party_parrot::party_parrot: :party_parrot:

bethskurrie
2018-03-27 05:29
Woot!

bethskurrie
2018-03-27 05:29
Thanks @abubics!


matthew.balvanz
2018-03-27 14:06
has joined #general

ragarwal
2018-03-28 00:22
has joined #general

cfmack
2018-03-28 13:12
has joined #general

abubics
2018-03-29 03:57
is there a recommended `pact-jvm-consumer` version for use with Kotlin?

abubics
2018-03-29 03:57
last time I was in Kotlin, I just used groovy :s


abubics
2018-03-29 05:03
turns out, it?s still very difficult (possibly impossible) to get Kotlin to play with Groovy . . . so I guess I?ll have to go with one of the Java ones :cry:

mboudreau
2018-03-29 05:17
I figure we'd need a kotlin specific build based on the JVM one

abubics
2018-03-29 05:27
yeah, chuck it on the list :wink:

mboudreau
2018-03-29 06:50
I'll get it done after the website/SaaS app :stuck_out_tongue:

cfmack
2018-03-29 14:43
Has anyone got the Provider Webhooks in the Pact Broker calling Jenkins 2.X with CSRF enabled? It looks like Jenkins requires two API calls (one to get a valid CSRF token)


bethskurrie
2018-03-29 19:44
@cfmack Ugh! We've had this problem before. My suggestion was to run a little intermediate rack app that did the CSRF call. I could create a little prototype if that would help, but you might prefer to do something in a language you're comfortable with.

bethskurrie
2018-03-29 22:14
added an integration to this channel: https://pact-foundation.slack.com/services/B9YEJPQQK

bethskurrie
2018-04-05 04:28
removed an integration from this channel: https://pact-foundation.slack.com/services/B9YEJPQQK

bethskurrie
2018-04-05 10:07
@cfmack does this two stage call follow a standard process that would be applicable to other http servers, or is it a Jenkins Special? As in, is it a feature that would be popular if we ended up implementing support for it, for other services?

david.j.smith
2018-04-06 08:21
has joined #general

david.j.smith
2018-04-06 08:22
:wave:

bethskurrie
2018-04-06 08:23
Welcome Dave!

david.j.smith
2018-04-06 08:24
Thanks Beth :slightly_smiling_face:

david.j.smith
2018-04-06 08:24
I noticed you've been chatting to our government!

bethskurrie
2018-04-06 08:24
Indeed.

bethskurrie
2018-04-06 08:25
I liked them more than our own :-|

david.j.smith
2018-04-06 08:25
The civil servants are a good bunch - just the folks in charge of them that need a bit of a kicking :wink: One of my contributors works there atm.

bethskurrie
2018-04-06 08:27
They seemed like they'd had a good think about things before we even talked. It was a good chat.

abubics
2018-04-13 03:22
I?m hitting a related (but different) issue to this: https://github.com/DiUS/pact-jvm/issues/213 Is there a fix (or recommended approach), or should I just use a workaround for now? and/or an issue already, and should I raise one, if not? :stuck_out_tongue: The issue is I?m not specifying any headers, but this is coming up by default in the response: ``` "headers": { "Content-Type": "application/json; charset=UTF-8" }, ``` and then failing provider pact verify, because there isn?t a space in `"application/json; charset=UTF-8"`

bethskurrie
2018-04-13 04:06
Blame @uglyog for putting in a default header :stuck_out_tongue:

uglyog
2018-04-13 04:08
The space should not make it fail. That's a defect.

bethskurrie
2018-04-13 04:10
I don't understand why there is a mismatch on a header you didn't specify?

abubics
2018-04-13 04:19
all of the above :innocent:

abubics
2018-04-13 07:44
I?m getting ``` "matchingRules": { "$.body.accounts": { "match": "type", "min": 0 }, ``` in my pact file, and ``` "accounts": [ ] ``` showing in the broker, but my test looks like ``` body(newJsonBody { container -> container.eachLike("accounts", 1) { ... ``` Should I raise an issue? I expected `eachLike(1)` to make 1 occurrence :thinking_face:

abubics
2018-04-13 07:44
(this is with the java8 consumer)

abubics
2018-04-13 07:48
using `minArrayLike` instead fixes it, but then what is the point of `eachLike`?

bethskurrie
2018-04-13 08:15
Or of lfe in general.

cfmack
2018-04-13 16:49
Apologies. Life has been crazy lately. In my experience with Travis and AppVeyor, I do not think they have this same request or quiet frankly support CRSF. Our internal walk around, was to disable CRSF. While that's imperfect, it works for our internal needs

bethskurrie
2018-04-17 09:58
Sounds like a good work around to me :wink:

bethskurrie
2018-05-04 06:25
Did you work out the problem @abubics?

abubics
2018-05-04 08:58
nope, just workarounds

abubics
2018-05-04 08:59
I provide an explicit `Content-Type` in the Pact description (so it?s brittle)

abubics
2018-05-04 08:59
we are unblocked, at least :slightly_smiling_face:

bethskurrie
2018-05-04 09:07
Why is it bad to set the content type?

abubics
2018-05-04 09:09
because it was failing on a whitespace issue, and it is asserting on a field I didn?t even set

abubics
2018-05-04 09:10
no wait

abubics
2018-05-04 09:10
that was the Content-Type

abubics
2018-05-04 09:10
the `eachLike` issue was always a workaround, and I didn?t see why `minArrayLike` did what I wanted, while `eachLike` didn?t

abubics
2018-05-04 09:11
is there meant to be a difference? what is the point, if not?

bethskurrie
2018-05-04 09:11
Hm. Bug Ron about that.

abubics
2018-05-04 09:11
hey, you brought it up :stuck_out_tongue:

abubics
2018-05-04 09:11
I already forgot about it xD hence the mild confusion

abubics
2018-05-04 09:12
which (of the 2 issues) were you asking about? :innocent:

bethskurrie
2018-05-04 09:13
I can't remember. Just in general. Because the last time we chatted, we ended up questioning the reason for living.

bethskurrie
2018-05-04 09:13
Just needed to make sure you hadn't topped yourself because of Ron.

abubics
2018-05-04 09:13
lololol

abubics
2018-05-04 09:14
yeah, I?m unblocked :stuck_out_tongue: no thanks to @uglyog :troll:

bethskurrie
2018-05-04 09:14
What a slacker.

bethskurrie
2018-05-04 09:14
<hides behind laptop>

matt.fellows
2018-05-07 09:04
New member join url: http://slack.pact.io

matt.fellows
2018-05-07 09:04
@matt.fellows pinned a message to this channel.

matthew
2018-05-07 14:38
has joined #general

thomas.heilbronner
2018-05-07 20:50
has joined #general

sgleadow
2018-05-08 00:27
has joined #general

philip.sturman
2018-05-08 06:12
has joined #general

david
2018-05-08 07:45
has joined #general

david
2018-05-08 07:47
hello :wave:

dominic.jones
2018-05-08 08:33
has joined #general

mark.bridgett
2018-05-08 08:40
has joined #general

mark.bridgett
2018-05-08 08:40
Greetings

david.j.smith
2018-05-08 08:42
Hello :wave:

mboudreau
2018-05-08 08:50
:wave:

abubics
2018-05-08 23:59
howdy howdy howdy :wave:

bethskurrie
2018-05-09 03:35
Hi all. Welcome.

sgleadow
2018-05-09 05:07
Pacticipants unite!

sgleadow
2018-05-09 05:10
Can I start asking questions now? Is this instead of Gitter? (I'm not on Pact gitter) We're looking to set up Pact between some mobile apps (Swift/Kotlin) and an aggregation API (Node). My question is about setting up provider state. Our API is stateless, so it looks like we're not so much injecting eg. data into a DB as setting up stubs of downstream calls that reflect the provider state. How do people go about doing that? Spin up a separate stub server where you set up the state, and run your API in a configuration where it points there rather than to real dependencies?

abubics
2018-05-09 05:17
There are several approaches, and it depends how cleanly layered your architecture is

abubics
2018-05-09 05:19
The leanest just gives you confidence that your response entities are the right shape: > just stub the response objects at the endpoint layer

abubics
2018-05-09 05:19
The most integrated means you go through all layers (and potentially hit other complications on the way): > inject data in the DB, or responses at the DB client

abubics
2018-05-09 05:20
and a heap of stuff in-between

abubics
2018-05-09 05:21
As for Pact?s intended philosophical usage . . . I?ll leave that answer to @bethskurrie, @uglyog, and @matt.fellows :slightly_smiling_face:

abubics
2018-05-09 05:21
but if you?re treating Pact as an asynchronous pair of network interface unit tests, the leanest approach gives you value

abubics
2018-05-09 05:23
if you phrase the state and requests as ?given no/some/many? and upon receiving ?a valid/invalid request for blah?, there?s no implied logic to stub, just happy & sad response shapes

uglyog
2018-05-09 05:26
Yes, @sgleadow, it's stub and mock servers all the way down.

uglyog
2018-05-09 05:26
Maybe a turtle or two

uglyog
2018-05-09 05:28
Not sure how you would tie the state to the stub with node, but @matt.fellows would prob be able to help there

bethskurrie
2018-05-09 05:48
One way to do it is to create your own mock implementation class that to can set up response objects on, no "mocking library" necessary. Ideally, you could reuse something in that test that would be an input with your downstream contract tests.

bethskurrie
2018-05-09 05:57
For example, you could stub your `AnimalService#get_alligator(...)` to return `Alligator.new(name: Mary)`, and then use that same object in the pact test for `AnimalService#get_alligator`. eg `given... when... will return... expect(AlligatorService.get_alligator(Mary)).to eq Alligator.new(name: Mary)`

bethskurrie
2018-05-09 05:57
So you can use a shared object as a "contract" too.

bethskurrie
2018-05-09 06:01
Or, you could use the pact that you generated for the AnimalService in your unit tests, to create a stub server using the pact-stub-server. You want to make your request expectations quite relaxed if you do this though, because otherwise it will be quite brittle. Normally, when you use pact in a unit test, you can be quite strict, as you're in full control of the outgoing request.

bethskurrie
2018-05-09 06:12
I've just announced on the gitter channel that it will be closing down, so hopefully we'll have some new pacters soon. Let's try and keep conversations in threads, so it's easier to see which questions have been answered, and which haven't. There are a few really good questions on gitter that didn't get answered recently because of all the noise.

vinod.baradwaj
2018-05-09 06:12
has joined #general

bethskurrie
2018-05-09 06:12
Death to gitter!

bethskurrie
2018-05-09 06:12
Welcome @vinod.baradwaj

vinod.baradwaj
2018-05-09 06:12
thank you :slightly_smiling_face:

ashish.dubey91
2018-05-09 06:13
has joined #general

bethskurrie
2018-05-09 06:14
:wave:

rgshah781988
2018-05-09 06:14
has joined #general

rgshah781988
2018-05-09 06:15
I am facing issue with matchers.

rgshah781988
2018-05-09 06:15
Can any buddy help me ?

bethskurrie
2018-05-09 06:16
shoot

vinod.baradwaj
2018-05-09 06:16
@bethskurrie i tried using hash arguments in mock setup for query parameters and it worked fine... will i be able to use the same approach for an endpoint like this, `/api/tagCollections/{tagCollectionId}/tags/{tagId}` where both tagCollectionId and tagId are dynamic ones

bethskurrie
2018-05-09 06:16
Firstly, which language?

bethskurrie
2018-05-09 06:16
Secondly, I'll move this to a thread. It makes the conversations cleaner.

bethskurrie
2018-05-09 06:16
Ok, @vinod.baradwaj let's continue here.

vinod.baradwaj
2018-05-09 06:17
yeah sure

rgshah781988
2018-05-09 06:17
js

bethskurrie
2018-05-09 06:17
@bethskurrie set the channel topic: Please remember to use threads! This ain't Gitter :wink:

bethskurrie
2018-05-09 06:17
Which language?

vinod.baradwaj
2018-05-09 06:17
JS

bethskurrie
2018-05-09 06:17
Ok, I can probably help you.

bethskurrie
2018-05-09 06:18
You can create a matcher using a regular expression but the nice URL format using {} isn't supported. I'd like it to be. Let's put it in v4.

bethskurrie
2018-05-09 06:18
Or... you could create a JS wrapper method that would turn your {} path into a regexp.

rgshah781988
2018-05-09 06:19
Do we need to create a matchers class?

priyank.shah217
2018-05-09 06:19
has joined #general

bethskurrie
2018-05-09 06:20
@uglyog in the Ruby impl, I made a little util that would allow you to construct a Pact Response body with all the matchers, and then tell it to give you the JSON example for it. I then used that body in the pact test, but also used it in a plain stub for other tests (eg. verifications of upstream pacts). Is this something that could be done with the JVM?

bethskurrie
2018-05-09 06:20
It would be the regular expression class

bethskurrie
2018-05-09 06:20
It's called a `term`

rgshah781988
2018-05-09 06:20
ok

vinod.baradwaj
2018-05-09 06:21
we need to create a method which will use regex to create path instead of these {} args @rgshah781988

bethskurrie
2018-05-09 06:21
When you use a term, you give it a regular expression, and an example.

abubics
2018-05-09 06:21
@abubics pinned a message to this channel.

bethskurrie
2018-05-09 06:22
You could make a `Pact.path("/foo/{id}", {id: 2})` that would build a `Pact.term` with the right regular expression and the expanded path as the example.

bethskurrie
2018-05-09 06:22
Does that make sense?

vinod.baradwaj
2018-05-09 06:27
yeah understood... in case of two arguments(`/foo/{fooId}/action/{actionId}`), will the same approach work ?

vinod.baradwaj
2018-05-09 06:27
would i be able to create Pact.term for this ?

rgshah781988
2018-05-09 06:34
@bethskurrie would i be able to create Pact.term for this ?

sgleadow
2018-05-09 06:50
I think this is a difference in the ruby vs node approaches. The node approach, it's not in the same process, so I can't set mocks in code that get called at runtime (at least not out of the box). I think I'll start with some stubs right at the top, and see if actually running downstream stubs through the entire flow makes sense. (although I'm not 100% sure how I'd set this state in a stateless API)

rgshah781988
2018-05-09 06:51
Response body - i have use :

2018-05-09 06:51
@rgshah781988 commented on @rgshah781988?s file https://pact-foundation.slack.com/files/UALL53S58/FALLGS7TL/i_am_getting_error__while_creating_a_pacts_file_.txt: // Alias flexible matchers for simplicity const { eachLike, like, term, iso8601DateTimeWithMillis } = Matchers; const EXPECTED_BODY ={ 'id': like(1), 'available_from': iso8601DateTimeWithMillis(), 'first_name': like('Billy'), 'last_name': like('Goat'), 'animal': like('goat'), 'age': like(21), 'gender': term({ matcher: 'F|M', generate: 'M' }), 'location': { 'description': like('Melbourne Zoo'), 'country': like('Australia'), 'post_code': like(3000) }, 'eligibility': { 'available': like(true), 'previously_married': like(false) }, 'interests': eachLike('walks in the garden/meadow') };

rgshah781988
2018-05-09 06:53
I am trying same think with pactjs but I am not getting success.

bethskurrie
2018-05-09 07:06
@rgshah781988 ask in the js channel, and tag @matt.fellows or @mboudreau

rgshah781988
2018-05-09 07:12
ok

bethskurrie
2018-05-09 07:13
@sgleadow the provider state set up URL could be on the downstream http mock

bethskurrie
2018-05-09 07:13
I'm writing up a list of options with their various pros and cons. Will post here when finished.

rgshah781988
2018-05-09 07:15
Please share channel link

bethskurrie
2018-05-09 07:41
Absolutely

bethskurrie
2018-05-09 07:41
It's still just a regular expression.

bethskurrie
2018-05-09 07:41
And an example.

bethskurrie
2018-05-09 07:49
If you called something like `Pact.path("/api/tagCollections/{tagCollectionId}/tags/{tagId}", {tagCollectionId: 1, tagId: 2})` it would create a Pact.term with a pattern of `\/api\/tagCollections\/[^/]+\/tags/[^/]+\/` as the regular expression (or similar, don't quote me on the backslashes) and `/api/tagCollections/1/tags/1` as the example.

vinod.baradwaj
2018-05-09 08:27
okay got it.. thanks @bethskurrie :slightly_smiling_face:

rgshah781988
2018-05-09 08:53
:+1:


bethskurrie
2018-05-09 09:21
Here's a start.

bethskurrie
2018-05-09 09:28
@uglyog would you like to add any options or content to the gist? I'll put it in the docs when it's had some more eyes on it.

uglyog
2018-05-09 09:29
I'll have a look tomorrow

bethskurrie
2018-05-09 09:29
ta

uglyog
2018-05-09 09:30
I guess, there are model classes that underpin the pact format

vinod.baradwaj
2018-05-09 13:09
i am not able to start pact-stub-server, tried with the example pact file(https://github.com/pact-foundation/pact-stub-server) i am getting the following error ``` pact-stub-server git:(master) ? docker run -t -p 8080:8080 -v "$(pwd)/pacts/:/app/pacts" pactfoundation/pact-stub-server -p 8080 -d pacts 13:08:16 [WARN] No metadata found in pact file "\"pacts/billy-bobby.json\"", assuming V2 specification 13:08:16 [ERROR] There were errors loading the pact files. 13:08:16 [ERROR] - Failed to load pact from 'pacts' - Failed to parse Pact JSON - expected value at line 1 column 1 ```

rgshah781988
2018-05-09 13:39
How can I get dynamic response from pact files ? I tried using matchers such as like,eachlike I am working on API which has POST call with different payload values. (edited) According response changes.

david.j.smith
2018-05-09 16:18
@rgshah781988 You can't :slightly_smiling_face: Pact testing is done in a *known* state, if you want a different response, you need to define a different request. Essentially you're saying "There are different responses I can get for different requests" but they're all 1 to 1. A common thing to do in unit testing with mocks is to make the same request to, say, `/foo` in every test request but get the mocking framework to supply a different response each time with a before and/or after statement in your test framework. Pact does not do that.

david.j.smith
2018-05-09 16:22
@vinod.baradwaj It's saying that is can't parse your Pact contract files, which it has assumed to be V2 formatted, so the first question is: Do you know you have V2 Pact files? Also, do both of those folders contain Pact files? Are they all the same format? You could try adding the metadata to the files (as a test) to see what happens, I believe it looks like: ``` ...rest of Pact file... "metadata": { "pact-specification": { "version": "2.0.0" } } } ```

vinod.baradwaj
2018-05-09 16:26
@david.j.smith i am trying with the example pact file which is in that repo, the pact file has the metadata which you have given in it.. it was working fine before but now i am not able to start the server with the same pact file.

david.j.smith
2018-05-09 16:41
@vinod.baradwaj It's hard to tell from here but it clear isn't happy with something in that directory. Do you have files in there that aren't Pact files? Can you refresh that file to make sure it hasn't be accidentally changed? Failing that you could send it over for us to look at but if it was working and now it isn't... then something has changed. :slightly_smiling_face:

matt.fellows
2018-05-09 20:44
@rgshah781988 can you please explain what you're trying to do with more details?

brentbarker9
2018-05-09 20:55
has joined #general

uglyog
2018-05-09 21:55
@vinod.baradwaj looks like it can't parse your pact file. You can enable debug logging with `-l debug`

mboudreau
2018-05-09 22:26
please don't repost in several channels

mboudreau
2018-05-09 22:26
use the threads, dave

shekharsp27
2018-05-10 05:27
has joined #general

rgshah781988
2018-05-10 05:38
ok sure

rgshah781988
2018-05-10 05:40
Thanks @david.j.smith

rgshah781988
2018-05-10 05:41
But I have one API call with different payload and response should be dependent on payload. So, what to do? It seems that PACTs doesn't have such feature.

rgshah781988
2018-05-10 05:43
@david.j.smith @vinod.baradwaj But same pact file is working in my computer.

rgshah781988
2018-05-10 05:45
I have one API call with different payload and I am expecting different response as per payload values. Eg : API call is url/assets - POST call. I am providing payload as JSON - {"name":"ravi"} , expected response is name as ravi. Now,API call is url/assets - POST call. I am providing payload as JSON - {"name":"shah"} , expected response is name as shah.

matt.fellows
2018-05-10 05:50
Hopefully that?s an example just to illustrate the point (because you wouldn?t use pact just to test different data values)

matt.fellows
2018-05-10 05:50
BUT? that is entirely possible to do with Pact. What?s the issue you?re running into?

mboudreau
2018-05-10 05:50
@rgshah781988 I've responded to you in a thread in pact-js

rgshah781988
2018-05-10 05:52
I am mocking with pact file via pact stub server. And I need to use pact file.

rgshah781988
2018-05-10 05:52
For test , I can use this as per example . I had posted.

rgshah781988
2018-05-10 05:52
But I need to mock into pact stub server and need to use it.

rgshah781988
2018-05-10 05:53
@vinod.baradwaj Please look into respond also.

rgshah781988
2018-05-10 05:54
pact do same as per my example when I test with consumer.spec.js but I need to mock pact files in pact stub server

matt.fellows
2018-05-10 05:55
ok, so this is the _stubs_, and not the tests themselves right?

rgshah781988
2018-05-10 05:58
Yes,We can write a test for different payload and we will get different responses and according pact interactions will be created

matt.fellows
2018-05-10 05:58
ok cool

matt.fellows
2018-05-10 05:58
so yes, the stub server is not able to do what you?re asking unfortunately

rgshah781988
2018-05-10 05:59
how to do that? I am working on mocking with pact files

matt.fellows
2018-05-10 05:59
See the note at https://docs.pact.io/getting-started/local-api-stubs. We don?t support matching on predicates etc., unless I?m mistaken @uglyog @bethskurrie?

matt.fellows
2018-05-10 05:59
Perhaps there?s a way with headers or something. Typically we use other tools for that job

rgshah781988
2018-05-10 05:59
Yes sure , I am look into link

matt.fellows
2018-05-10 05:59
:thumbsup:

matt.fellows
2018-05-10 06:01
brb

rgshah781988
2018-05-10 06:01
Can you suggest some tool to do such job. I am working on mocking of my each micor services in pact-server at different port.

uglyog
2018-05-10 06:03
The stub server returns responses based on the method + path + query parameters. You can raise an issue to get it to have an option to include the request body as well

rgshah781988
2018-05-10 06:09
Where should I raised issue? @uglyog Please help me




uglyog
2018-05-10 06:21
I'll sort it out for you this weekend, and upgrade it to V3 spec as well

rgshah781988
2018-05-10 06:23
thanks

matt.fellows
2018-05-10 06:28
:thumbsup:

vinod.baradwaj
2018-05-10 06:56
@matt.fellows is there any examples in JS to implement `term` in path ? the endpoint i am trying to mock is like `/api/tagCollections/{tagCollectionId}/tags/{tagId}` which will have dynamic values for both tagCollectionId and tagId.

matt.fellows
2018-05-10 06:58
Maybe not examples, but it?s doable - are you having issues?

bethskurrie
2018-05-10 07:02
It's just the same as a term for any other part of the request.

bethskurrie
2018-05-10 07:02
path : Pact.term(...)

vinod.baradwaj
2018-05-10 07:03
term will expect a matcher and generate right ?

matt.fellows
2018-05-10 07:12
yep

david.j.smith
2018-05-10 08:47
@rgshah781988, I'm 99% sure the Scala stubber does do that. However it's probably more hassle than you'd want to get into.

david.j.smith
2018-05-10 08:49
@mboudreau I'll try but I don't like them very much so often forget :slightly_smiling_face: (Hard to scan for relevant information since it's hidden under threads)

mboudreau
2018-05-10 08:55
the point is to keep details out of the main channels so it's not cluttered

omar
2018-05-10 19:49
has joined #general

kateleighrose
2018-05-10 22:09
has joined #general

rgshah781988
2018-05-11 05:04
I need to create pact file which contain interactions eg : id:1234 is randomly created by other API. Can I provide or pass dynamic number in interactions?

uglyog
2018-05-11 05:08
@rgshah781988 what are you using to create the pact file?

rgshah781988
2018-05-11 05:09
I used Pactjs

uglyog
2018-05-11 05:10
Does it need to be dynamic?

uglyog
2018-05-11 05:10
As long as it is correctly formatted, the actual value should not matter

uglyog
2018-05-11 05:11
You can try use a regex matcher without a example, it might generate a random one

rgshah781988
2018-05-11 05:23
@uglyog: Actually , id:1234 is created by other API. And same ID , i need to used in interactions for next API call

matt.fellows
2018-05-11 06:17
That sounds like a functional test - you don?t want to use pact for functional tests (https://docs.pact.io/best-practices/consumer/contract-tests-vs-functional-tests)

kateleighrose
2018-05-11 14:47
hi, I have kind of a weird use case that I'm hoping to use pact-python for but can't figure out. I have a service in python that calls out to a lambda function via boto3, that lambda is a java app I also have ownership of. I want to write a contract test for the consumer (python service) and provider (java app)

kateleighrose
2018-05-11 14:48
but since the consumer is calling boto and not making a standard HTTP request to an api, I can't use the `with_request` param... unless I'm missing something

matt.fellows
2018-05-11 23:58
interesting

matt.fellows
2018-05-12 00:00
how does the service call lambda via boto - triggering an event or something? Boto is an interface to the AWS SDK, so it must just be triggering the lambda function and therefore it would be an asynchronous interaction

matt.fellows
2018-05-12 00:00
Python doesn?t yet support message pact, but we?ve just introduced it to Pact JS and Pact Go with some success, and will hopefully be rolling it out to Python et. al over the coming months

matt.fellows
2018-05-12 00:01
if you wanted to help contribute, @matthew.balvanz would be the guy to chat with

kateleighrose
2018-05-13 01:31
message sounds like what I need, yeah. good to know it's in the plans

uglyog
2018-05-13 06:41
@rgshah781988 `pactfoundation/pact-stub-server:v0.0.8` has been released with your fix and support for V3 spec pact files

ragarwal
2018-05-14 00:45
Hello, I am using pact-js and jest to write consumer side pact tests. As per https://github.com/pact-foundation/pact-js/blob/master/examples/jest/__tests__/another.spec.js example, we can do `.then(() => provider.verify());` with same it block. When I am doing this for 1 test it works seamlessly. But when I have multiple pact tests, interactions start getting confused and results in test failure. To fix the issue, I end up doing `it('successfully verifies', () => provider.verify());` for each test. Now if I have 2 pact tests, I end up having 4 tests => 2 actual tests and 2 verify `it` block. This is just extra noise, can someone help me with this?

mboudreau
2018-05-14 00:53
I think the problem is that you're returning a promise, but also using the `done` function. You're calling `done` before the actual function is done

mboudreau
2018-05-14 00:53
since it still has to verify

mboudreau
2018-05-14 00:53
just remove the `done`, and it should work

ragarwal
2018-05-14 01:08
describe(?pact tests?, () => { const expectedCreateAgencyResponse = { agencyId: ?A000001?, }; beforeAll(() => { process.env.NAILGUN_API_BASE_URL = ?http://localhost:7080'; return provider.addInteraction(interaction); }); it(?should return an success response with the formatted message?, done => { createAgency(createRequest, response).then(() => { expect(response.send).toHaveBeenCalledWith(expectedCreateAgencyResponse); done(); }); }); it(?successfully verifies?, () => provider.verify()); });

ragarwal
2018-05-14 01:09
This is how I am adding tests as of now

ragarwal
2018-05-14 01:10
Are you suggesting to remove done completely, or calling it in a different way?

mboudreau
2018-05-14 01:10
remove it and put your verify back in the then

ragarwal
2018-05-14 01:15
I will try doing that. Thanks @mboudreau

ragarwal
2018-05-14 01:25
It?s not working without done.

matt.fellows
2018-05-14 01:25
What?s it doing - timing out?

matt.fellows
2018-05-14 01:25
Did you remove the done argument (and not just the `done()`?)

ragarwal
2018-05-14 01:26
yes, I removed the done argument

ragarwal
2018-05-14 01:26
it(?should return an success response with the formatted message?, () => { createAgency(createRequest, response) .then(() => { expect(response.send).toHaveBeenCalledWith(expectedCreateAgencyResponse); }) .then(() => { provider.verify(); }); });

ragarwal
2018-05-14 01:27
Now I am getting this error: console.warn node_modules/bluebird/js/release/debuggability.js:873 Unhandled rejection Error: expect(jest.fn()).toHaveBeenCalledWith(expected) Expected mock function to have been called with: [{?agencyId?: ?A000001"}] But it was not called.

ragarwal
2018-05-14 01:27
I can see this in logs, but entire test suite is saying successful. :flushed:

matt.fellows
2018-05-14 01:27
My recommendation is to have a structure like this ` beforeAll(() => provider.setup()); afterEach(() => provider.verify()); afterAll(() => provider.finalize()); describe ?some big important scenario? it ?does something? it ?does something else? describe ?next big important scenario? ...

matt.fellows
2018-05-14 01:28
It reads a lot better, and is less error prone

matt.fellows
2018-05-14 01:29
Also consider that Jest may run in _parallel_ - if that?s the case, then that could explain the weird issues you?re having.


mboudreau
2018-05-14 01:30
@ragarwal if you're not using `done` you need to return the promise in the test

mboudreau
2018-05-14 01:30
ie. return your `createAgency` function

mboudreau
2018-05-14 01:31
and yeah, paralellization might be an issue with jest

ragarwal
2018-05-14 01:33
I am already passing `runInBand` to solve that issue

mboudreau
2018-05-14 01:34
``` it(?should return an success response with the formatted message?, () => { return createAgency(createRequest, response) .then(() => expect(response.send).toHaveBeenCalledWith(expectedCreateAgencyResponse)) .then(() => provider.verify()); }); ```

matt.fellows
2018-05-14 01:34
``` .then(() => { provider.verify(); }); ``` should be ``` .then(() => { return provider.verify(); }); ``` or just? ``` .then(() => provider.verify()) ```

ragarwal
2018-05-14 01:45
adding return to provider.verify() worked!

mboudreau
2018-05-14 01:45
magic! :stuck_out_tongue:

ragarwal
2018-05-14 01:45
also, as suggested by @matt.fellows, I moved it to afterEach() and now I have it only once in a file, which is more cleaner.

ragarwal
2018-05-14 02:01
with `.then(() => { return provider.verify(); })` my test became flaky. I ran them multiple times and they are randomly passing and failing without any code change.

santoshtrip
2018-05-14 03:24
has joined #general

santoshtrip
2018-05-14 03:26
Has anybody tried out swagger mock validator for contract testing

rgshah781988
2018-05-14 04:52
Thanks

rgshah781988
2018-05-14 04:52
Let me try this out

shekharsp27
2018-05-14 06:41
I have done POC using swagger petstore

rgshah781988
2018-05-14 09:05
can you share a link ?


shekharsp27
2018-05-14 09:45
My POC is on local machine, so please let me know if you still require a POC. Will commit it to repo.

ashish.dubey91
2018-05-14 11:51
hey guys. I have a question. I'm thinking of writing pact based tests and automate execution based on collection of BDD scenarios

ashish.dubey91
2018-05-14 11:52
is it possible that I can do provider verification per behavior basis?

ashish.dubey91
2018-05-14 11:52
if there was some way to tag interactions with steps definitions like in cucumber, that would have helped

ashish.dubey91
2018-05-14 11:52
I haven't seen anything like that in the docs hence I'm asking here

matt.fellows
2018-05-14 12:06
Hmm in theory it is possible, with environment variables

matt.fellows
2018-05-14 12:07
I'm on mobile, but off the top of my head, you can replay specific provider interactions, keyed by the description in the pact

matt.fellows
2018-05-14 12:07
But why?

ashish.dubey91
2018-05-14 15:09
so that I can pick certain provider interactions based on the relative importance. or at some point, I can tell for certain descriptions (BDD scenarios) in my case, if there exists a provider interaction that I can verify

santoshtrip
2018-05-14 16:29
Thanks @shekharsp27

timothy.clifford
2018-05-15 00:08
has joined #general

tjones
2018-05-15 01:04
has joined #general

vinod.baradwaj
2018-05-15 08:46
@matt.fellows term worked fine for endpoint which is `/api/tagCollections/{tagCollectionId}` but when i use the same technique for `/api/tagCollections/{tagCollectionId}/tags/{tagId}` i get `multiple interaction found`

vinod.baradwaj
2018-05-15 08:48
because both the endpoints `/api/tagCollections/{tagCollectionId}/tags/{tagId}` and `/api/tagCollections/{tagCollectionId}/tags` are getting matched

matt.fellows
2018-05-15 08:48
Are you clearing interactions between tests? As a general rule, you should only hit one per test. Or is this for local stubs?

vinod.baradwaj
2018-05-15 08:48
this is for local stubs

bethskurrie
2018-05-15 08:50
Can you give more information @vinod.baradwaj

bethskurrie
2018-05-15 08:50
I'm not sure we have the same understanding of "local stubs".

bethskurrie
2018-05-15 08:51
I think the regular expression you're using needs start and end markers on it.

bethskurrie
2018-05-15 08:51
^ and $

vinod.baradwaj
2018-05-15 08:54
i have not used start and end markers, let me try with that

bethskurrie
2018-05-15 11:11
Needs more Tims!

vinod.baradwaj
2018-05-15 11:52
i have used term like this `path: term({generate: "/api/tagCollections/10197", matcher: "/api/tagCollections/"+'\\d{5}'})`

bethskurrie
2018-05-15 12:04
You'll need to escape the forward slashes correctly. And put a $ at the end.

bethskurrie
2018-05-15 12:05
`\/api`

timothy.clifford
2018-05-15 23:01
I'll see what I can do

timothy.clifford
2018-05-15 23:04
Day 2 at Orica and I've already seen "contract testing" on the wish list

timothy.clifford
2018-05-15 23:04
I automatically started muttering "PACT" over and over

matt.fellows
2018-05-15 23:06
:laughing:

matt.fellows
2018-05-15 23:06
You know who to talk to :slightly_smiling_face:

matt.fellows
2018-05-15 23:07
Try using something like this to test your regexes: http://rubular.com/

timothy.clifford
2018-05-15 23:12
I get a commission now, right?

matt.fellows
2018-05-15 23:12
Sure

matt.fellows
2018-05-15 23:12
You can own 1/20th of a slide deck :slightly_smiling_face:

timothy.clifford
2018-05-15 23:12
YES! I'm in

rgshah781988
2018-05-16 05:21
I have a scenario - When I make a GET API call , response is unknown in my application.

rgshah781988
2018-05-16 05:22
How can I create pact for this kind of GET API call ?

uglyog
2018-05-16 05:23
You'll need to be more specific on what "response is unknown in my application" means

rgshah781988
2018-05-16 05:25
Few job are running automatically and it will have id and response depend on job. When I create a pact file for GET api call then response should be different.

uglyog
2018-05-16 05:26
and the job is specified in the path or as query parameters?

bethskurrie
2018-05-16 06:17
@rgshah781988 please provide some example code (ideally in a git repository), describe your expected outcome, and the actual outcome.

vinod.baradwaj
2018-05-16 06:18
same api end point but with different responses every time when u make request to the same endpoint ? @rgshah781988

rgshah781988
2018-05-16 06:20
@vinod.baradwaj :same api end point but with different responses every time when u make request to the same endpoint - > Yes

rgshah781988
2018-05-16 06:20
We need this case for GET Call. I am not changing end-point data - api/assets

bethskurrie
2018-05-16 06:21
@bethskurrie set the channel topic: Help us to help you! Please ask your question in the right channel for your language, and remember to use threads so we can keep the discussion focussed on your issue. Thanks!

bethskurrie
2018-05-16 06:23
It's perfectly normal to set up the same request and expect different responses for different situations. You need to run each test separately, however. You can't load all the interactions into the mock service at the same time. You'll have to do a set up, 1 interaction, test it, tear down, set up the 2nd interaction, test it, tear down etc.

rgshah781988
2018-05-16 06:24
ok

ashish.dubey91
2018-05-16 06:57
Is it possible to do provider verification programmatically (say, in a python function) for a specific interaction? Sorry if it's too obviously mentioned in the docs. I think this slack group is friendly, and I'm exploiting that fact too much

mboudreau
2018-05-16 07:04
probably ask in the python channel if it's python specific since each language has a different way of doing things

nand.sharma
2018-05-16 07:25
has joined #general

nand.sharma
2018-05-16 07:28
Is there a ways to provide pact broker url to pact stub server ? As per https://github.com/pact-foundation/pact-stub-server documentation , we can provide directory of pact file


bethskurrie
2018-05-16 07:58
No, I don't think the rust implementation supports that. The ruby one does though (if I released it. I only did the code for it the other day. Let me check.)

bethskurrie
2018-05-16 07:59
Oh, I beg your pardon. Just read the docs. Yes!

vinod.baradwaj
2018-05-16 08:44
thanks @matt.fellows @bethskurrie

james.hogarth
2018-05-16 09:21
has joined #general

matt.fellows
2018-05-16 10:55
:+1:

uglyog
2018-05-16 23:38
@nand.sharma directly supporting the pact broker is an excellent idea. Can you raise an issue for that?

gnewitt
2018-05-17 03:28
has joined #general

jaime.jaramillo
2018-05-17 18:24
has joined #general

rollertone
2018-05-19 17:21
has joined #general

minhdoan
2018-05-21 03:13
has joined #general

minhdoan
2018-05-21 08:53
Hi team, i am buidling a Pact record with the response contains:

minhdoan
2018-05-21 08:53
{ "Id": 35345786, "DATA_TYPE": { "EntityTypeName": "STRING", } }


minhdoan
2018-05-21 08:53
{ "Id": 35345786, "DATA_TYPE": null

minhdoan
2018-05-21 08:56
I used the pact-jvm-consumer-junit_2.12:3.5.16 and it seems the or() method, e.g: or("DATA_TYPE", null, PM.nullValue(), PM.stringType()) does not work in this case

minhdoan
2018-05-21 08:56
Could you please help to instruct me how to build it?

minhdoan
2018-05-21 08:56
Many thanks!

abhilash.hanumanth
2018-05-21 09:43
has joined #general

abhilash.hanumanth
2018-05-21 09:45
I am also having similar requirement as @minhdoan

abhilash.hanumanth
2018-05-21 09:45
I have a simple pact record :

abhilash.hanumanth
2018-05-21 09:45
[ { "id":123, "name":"Abhilash" }, { "id":1234, "name":"Hanumanth" } ]

abhilash.hanumanth
2018-05-21 09:45
How do I construct the pactDslJsonBody for the above example body ?

abhilash.hanumanth
2018-05-21 09:49
@uglyog: Can you pls provide a solution for this as I see ``` public PactDslJsonArray array() { throw new UnsupportedOperationException("use the array(String name) form"); } ``` in PactDslJsonBody.java

minhdoan
2018-05-21 09:58
@abhilash.hanumanth for your case

minhdoan
2018-05-21 09:58
body(new PactDslJsonBody() .id("Id") .stringValue("name", "Abhilash") ).toPact();

minhdoan
2018-05-21 09:59
and the pact record:

minhdoan
2018-05-21 09:59
{ "status": 200, "headers": { "Content-Type": "application/json" }, "body": { "name": "Abhilash", "Id": 1234567890 } }

minhdoan
2018-05-21 09:59
Is it satisfied your need?

abhilash.hanumanth
2018-05-21 10:20
Sorry @minhdoan. My bad. I changed my requirement. Please check

abhilash.hanumanth
2018-05-21 10:21
body: ``` [ { "id":123, "name":"Abhilash" }, { "id":1234, "name":"Hanumanth" } ] ```

minhdoan
2018-05-21 10:36
@abhilash.hanumanth

minhdoan
2018-05-21 10:37
.body(new PactDslJsonBody() .array("value") .object() .id("id") .stringValue("name", "Abhilash") .closeObject() .object() .id("id") .stringValue("name", "Hanumanth") .closeObject() .closeArray() ).toPact();

minhdoan
2018-05-21 10:37
and pact record:

minhdoan
2018-05-21 10:37
"body": { "value": [ { "name": "Abhilash", "id": 1234567890 }, { "name": "Hanumanth", "id": 1234567890 } ] }

minhdoan
2018-05-21 10:37
try it

peter.banjo
2018-05-21 10:49
has joined #general

abhilash.hanumanth
2018-05-21 10:52
Hi @minhdoan: If you observe my Json body, i dont have "value". In your solution, "value" is passed to array() which will generate key name as "value" which is not there in my response. And passing parameter is mandatory to .array() method as I said : ``` public PactDslJsonArray array() { throw new UnsupportedOperationException("use the array(String name) form"); } ```

minhdoan
2018-05-21 11:03
@abhilash.hanumanth Could you send your detail API response received from Postman or some thing like that? Because almost the response have format as:

minhdoan
2018-05-21 11:03
{ value: [} } or { "Name": "Value" }

minhdoan
2018-05-21 11:05
I have not seen the format: { [] }

bethskurrie
2018-05-21 11:21
@abhilash.hanumanth @minhdoan would you mind moving your conversation to the #pact-jvm channel please? We like to keep the conversations focussed so that we can ensure everyone gets their issues addressed. Using threads helps with this too. Thanks! Hope you get your problem worked out.

abhilash.hanumanth
2018-05-21 11:22
Sure Beth

scott.osborne1
2018-05-21 21:55
has joined #general

scott.osborne1
2018-05-22 20:27
I noticed that the pact-broker database has a table called config. Can anyone point me to examples for how to set up pact-broker configuration in the database? Or maybe there's a separate slack channel for pact-broker issues.

aphelps
2018-05-22 21:08
has joined #general

avinash.eediga
2018-05-23 05:55
has joined #general

avinash.eediga
2018-05-23 05:58
any one can share a simple example to start with pact

avinash.eediga
2018-05-23 05:58
in js /jvm

avinash.eediga
2018-05-23 05:58
thanks in advance

vinod.baradwaj
2018-05-23 06:08
try this @avinash.eediga `https://github.com/Mikuu/Pact-JVM-Example` this is in jvm

rgshah781988
2018-05-23 06:21
@avinash.eediga Pactjs is little bit easy to understand

rgshah781988
2018-05-23 06:24
Can we have some automation in creating a pact file ? When user provide swagger file with its details. Then automatically pact file created. Is it possible ? We should have such kind of automation script? Which will boost use of pact.

bethskurrie
2018-05-23 06:25
Hi @rgshah781988 it could be written, but it's not going to help you. The value of pact is that the contract is generated by tests that execute the actual calls that your codebase will make in real life. A pact file generated from a swagger document misses the whole point.

rgshah781988
2018-05-23 06:25
Presently, It is difficult to update contract regularly whenever endpoint changes.

rgshah781988
2018-05-23 06:26
Can we have solution over this?

bethskurrie
2018-05-23 06:26
Presently, your contract tests are making you keep your code in sync with the provider changes. If they didn't do that, then there would be no value in them.

rgshah781988
2018-05-23 06:26
Agreed 100%.

bethskurrie
2018-05-23 06:26
I don't understand your question, sorry.

rgshah781988
2018-05-23 06:27
Can we make it automation to update end-point in contract file of pact

rgshah781988
2018-05-23 06:28
A pact file generated from a swagger document misses the whole point. - Can we find solution on this ?

tom
2018-05-23 06:42
has joined #general

tom
2018-05-23 06:45
I know that this isn't bet practice, but I need a matcher that make confirms that at object has been sent up, but the key/values aren't important

tom
2018-05-23 06:45
Does something like that exist?

tom
2018-05-23 06:59
I should add that is the values themselves would be objects

tom
2018-05-23 07:00
so using like({}) doesn't work

tom
2018-05-23 07:00
I should have mention that i am using pact-js

matt.fellows
2018-05-23 10:08
I'm sure this discussion has been had before.

matt.fellows
2018-05-23 10:09
We should get it up on our website so at least the key aspects to the problem and solution space are documented

matt.fellows
2018-05-23 10:10
:grin:

matt.fellows
2018-05-23 10:11
Hmmm. I don't think so, at least not in pact JS that I'm aware of

matt.fellows
2018-05-23 10:13
The keys are not matchable to my knowledge, they must be known in advance

bethskurrie
2018-05-23 10:15
The point of this sort of contract testing is not to *have* a pact file, it's to have two sets of tests (one in the consumer project using a mock provider, and one in the provider project using a "mock consumer") that are linked together so they can't get out of sync - the pact file is the mechanism for doing that. Generating a pact file from a swagger document is pointless, and is like marking your own exam, as I've heard someone once describe it before.

bethskurrie
2018-05-23 10:17
@tom is the expectation for the request body or the response body?

tom
2018-05-23 10:34
request body

tom
2018-05-23 10:34
Long story:

tom
2018-05-23 10:35
We use Redux

bethskurrie
2018-05-23 10:35
Hm. If it was the response body, you'd be fine, but for the request body, you really have to specify everything you're sending. Read up on Postel's Law if you're not familiar with it.

tom
2018-05-23 10:36
Yeah. Read that in the docs

tom
2018-05-23 10:37
and i totally agree .... EXCEPT

bethskurrie
2018-05-23 10:37
Redux puts extra stuff in that you don't care about?

tom
2018-05-23 10:37
we have 'screen capture'

tom
2018-05-23 10:38
we are currently achieving this by sending the entire state up as an additional parameter

tom
2018-05-23 10:38
HORRIBLE, i know

tom
2018-05-23 10:38
but, genius in comparison to how we were doing it

bethskurrie
2018-05-23 10:39
What level are you writing your pact tests at? Are they going through the UI, or just testing the API client class?

tom
2018-05-23 10:39
through the ui

bethskurrie
2018-05-23 10:39
there's your problem.

bethskurrie
2018-05-23 10:40
Ideally, you write pact tests for as little code as possible. Just the client that is responsible for making the API calls.

bethskurrie
2018-05-23 10:40
Then, you're in control of everything that gets passed into that client.

rgshah781988
2018-05-23 10:40
Thanks for update

tom
2018-05-23 10:40
Hmmmm. You are right (as always)

bethskurrie
2018-05-23 10:40
Back door of the consumer to front door of the provider.

bethskurrie
2018-05-23 10:41
Ha! My husband would disagree with you there :stuck_out_tongue:

bethskurrie
2018-05-23 10:41
But I have done this enough to know how to write painful pact tests, and I know that the more code you cover with them, the more painful they are.

tom
2018-05-23 10:41
BUT, it doesn't help with the next point

tom
2018-05-23 10:42
It will fail on the mock server

tom
2018-05-23 10:42
which would suck because i am using that for deving


tom
2018-05-23 10:43
the cheat answer is to change it to pass up a stringified json object

bethskurrie
2018-05-23 10:43
There may be a workaround. Let me have a look and see if some naughty code I once put in there is still there.

tom
2018-05-23 10:43
but i was hoping to not have to do any re work

tom
2018-05-23 10:44
The weird thing is, it works in 4

tom
2018-05-23 10:44
it broke updating to 5

bethskurrie
2018-05-23 10:45
4/5 of what?

bethskurrie
2018-05-23 10:45
Is that a pact-js version?


tom
2018-05-23 10:45
it shouldn't have worked, so 5 didn't break it,

bethskurrie
2018-05-23 10:46
i haven't touched that part of the code for years.

bethskurrie
2018-05-23 10:46
I'm just seeing if the dirty hack I once put in to allow this sort of thing is still there

tom
2018-05-23 10:46
:crossed_fingers:

tom
2018-05-23 10:48
The weird thing is, as I was explaining to Beth) that it worked in 4.

tom
2018-05-23 10:48
It shouldn't have

bethskurrie
2018-05-23 10:48
ok... we have two options. We can hack the ruby code or we can hack the js code.

tom
2018-05-23 10:49
I am WAY more comfortable with JS

bethskurrie
2018-05-23 10:49
In the request that gets sent to the mock service, at the same level as the body, path, headers keys, you can add another key called `options`.


bethskurrie
2018-05-23 10:49
In that hash, if you set `{"allow_unexpected_keys_in_body": true}` then it will allow extra keys in the body

bethskurrie
2018-05-23 10:50
You'll have to override the javascript code that sends the request. Is monkeypatching js a thing?

tom
2018-05-23 10:50
I will make it so

bethskurrie
2018-05-23 10:50
If that doesn't work, there's a built in mechanism for allowing us to monkeypatch the ruby :wink:

bethskurrie
2018-05-23 10:51
I persuaded michel to put it in, despite great protestations.

tom
2018-05-23 10:51
So i need to send that up with every request where I need this attribute?

bethskurrie
2018-05-23 10:51
yes


tom
2018-05-23 10:52
I will have a play around with it and get back to you.

bethskurrie
2018-05-23 10:53
ok. if that fails, I can send you the ruby for the monkeypatch.

tom
2018-05-23 10:54
The other option is to change the request to strings and then just parse it on the server site


tom
2018-05-23 10:54
thanks again

bethskurrie
2018-05-23 10:54
good to know there's a backup plan.

bethskurrie
2018-05-23 10:54
np

tom
2018-05-23 10:55
but it is only after updated to 5 that it started.

tom
2018-05-23 10:55
It is my fault

matt.fellows
2018-05-23 10:58
We might need an option to pass that through @bethskurrie, with a warning when used

gopinathlangote11
2018-05-23 13:29
has joined #general

scott.osborne1
2018-05-23 15:25
I would love to be able to set pact-broker configuration through the database instead of in the http://config.ru file. Can anyone point me to examples for setting up configuration in the database?

scott.osborne1
2018-05-23 15:26
Specifically I want to set "order_versions_by_date = true" and have it persist over restarts and upgrades to the pact-broker docker image.

scott.osborne1
2018-05-23 15:27
I could package my own docker image that uses your image and updates the config file, but the http://config.ru is not consistent between pact-broker-docker images either, so I would prefer to put these kinds of settings in the database.

peter.banjo
2018-05-23 15:41
hi. i'm trying to test a swagger API with Pact using swagger-mock-validator. the tests are failing and I'm not sure where the problem is. my setup is like this ``` // secure.spec.js const interaction = { state: "authenticated request", uponReceiving: "a request for a secure resource", withRequest: { method: "GET", path: "/secure", headers: { Accept: "application/json", Authorization: "Bearer 1234XYz" } }, willRespondWith: { status: 200, headers: { "Content-Type": "application/json" }, body: EXPECTED_BODY } }; ```

peter.banjo
2018-05-23 15:42
``` // swagger.yaml swagger: "2.0" ... securityDefinitions: Bearer: type: apiKey name: Authorization in: header ... /secure: x-swagger-router-controller: secure get: description: Allows only secure requests operationId: secure security: - Bearer: [] responses: "200": description: Success schema: $ref: "#/definitions/SecureResponse" default: description: Error schema: $ref: "#/definitions/UnauthorizedError" ```

peter.banjo
2018-05-23 15:43
is anyone familiar with using swagger and pact?

greg
2018-05-23 15:45
has joined #general

peter.banjo
2018-05-23 15:50
I found the issue... i had multiple definitions in my pact file so `pactfileWriteMode: "overwrite",` solved it

paulswilliams
2018-05-23 19:33
has joined #general

paulswilliams
2018-05-23 19:35
Hi all.

bethskurrie
2018-05-24 04:17
It's not a feature I really advertise! But there are certain situations where it's better than the alternatives.

gopinathlangote11
2018-05-24 05:18
Hello


bethskurrie
2018-05-24 08:37
I haven't gotten around to making an API for the configuration, but here is the sql to set the config you want:

bethskurrie
2018-05-24 08:38
``` insert into config (name, type, value, created_at, updated_at) values ('order_versions_by_date', 'boolean', '1', now(), now()); ```

bethskurrie
2018-05-24 08:40
Any luck @tom?


rgshah781988
2018-05-24 11:54
:+1:

matt.fellows
2018-05-24 12:19
Nice, thanks Beth

scott.osborne1
2018-05-24 15:26
That's great! Thank you! I was putting in "true" in the database and it wasn't working. I'll use your example. Appreciate it!

santoshtrip
2018-05-24 23:12
@shekharsp27 can you please share the whole dependency set to run this

santoshtrip
2018-05-24 23:13
Having tough time with multiple versions causing conflict

eumirg
2018-05-25 05:14
has joined #general

shirren
2018-05-25 05:44
has joined #general

shekharsp27
2018-05-25 11:11
Here is consumer dependency

shekharsp27
2018-05-25 11:12
<dependencies> <dependency> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-consumer-junit_2.12</artifactId> <version>3.5.13</version> <scope>test</scope> </dependency> <dependency> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-consumer-java8_2.12</artifactId> <version>3.5.13</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>com.atlassian.oai</groupId> <artifactId>swagger-request-validator-pact</artifactId> <version>1.3.8</version> </dependency> <!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured --> <dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <version>3.0.7</version> <scope>test</scope> </dependency> <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-parser</artifactId> <version>1.0.34</version> </dependency> </dependencies>

shekharsp27
2018-05-25 11:13
Here is provider dependency <dependencies> <dependency> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-provider-junit_2.12</artifactId> <version>3.5.13</version> </dependency> <dependency> <groupId>com.atlassian.oai</groupId> <artifactId>swagger-request-validator-pact</artifactId> <version>1.3.8</version> </dependency> <dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <version>3.0.7</version> <scope>test</scope> </dependency> <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-parser</artifactId> <version>1.0.34</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.9.4</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.9.4</version> </dependency> </dependencies>

dervis4
2018-05-28 09:08
has joined #general

dervis4
2018-05-28 10:22
Hi guys! We (at Norwegian LWA) had some issues with the content-type header when running our tests against a Jetty-server. We have made a improvement in Pact-JVM that makes Pact able to accept content-type header with an optional whitespace character (as pr the W3C-specification). Please see our pull-request here: https://github.com/DiUS/pact-jvm/pull/688. :slightly_smiling_face:

mboudreau
2018-05-28 12:00
thanks for the PR. It's night time for most of the core contributors, but I'm sure it will be looked at soon. Cheers :slightly_smiling_face:

dervis4
2018-05-28 12:15
Thank you @mboudreau (its day time here in Norway)

paulswilliams
2018-05-28 12:34
So I?ve got a reliable consumer + provider test working with contracts held by the broker. However, I now want to add a test for an exception case as well as the positive case. Should I just add a uponReceiving? section to this DSL, and another authClient.login chunk into my existing @Test? As you can only have one test per class using the JUnit integration, should I be using the DSL instead? Using this approach, there seems to be a lot of boilerplate needed :confused: ```public class AuthClientTest { @Rule public PactProviderRuleMk2 mockProvider = new PactProviderRuleMk2("simple-auth-api", "localhost", 8081, this); @Pact(consumer = "simple-web") public RequestResponsePact createPact(PactDslWithProvider builder) { Map<String, String> requestHeaders = new HashMap<>(); requestHeaders.put("Accept", "application/json, application/cbor, application/*+json"); Map<String, String> expectedResponseHeaders = new HashMap<>(); expectedResponseHeaders.put("Content-Type", "application/json;charset=UTF-8"); return builder .given("Paul exists with password Secret") .uponReceiving("valid authentication details") .path("/login") .query("username=Paul&password=Secret") .headers(requestHeaders) .method("GET") .willRespondWith() .status(200) .headers(expectedResponseHeaders) .body("{\"id\":123,\"username\":\"paul\",\"firstname\":\"Paul\",\"lastname\":\"Williams\"}") .toPact(); } @Test @PactVerification() public void successfulLogin() { User login = new AuthClient().login("Paul", "Secret"); assertThat(login, is(notNullValue())); assertThat(login.getId(), is(123)); assertThat(login.getUsername(), is("paul")); assertThat(login.getFirstname(), is("Paul")); assertThat(login.getLastname(), is("Williams")); } }```

paulswilliams
2018-05-28 12:37
Although one large test testing multiple interactions would work, it gives many reasons for it to fail?

matt.fellows
2018-05-28 12:38
Personally i would try to keep one test for each single interaction rather than make each test more complex, even if it does involve more verbosity/boilerplate. @uglyog might have some opinions tho

mboudreau
2018-05-28 12:40
one way to reduce boilerplate is to have shared 'util' classes that setup the repetitive things from your DSL definition

paulswilliams
2018-05-28 12:40
The boilerplate I?m referring to is less the DSL, more the assertions. Most of: ```MockProviderConfig config = MockProviderConfig.createDefault(); PactVerificationResult result = runConsumerTest(pact, config, mockServer -> { Map expectedResponse = new HashMap(); expectedResponse.put("hello", "harry"); try { assertEquals(new ProviderClient(mockServer.getUrl()).hello("{\"name\": \"harry\"}"), expectedResponse); } catch (IOException e) { throw new RuntimeException(e); } }); if (result instanceof PactVerificationResult.Error) { throw new RuntimeException(((PactVerificationResult.Error)result).getError()); } assertEquals(PactVerificationResult.Ok.INSTANCE, result);```

paulswilliams
2018-05-28 12:41
Testing one thing per test is generally how I?ve done things for 10 years, just trying to work out how to do that succinctly.

paulswilliams
2018-05-28 13:48
Further, is it possible for mocks to throw exceptions in @State methods? The following code seems to cause the exception to be thrown in the wrong context, and thus my ControllerAdvice doesn?t pick it up and convert to 401. ``` @State("Paul exists with password Secret") public void returnSuccessfulLogin() { when(authService.login("Paul", "Secret")).thenReturn(new User(123, "paul", "Paul", "Williams")); when(authService.login("Paul", "Unconcealed")).thenThrow(new BadCredentialsException()); }```

abhilash.hanumanth
2018-05-28 14:06
Did anyone implement PACT for kakfa message queue consumer and provider ?

matt.fellows
2018-05-28 21:00
It's been done, which language?

abhilash.hanumanth
2018-05-29 05:36
using pact jvm

gaurav
2018-05-29 07:56
has joined #general

gaurav
2018-05-29 07:58
configuration for maven plugin.

gaurav
2018-05-29 07:58
Not able to do `mvn pact:publish`

gaurav
2018-05-29 07:58
with above configuration.

gaurav
2018-05-29 07:59
Is there anything wrong I am doing?

gaurav
2018-05-29 08:00
also how can I publish tag? thanks a lot..

gaurav
2018-05-29 08:01
I get this error: `No plugin found for prefix 'pact' in the current project `.. Its in plugins management..

gaurav
2018-05-29 08:03
I was not able to find documentation related to this.. so if someone knows a link then please share.. thanks

such.su
2018-05-29 09:41
has joined #general

such.su
2018-05-29 10:02
Hi all, I am just investigating pact-python to see if it can be used in my services but I got some questions. Could anyone help: 1. Does pact-python support services based on XML message? 2. Is there any reason that it's not implemented or it will be implemented soon?

bethskurrie
2018-05-29 10:03
It isn't yet, but we've just started discussions with someone who is interested in implemeting it. You can use exact string matching, but it will be quite brittle.

such.su
2018-05-29 11:06
Yeah, exact string matching is quite brittle. Is there a release plan for supporting XML? I am quite interesting in using this awesome Pact.

bethskurrie
2018-05-29 11:07
If you look at the pact-dev mailing list, you'll find the current "plan" such as it is.

bethskurrie
2018-05-29 11:08
Oh, actually, that conversation wasn't on that list. Sorry.

such.su
2018-05-29 11:12
Hmmm, where to look at the pact-dev mailing list?:thinking_face:

bethskurrie
2018-05-29 11:12
Sorry, I realised it wasn't on that mailing list

such.su
2018-05-29 11:15
Got it. I am also interested in that mailing list.

bethskurrie
2018-05-29 11:15
I think you can just join it. We're trying to move conversation to slack however.

such.su
2018-05-29 11:16
Cool, thanks:+1:

aswini.j
2018-05-29 11:52
has joined #general

premmkrishna.shenoy
2018-05-29 12:09
has joined #general

premmkrishna.shenoy
2018-05-29 12:11
Hi I am performing a pact test where the provider response is 'application/javascript' with json as body. My provider test is failing on body while my consumer test are good. Do you support 'application/javascript' content type?

aswini.j
2018-05-29 12:13
Does it support JavaScript content-type? The third party service that my microservice interacts with returns the response with the content-type application/JavaScript;charset=UTF-8. Therefore, pact json has response body as string & matching rules has empty body.

aswini.j
2018-05-29 12:14
Using the following pact dependencies:

aswini.j
2018-05-29 12:15
testIntegrationCompile('au.com.dius:pact-jvm-consumer-junit_2.12:3.5.11') testIntegrationCompile('au.com.dius:pact-jvm-provider-junit_2.12:3.5.11') testIntegrationCompile('au.com.dius:pact-jvm-provider-spring_2.12:3.5.11') testIntegrationCompile('au.com.dius:pact-jvm-consumer-java8_2.12:3.5.11')

dagarwal
2018-05-29 20:27
has joined #general

jeremy.shipman
2018-05-29 21:55
has joined #general

jeremy.shipman
2018-05-29 21:57
Hello PACT?ers. I have a random query string being added inside my jQuery ajax config. Is there a way to specify in an interaction that the mock provider service ignore this?

matt.fellows
2018-05-29 21:58
Does the qs have a pattern you can use to match? If it's a cache buster, you could just add a regex matcher for it

jeremy.shipman
2018-05-29 21:58
Ok - yes it?s like a cache buster. Gets around some Safari bug, I see commented

matt.fellows
2018-05-29 22:00
That would work then

bethskurrie
2018-05-29 22:14
You will unfortunately lose the ability to have your pacts "pre-verified" in the broker if you use random data. Let me know if that makes no sense.

uglyog
2018-05-29 23:29
Try using the full artifact name: `pact-jvm-provider-junit_2.12:publish`

uglyog
2018-05-29 23:30
`application/javascript` should be used for Javascript source files. `application/json` should be used for JSON bodies.

uglyog
2018-05-29 23:32
Unfortunately, JavaScript is not a supported content type.

gaurav
2018-05-30 01:11
my bad! I should be using: `pact-jvm-provider-maven_2.12` (not junit_2.12) thanks a lot. Although I believe there should be another maven plugin like `pact-jvm-consumer-maven_2.12` to publish pacts, as publishing pacts are done at consumer side. Anyways, Is there any documentation for this maven plugin goals? Thanks again!

gaurav
2018-05-30 01:15
This time, I am more looking for "how to tag using this maven plugin".. but would love to explore other options this plugin provides.


jeremy.shipman
2018-05-30 02:15
Here?s my code. Is the `query` part of withRequest correct? I?m still getting ?missing requests? urls spitting out. ``` return { uponReceiving: title || mockjax.url, withRequest: { method: mockjax.type || "GET", path: mockjax.url, query: { r: like({ generate: "163aece11f20.7ff22681c8afd", matcher: ".*" }) } }, willRespondWith: { status: mockjax.status || 200, headers: { "Content-Type": "application/json" }, body: mockjax.responseJSON } }; ``` (I?m reusing mock configuration intended for mockjax options)

jeremy.shipman
2018-05-30 02:23
The documentation here: https://docs.pact.io/implementation-guides/javascript suggests the query field should be in this form: `query: /* '?query=parameters' (string) */,`

jeremy.shipman
2018-05-30 02:23
I?m not sure if this means I can?t use js objects to configure it

gaurav
2018-05-30 02:42
thanks a lot. I could pass tags as -D by defining a maven properties. I have another question however bit unrelated so will put that as new slack message. thanks again!

gaurav
2018-05-30 02:53
Hello all, as a best practice, which is more preferable 1. 'mvn pact:verify' to run provider tests 2. Run test with sure-fire plugin (like we we do for normal unit tests in our case). and why?

mboudreau
2018-05-30 02:55
what works best for you?

gaurav
2018-05-30 02:57
I tried both.. both works fine for current purpose so I am trying to decide which one to use. :slightly_smiling_face:

bethskurrie
2018-05-30 02:57
I would suggest it doesn't matter then!

bethskurrie
2018-05-30 02:58
@uglyog may have an opinion

gaurav
2018-05-30 03:00
thanks.. I will also spend little more time experience the whole flow.. checking which one would fit better with our CI pipeline practically. At this point, from my current understanding: both should work just fine.

gaurav
2018-05-30 03:54
I wonder how I can pass 'tag' from command line when running tests through sure-fire.. l have a profile to run provider tests: providerTests. so `mvn test -PproviderTests` will run my provider tests.. However if I want to run provider tests using pacts with a particular tag: 'head' or 'prod' etc., I am wondering how I could achieve that. any ideas? Thanks a lot.

bethskurrie
2018-05-30 03:55
I believe there is a configuration in the maven task config

bethskurrie
2018-05-30 03:55
Can you find the page for the mvn config?


gaurav
2018-05-30 03:58
but thats when I am using `mvn pact:verify` right?

bethskurrie
2018-05-30 03:58
Scroll down until you read the part about the tags.

gaurav
2018-05-30 04:01
I will have to use `mvn pact:verify` if I want to use tag this way..

bethskurrie
2018-05-30 04:01
:thumbsup:

gaurav
2018-05-30 04:01
If I am using surefire then I am defining tags currently as `@PactBroker(host = ?localhost?, port = "80", tags = {"TEST","DEV"})`

uglyog
2018-05-30 04:02
You will probably have to use Java system properties

gaurav
2018-05-30 04:03
I see.. so if I set system properties `pactbroker.tags` to a tag then it should work..


gaurav
2018-05-30 04:13
great. Awesome. Its working. Thanks a lot.

aswini.j
2018-05-30 05:38
Thank you

gaurav
2018-05-30 07:06
Thinking about a bit, I see a possible gap regarding verifying pact with provider when making changes on consumer side. Don?t know how to fill the gap. Following is the scenario: - I checkout a branch on consumer side: my_branch - I make some changes that might impact pact. - I do: `mvn pact:publish -Dpact.tag=my_branch` - Now I want to validate my pact so lets suppose I checkout provider code and do: `mvn test -PproviderTests -Dpactbroker.tags=my_branch` (assuming pom is setup this way) Tests pass and I am happy. BUT I have run master-version-provider to verify pacts. Current master provider code might be different than current production code. I am still not sure whether if I deploy my changes in production then there won?t be any contract issue. Its possible that my current expectation as consumer is not valid with provider service currently running in production.

gopinathlangote11
2018-05-30 07:13
@gaurav I feel, You verified the pacts against your branch, not against master. Whenever you merge the branch to master I think you need to verify once again.

gaurav
2018-05-30 07:15
I verified a pact: consumer-branch with provider-master.. my question is how do I make sure that my consumer-branch will be fine with provider-prod.

bethskurrie
2018-05-30 07:46
@gaurav you need to use the can-i-deploy tool



gaurav
2018-05-30 07:50
thanks a lot Beth. I will read the documentation and try can-i-deploy tool

gaurav
2018-05-30 08:24
thanks, it is starting to make sense now.. So provider version in pact matrix should ideally be git-sha (or anything that can be used to checkout prod version of provider).. right? consumer version does not need git-sha version etc. if doing proper tagging, but probably better to do that way for sake of uniformity.. I am going to do some experiments to get some practical experience of how it would work. Thanks a lot @bethskurrie I also see a scope of a maven plugin to handle many of these things.. Thanks again!

bethskurrie
2018-05-30 08:26
Yes, you should use a git sha (or a version with the git sha in the metadata) for your version. I need to update all the examples, because currently, they have a semantic version, which is now not recommended. Make sure your broker is sorting by date and not semantic version as well. You'll find that setting in the configuration docs in the Pact Broker wiki.

gaurav
2018-05-30 08:33
yea.. may be in next broker release, we can change name ?Consumer Version? to ?Consumer SCM Identifier/tag..etc.? or something like that..

bethskurrie
2018-05-30 08:35
Yes, i wish I'd called it something different. I didn't realise quite what the API would turn into when I first wrote it.

gaurav
2018-05-30 08:35
being agile :slightly_smiling_face:

bethskurrie
2018-05-30 08:36
indeed

gaurav
2018-05-30 08:39
Also the fact that 'the default value is {project.version}' is bit misguiding now.

uldis.sturms
2018-05-30 13:39
has joined #general

jeremy.shipman
2018-05-30 21:09
I?m currently trying to write our first PACT test from a web-based client using pact-web to the ruby stand alone mock provider. We haven?t reached the point of setting up a broker yet.

jeremy.shipman
2018-05-30 21:10
Can anyone @here comment?

jeremy.shipman
2018-05-30 21:12
I?m getting a list of `Missing requests`, but I can?t make make the list smaller. I?m assuming it?ll get smaller if the mock service provider will have correctly configured interactions - where effectively the `r` query param is ignored.

jeremy.shipman
2018-05-30 21:14
I?ve tried deleting previously generated pacts in case that was interfering.

jeremy.shipman
2018-05-30 21:16
I?ve tried the following formats of query matching ``` query: "?r=163aece11f20.7ff22681c8afd", query: { r: somethingLike("163aece11f20.7ff22681c8afd") }, query: { r: like({ generate: "163aece11f20.7ff22681c8afd", matcher: ".*" }) } ```

mboudreau
2018-05-30 22:23
yeah, looking into it

mboudreau
2018-05-30 22:28
ah, right, 'like' isn't the right one for the query

mboudreau
2018-05-30 22:29
you want to use `term` if you want to use the generate/matcher


seb
2018-05-31 08:16
has joined #general

gaurav
2018-05-31 09:38
getting this strangely.. will put more information in the thread comments.

2018-05-31 09:39
@gaurav commented on @gaurav?s file https://pact-foundation.slack.com/files/UAX3HUUE5/FAZAZTUCV/-.js: my mock request configuration does have ?myCategory? field, I can see that when I print my mock request. Also putting debug points I see that test corresponding to this interaction actually is getting response and assertion in test is passing.. Its just that at the end of test, I get this exception strangely. spent almost half of the day! Any idea/tips to help debugging it.. I am sure I am doing something silly somewhere :confused:

mboudreau
2018-05-31 09:54
can you post the dsl code you're using for this test?

matt.fellows
2018-05-31 09:57
Is myCategory a Boolean value? That error seems to indicate it got a Boolean, but the wrong calue

matt.fellows
2018-05-31 09:57
Value*

g.r.mccann
2018-05-31 10:37
has joined #general

g.r.mccann
2018-05-31 10:41
Hi

g.r.mccann
2018-05-31 10:43
I was hoping I could pick your brains on a migration from https://www.npmjs.com/package/pact to https://github.com/pact-foundation/pact-node or pact-js

g.r.mccann
2018-05-31 10:44
we have a number of tests using the older version. As of this morning one of its downstream dependencies appears to have dissapeared from npm registry @types/node/-/node-9.4.2.tgz so am looking to upgrade the tests

g.r.mccann
2018-05-31 10:46
the current tests make use of the Matchers (eachLike, somethingLike) which don't seem to present in pact-node. According to the docs they should be in pact-js but upon destructing Matchers I'm getting undefined

g.r.mccann
2018-05-31 10:46
are they in a seperate repo or am I barking up the wrong tree

g.r.mccann
2018-05-31 10:46
any help would be much appreciated

matt.fellows
2018-05-31 10:47
You probably want @pact-foundation/pact

g.r.mccann
2018-05-31 10:47
so thats the one I'm trying now

matt.fellows
2018-05-31 10:47
Those matchers are now in `Matchers`

g.r.mccann
2018-05-31 10:47
const { Pact } = require('@pact-foundation/pact'); const {Matchers} = Pact;

g.r.mccann
2018-05-31 10:48
Matchers seems to be undefined


matt.fellows
2018-05-31 10:50
This example should help

matt.fellows
2018-05-31 10:50
Sorry just jumping in a car

g.r.mccann
2018-05-31 10:59
That's fine thanks for your help, much appreciated

g.r.mccann
2018-05-31 10:59
const { Pact, Matchers } = require('@pact-foundation/pact');

g.r.mccann
2018-05-31 11:00
seems to do the job as opposed to how we had it before.

matt.fellows
2018-05-31 13:19
Great!

gaurav
2018-06-01 00:49
Thanks Matt.. got it right! the test code was sending different value in the request.. I am still wondering why mock server gave back the response, if request body was different..

gaurav
2018-06-01 01:28
I understand now.. request body is PactDslJsonBody so it matches with field and field type.. not with field value.

jeremy.shipman
2018-06-01 02:09
Thanks @mboudreau for your help :wave:

mboudreau
2018-06-01 02:12
np :slightly_smiling_face:

gaurav
2018-06-01 05:33
Getting 500 suddenly with mvn pact:publish -Dpact.tag=myBranch (pom is setup accordingly).. was working fine and suddenly stopeed working. Any log that can help?

uglyog
2018-06-01 05:34
What broker are you using?

gaurav
2018-06-01 05:35
x-pact-broker-version: 2.19.1

bethskurrie
2018-06-01 05:35
Docker container?


gaurav
2018-06-01 05:35
yea its container.. checking troubleshooting page.

gaurav
2018-06-01 05:38
pact-broker restart fixed it.. however I am going to set PACT_BROKER_LOG_LEVEL to DEBUG .. just in case it happens again.. thanks all. :slightly_smiling_face:

bethskurrie
2018-06-01 05:38
np

bethskurrie
2018-06-01 05:39
did you find any logs?

gaurav
2018-06-01 05:43
running broker in mesos using marathon and getting logs is bit tricky (our other applications use logstash so we can check app logs in kibana).. We are working on making it better.. however I am going to put ssh in broker docker image so that I can do ssh and get logs from container.. or for any other troubleshooting

gaurav
2018-06-01 07:40
From Pact Nirvana Document: `To reach Pact Nirvana, the final step is to have a CI build that checks out the code for the production version of your provider, and have it verify the same pacts that the head version does.` In case consumer has new pact tests with new states, this won?t work right? because production version of provider code will be having older version of provider tests, that might not run with head version consumer pacts.

bethskurrie
2018-06-01 07:41
I see you've thought this through ;-)

bethskurrie
2018-06-01 07:42
My thought on this is that you could keep the provider state code in a separate repo

bethskurrie
2018-06-01 07:42
This may be difficult

bethskurrie
2018-06-01 07:42
Too difficult

gaurav
2018-06-01 07:43
I intend to put ?independent deployment? in practice so have to think a bit.. :slightly_smiling_face: will think about how to resolve it in our case..

bethskurrie
2018-06-01 07:44
I think it should be OK if you don't go back further than the earliest version that used pacts.

bethskurrie
2018-06-01 07:44
And I'm not 100% sure that it's necessary.

bethskurrie
2018-06-01 07:45
Ensuring that you deploy consume and provider as often as possible should mean you're never in that situation.

gaurav
2018-06-01 07:53
hmm that seems right.. however just to be on safer side: we have all our microservices always running in pre-prod env (same version as prod). If we will be able to replay pact files against those microservices running in pre-prod, and somehow verify that contracts are fine then it might work. at least for few cases (assuming we are using pre-prod data in consumer tests requests).. For negative tests e.g. 404 etc it won?t work. But we don?t need pacts for negative scenarios.

matt.fellows
2018-06-01 11:38
that sort things out Jeremy?

shekharsp27
2018-06-01 13:11
Hi, I have a question about "pact-provider-verifier-docker", as per the document I have done the setup 1) Following is my API docker file, its a simple spring application FROM openjdk:8-jre-alpine COPY ./target/updated-provider-service-0.0.1-SNAPSHOT.jar /usr/src/animal/ WORKDIR /usr/src/animal EXPOSE 8080 CMD ["java", "-jar", "updated-provider-service-0.0.1-SNAPSHOT.jar"] 2) Following is docker-compose yml file <pre>version: '3' services: animalwebapp: build: ./ ports: - "8000:8080" pactverifier: image: dius/pact-provider-verifier-docker links: - animalwebapp environment: - pact_urls=http://192.168.99.100/pacts/provider/zoo__update_provider/consumer/zoo_update_consumer/latest - provider_base_url=http://192.168.99.100:8000</pre> Issue is : When I execute "docker-compose up", the pact verification task is executing before my application gets up & running(also checked by adding depends_on flag). Please let me know what should be the approach here.

gaurav
2018-06-01 13:28
more a docker related question I think.. but if you add ?depends_on? in docker-compose file preferably with a health check then it should be fine. more: https://docs.docker.com/compose/startup-order/

matt.fellows
2018-06-01 13:42
Yep

vikassd2012
2018-06-02 03:35
has joined #general

vikassd2012
2018-06-02 03:36
Hi All needed some of your help. I am trying to run my first test using Pact on dotnet core and I am getting this error {StatusCode: 500, ReasonPhrase: 'Internal Server Error ' I ran the sample solution here https://github.com/tdshipley/pact-workshop-dotnet-core-v1 and it works as expected. I wrote the sample for my application under test following the example

vikassd2012
2018-06-02 03:38
here is my sample code

vikassd2012
2018-06-02 03:38
public void InstrumentReturnsInformationBySerialNumber() { // Arrange var expectedMessage = "{\"runName\":\"dummyRun\",\"instrumentSerialNumber\":\"ea82e963\",\"instrumentDescription\":\"f2bbec3c\",\"instrumenttype\":\"MiSeq\",\"instrumentSoftwareVersion\":\"1.0.0\",\"instrumentApiKeyUsed\":\"c67f59a6b9794c5fb14a594ab1dfe5eb\"}"; _mockProviderService.Given("there is data") .UponReceiving("A valid GET request for Instrument API with a serial number") .With(new ProviderServiceRequest { Method = HttpVerb.Get, Path = "/v3/instruments", Query = "ea82e963", }) .WillRespondWith(new ProviderServiceResponse { Status = 200, Headers = new Dictionary<string, object> { { "Content-Type", "application/json; charset=utf-8" } }, Body = new { message = expectedMessage } }); // Act var result = InstrumentServiceApiClient.GetInstrumentBySerialNumberUsingInstrumentService("ea82e963", _mockProviderServiceBaseUri).GetAwaiter().GetResult(); Console.WriteLine(result.ToString()); var resultBodyText = result.Content.ReadAsStringAsync().GetAwaiter().GetResult(); // Assert Assert.Contains(expectedMessage, resultBodyText); }

vikassd2012
2018-06-02 03:39
please note if I hit my consumer api itself, consuming the provider api, it works as expected

vikassd2012
2018-06-02 03:59
Found an extra comma in the ProviderServiceRequest, removed that but still the same error.

vikassd2012
2018-06-02 04:49
I found my problem

vikassd2012
2018-06-02 04:51
also I was mucking with mockerserver

vikassd2012
2018-06-02 04:51
MockProviderService = PactBuilder.MockService(MockServerPort, new JsonSerializerSettings());

vikassd2012
2018-06-02 04:51
modified that to MockProviderService = PactBuilder.MockService(MockServerPort);

vikassd2012
2018-06-02 04:51
and now it works

bethskurrie
2018-06-02 04:52
Hello Vikas. Can you ask in the pact net channel, and remember to use threads so we can keep conversations focussed. Thanks!

bethskurrie
2018-06-02 04:53
Putting ``` before and after your code will keep it formatted nicely.

hstene
2018-06-02 05:20
has joined #general

hstene
2018-06-02 05:21
God morning. Migrating to Slack is a great idea! :)

vikassd2012
2018-06-02 05:25
Sure Beth got your points. Didn't use Slave before.

bethskurrie
2018-06-02 08:48
Hi all. We have been alerted to a vulnerability in the Pact Broker webhooks and have released a fix in version 2.19.2. The latest Docker image has been upgraded to this version. If you're unsure of the version of your current installation, you'll find the version number in the X-Pact-Broker-Version header in the API Browser. Please upgrade your instance as soon as possible. If you are using the DiUS hosted version, it has already been updated, and no further action is necessary.

richard.peckett
2018-06-02 11:35
has joined #general

matt.fellows
2018-06-02 12:19
Cross post from the Pact Broker slack, but just note that if you?re using the hosted broker from http://pact.dius.com.au, it is already updated

heymega
2018-06-02 13:05
has joined #general

james.carman
2018-06-02 13:09
has joined #general

james.carman
2018-06-02 13:11
When doing pact verification, I want to spin up my provider locally, download all consumer pacts, and run them against my local instance?

james.carman
2018-06-02 13:13
Does that mean I?m mocking out any downstream services? If so, should these mocks be generating pacts for those downstream services also? Basically, do we have a cascading pact situation going on?

james.carman
2018-06-02 20:09
Is that the right pattern or should I verify against a ?deployed? instance of my provider?

hstene
2018-06-02 21:01
deployed

hstene
2018-06-02 21:03
If you want to mock away downstream services, then you are free to do so. That is what I am recommending in my projects as you want to escape the "integration test hell" that downstream services create.

james.carman
2018-06-02 21:04
@hstene so your recommendation is to do the ?cascading? I?m talking about?

james.carman
2018-06-02 21:04
I like that idea :slightly_smiling_face:

james.carman
2018-06-02 21:05
I mean, if you have to push your provider out to some deployment environment in order to verify the pacts against it, then aren?t you basically doing an ?end-to-end? test (the first end is just one less hop)?

james.carman
2018-06-02 21:06
I?m just trying to understand the best practices here, as I?m somewhat new to this world (and I love the idea)

hstene
2018-06-02 21:06
Who are these downstream services? Is it external APIs or services that you control?

james.carman
2018-06-02 21:06
services I control

james.carman
2018-06-02 21:07
Now, would the pact verification run be a bad time to establish new pacts for the downstream services?

james.carman
2018-06-02 21:08
Or, do I just do regular downstream mocks during the ?verify? run and then during my regular pact establishment run (whatever that is called) I publish my pacts against my downstream service?

james.carman
2018-06-02 21:08
Consider the case of Service A --> Service B --> Service C.

james.carman
2018-06-02 21:08
Service A runs some tests, establishing its ?pact? with Service B

james.carman
2018-06-02 21:09
Now, while I?m verifying Service A?s pact it published against Service B, would I publish my pact for Service C during that verify run?

james.carman
2018-06-02 21:09
Or, would that be a different build and I just use a regular (non-pact) mock of Service C during the verify run for Service B

james.carman
2018-06-02 21:09
I hope I?m making sense. I don?t know all the lingo yet I?m afraid :slightly_smiling_face:

hstene
2018-06-02 21:23
Ok, so in your scenario you have Service A that consumes B, and Service B consumes C. By having created a pact between Service B and Service C, you already have *a trusting relationship* with that provider. You already agree on both input and output data of all endpoints you are using. This trusting relationship is the key to this. When you are creating a new release of your service (Service A) you create a new pact and upload it to the broker. When deploying your new Service you run your integration tests to make sure that your service and Service B are communicating correctly. When Service B is getting a new release, it has to verify all pacts before creating the release. When running pacts, Service B *will not* need to talk to downstream service. Because Service B has a trusting relationship with Service C guaranteed by their pact.

hstene
2018-06-02 21:23
Did that answer your question? :thinking_face: (I am going to bed now, but if you have more questions I will answer them later)

matt.fellows
2018-06-02 22:05
So the recommended approach from the Pact team is the cascading pacts you talk about. The choice can then be how you stub the services in each case. This little gist helps explain the tradeoffs https://gist.github.com/bethesque/43eef1bf47afea4445c8b8bdebf28df0

gaurav
2018-06-03 02:39
I have similar scenario and, for now, I just stub downstream services without pact (hard coded). For contract creation with those downstream services: I have another set of consumer tests. I don?t know whether its the best approach but it keeps things simple (1:1) and works for us fine as we are just using simple 1-2 endpoints of downstream services when running provider tests. The approach of using existing consumer tests to create pact and then create stub is interesting, I will definitely try it and see how it works, in case I have more complex mocking to do.

uglyog
2018-06-03 02:40
It is always best to have the test concentrate on a single integration point at a time

gaurav
2018-06-03 02:41
agree! keeps things simple and we quickly know where the breaking points are. :slightly_smiling_face:

james.carman
2018-06-03 21:53
@matt.fellows Thanks! I will take a look.

james.carman
2018-06-03 21:54
@hstene thank you for your info also. :slightly_smiling_face: I am just now getting back in here. Didn?t see the notification. Sorry

james.carman
2018-06-03 21:55
@gaurav so, you?re saying just do regular mocks while verifying Service B?s pacts? Just tell the WireMock (or whatever) what to do and don?t upload pacts?

gaurav
2018-06-03 23:53
@james.carman thats what I am doing currently. I am not in Pact Foundation Team though.. just a user :slightly_smiling_face:

uglyog
2018-06-03 23:56
You don't have to be in Pact Foundation Team to dispense good advice :smile:

bethskurrie
2018-06-04 00:13
@james.carman make sure that you have something to keep your regular mocks in sync with reality still. That gist Matt sent should give you some ideas how.

james.carman
2018-06-04 01:43
Thanks, guys and gals. This is great stuff. Good community vibe here!

gaurav
2018-06-04 01:47
Thanks. Just wanted him to know that I am not an expert and don?t know ins-outs :slightly_smiling_face:. Also as a user I am kind of new.. used it few months before for short time and now picked up again.. enjoying learning it more and more.

james.carman
2018-06-04 01:48
So, the pact team recommends the cascade method, but multiple community members say to just use regular ole service mocks?

james.carman
2018-06-04 01:50
I?m trying to digest this.

james.carman
2018-06-04 01:51
And to clarify, my ?cascade? terminology means that a service?s verify run yields new pacts for its downstream dependencies.

james.carman
2018-06-04 01:53
Are there perhaps scenarios that might lend themselves better to one approach over the other? Or is this just a general pattern?

james.carman
2018-06-04 01:55
Sorry if my questions are silly and I?m not trying to start a religious war here. Just trying to stand on the shoulders of giants so that I can provide informed guidance to folks at work.

james.carman
2018-06-04 02:01
This is a very interesting debate, though

bethskurrie
2018-06-04 02:36
No, I wouldn't recommend that your verify tests generate pacts for downstream services. That would be quite brittle. But, I do recommend that you ensure that your mocks are kept in sync with reality by using some shared artifact between the plain old mocks and your downstream pact tests. Otherwise, your "chain" has a break in it.

hstene
2018-06-04 05:09
Has there been given any consideration to what happens if a consumer publishes two pacts with conflicting response values from the same endpoint? Like if one field of the response has been renamed. Example: `Consumer v0.0.1 performs POST - /customer` Should return ``` { "status": 200, "headers": { "Content-Type": "application/json;charset=UTF-8" }, "body": { "name": "Roger Antonsen", "id": 0, "ssn": "71039012345" } } ``` Example: `Consumer v0.0.2 performs POST - /customer` Should return ``` { "status": 201, "headers": { "Content-Type": "application/json;charset=UTF-8" }, "body": { "socialSecurityNumber": "31129012345", "name": "Henrik Stene", "id": 0 } } ``` Right now I can never get my provider to verify the pacts as they are conflicting. How would I on the provider side handle this? Can I somehow ignore pacts with older version numbers?

bethskurrie
2018-06-04 05:11
Let's continue this in a thread.

bethskurrie
2018-06-04 05:12
With traditional versioning, you would release a major version with a renamed field. With CDC, you would add the field with the new name, transition all the consumers on to the new field, then, once your contracts showed you that everyone was using the new name, remove the old field.

hstene
2018-06-04 05:13
Ok, so if my consumer suddenly requires the field to be renamed (bad bad consumers) I should just add it?

bethskurrie
2018-06-04 05:13
how would you do it if you didn't have CDC?

hstene
2018-06-04 05:14
Heh, good question. Nothing would happen and all our developers would argue who?s fault it is? :smile:

bethskurrie
2018-06-04 05:14
sounds about right.

bethskurrie
2018-06-04 05:14
:stuck_out_tongue:

bethskurrie
2018-06-04 05:14
I would suggest that if a field needed to be renamed, you'd get together and talk about it first.

bethskurrie
2018-06-04 05:14
and you'd work out the impact

bethskurrie
2018-06-04 05:15
same with cdc.

hstene
2018-06-04 05:15
Yeah, but this is why CDC is such a great idea. It makes changes so apparent and visible!

bethskurrie
2018-06-04 05:15
cdc isn't a license for consumer teams to make up a wish list. it's a concrete artifact that should reflect the agreement that has already been made in person.

bethskurrie
2018-06-04 05:16
consumer teams shouldn't just arbitrarily rename a field.

hstene
2018-06-04 05:16
Unless you want to practice Consumer Driven Development. But that would also be agreed upon first (hopefully)

bethskurrie
2018-06-04 05:16
but if there is business justification for it, it give you a process to migrate everyone.

bethskurrie
2018-06-04 05:17
just because an API is driven by the requirements of a consumer, doesn't mean the consumer team gets to dictate everything :stuck_out_tongue:

bethskurrie
2018-06-04 05:17
"it's not dictator driven contracts" is one of our commonly used lines.

hstene
2018-06-04 05:18
Hah, nice quote! Will definitely use that

bethskurrie
2018-06-04 05:18
In answer to your original question, no there is nothing stopping people putting in conflicting expectations. But at least the conflict is made apparent to all.

hstene
2018-06-04 05:19
How do I remove a single pact from the broker?

bethskurrie
2018-06-04 05:19
http delete request




hstene
2018-06-04 05:20
So there is no ?quick key? in the broker? (Maybe to prevent people from just removing pacts?)

bethskurrie
2018-06-04 05:21
There's no quick key because 99% of the broker development is done by me, and I just don't have enough free time to make a pretty UI.

bethskurrie
2018-06-04 05:21
I figure if you're testing APIs, you can handle a HAL browser.

bethskurrie
2018-06-04 05:22
How's your Ruby? :wink:

bethskurrie
2018-06-04 05:22
(Actually, ideally, it could use a nice react UI)

hstene
2018-06-04 05:23
Hah, No Ruby or Rect on my part I?m afraid. Not yet anyway

hstene
2018-06-04 05:23
Thanks for your input!

bethskurrie
2018-06-04 05:24
Please do read the "Steps to reaching Pact Nirvana" doc (link above). It will answer some of your questions. I see you're doing a talk at NDC. Happy to help out with any questions you have.

hstene
2018-06-04 05:25
Will read it and yes I am. Thank you! :slightly_smiling_face:

shekharsp27
2018-06-04 13:06
Thanks @gaurav, however looks like pact-provider-verifier-docker is not capable of doing matching based on regex

gaurav
2018-06-04 13:07
never tried pact-provider-verifier-docker.. so can?t comment on that :slightly_smiling_face:

richard.peckett
2018-06-04 13:57
@bethskurrie Hi Beth, just following up your email are you saying there is now a .net implementation of PACT which can be used mock AMQP? Cheers

james.carman
2018-06-04 15:49
@bethskurrie so, to follow-up a bit. Do you suggest using the pact mocking system to set up my mocks for my verify run, but just not publish the generated pacts?

james.carman
2018-06-04 20:22
Do we have an updated AWS terraform script for PactBroker or are we focusing on the docker stuff these days?

james.carman
2018-06-04 20:23
I was trying to get it set up in our VPC, but it appears the terraform scripts are out of date a bit

matt.fellows
2018-06-04 21:56
We have a terraform script?

matt.fellows
2018-06-04 21:57
Ah, yes

matt.fellows
2018-06-04 21:57
We don?t maintain that script, it was something a community member created and was willing to share. It may not be up to date

matt.fellows
2018-06-04 21:57
You could look at http://pact.dius.com.au

shekharsp27
2018-06-05 04:26
:+1:

shekharsp27
2018-06-05 05:25
I am exploring "pact-provider-verifier-docker" and I have observed that is not doing matching based on regex. Am I missing something?

bethskurrie
2018-06-05 05:40
I guess you could. There are probably more fully featured http mocking solutions however.

bethskurrie
2018-06-05 05:41
I personally wouldn't use pact as a stub.

bethskurrie
2018-06-05 05:42
No, the underlying ruby code is done, and ready for a dot net dev to wrap the dot net code around it, as the http implementation does.

bethskurrie
2018-06-05 05:44
@shekharsp27 What version of the pact specification are your pacts?

shekharsp27
2018-06-05 06:31
@bethskurrie V3

bethskurrie
2018-06-05 06:31
Sorry, you'll need to use v2 pacts

bethskurrie
2018-06-05 06:32
We haven't implemented v3 matching yet

shekharsp27
2018-06-05 06:32
Ok, Thanks @bethskurrie

bethskurrie
2018-06-05 06:33
Or use the Java verifier


bethskurrie
2018-06-05 06:42
You don't need Ruby

bethskurrie
2018-06-05 06:42
Use the pact-provider-verifier command in that package. It may work with your v3 pacts.

bethskurrie
2018-06-05 06:43
that docker image is WAY out of date.

bethskurrie
2018-06-05 06:43
We should look at retiring it.

bethskurrie
2018-06-05 06:44
@matt.fellows should we make a new version of the verifier in pact-foundation with the nice pact-provider-verifier code?

bethskurrie
2018-06-05 06:44
That one uses the old way that you had to cobble together when I was on mat leave.

matt.fellows
2018-06-05 08:43
I think probably modernise it, people might have it in their build pipelines as docker steps. At the very least, a notice on the repo saying that its out of date

dlucas
2018-06-05 09:32
has joined #general

bethskurrie
2018-06-05 09:42
To make it match the current pact-provider-verifier, we'd need to make breaking changes, which makes me think it would be just easier to deprecate the dius one in favour of a new one in the pact-foundation

matt.fellows
2018-06-05 10:05
good point

richard.peckett
2018-06-05 18:09
this issue is still causing me problems :disappointed:

2018-06-05 22:17
@bethskurrie commented on @richard.peckett?s file https://pact-foundation.slack.com/files/UB1CYPWKG/FB1TMTDFE/image.png: Did you get my suggestion on the issue? Make the location of the standalone configurable, so you can install it at a higher level (it would use the built in one by default). If @neil is ok with the idea, would you be interested in submitting a PR?

2018-06-06 00:11
@neil commented on @richard.peckett?s file https://pact-foundation.slack.com/files/UB1CYPWKG/FB1TMTDFE/image.png: The problem with that is most users will have this issue. I think it?s ok for the rare few, but if it?s the default advice, maybe we can come up with a better option

bethskurrie
2018-06-06 00:50
I'm surprised more people haven't complained

neil
2018-06-06 00:51
Yeah me too actually.

bethskurrie
2018-06-06 00:51
I don't know of any way to compress the file paths for the gems.

neil
2018-06-06 00:52
I?ll do a bit more investigation, and see what options we have. Path limits in windows is such a PITA!

bethskurrie
2018-06-06 00:52
Docker containers?

bethskurrie
2018-06-06 00:52
Or, same problem?

neil
2018-06-06 00:54
as in linux container running the ruby core?

bethskurrie
2018-06-06 00:56
I'm not sure.

bethskurrie
2018-06-06 00:56
Just throwing random technologies at it and seeing if anything sticks!

neil
2018-06-06 00:57
haha, nah it?s good to think of different options :smile:

neil
2018-06-06 00:57
Is anyone using the rust core? I think that would fix the issue

bethskurrie
2018-06-06 00:57
It would.

bethskurrie
2018-06-06 00:58
@uglyog can tell you. Though, I have had someone roll their eyes when discussing ffi bindings to rust on windows, so it may not be completely straightforward.

neil
2018-06-06 01:12
Yeah like a lot of things trade off one pain for another :stuck_out_tongue:

bethskurrie
2018-06-06 01:12
Sorry, realised we're not in a thread, and are spamming people.

bethskurrie
2018-06-06 01:12
Let's continue this here.

neil
2018-06-06 01:13
Oops :slightly_smiling_face:

bethskurrie
2018-06-06 01:13
If it was just the pact gems, I could try and rearrange the files inside the gems, but the error is coming up for bundler - something I don't control.

bethskurrie
2018-06-06 01:14
@richard.peckett what version of windows are you on?

neil
2018-06-06 01:17
Yeah totally understand, why you can?t change things

uglyog
2018-06-06 01:21
You should drop the ruby core, seems to be causing a lot of issues

uglyog
2018-06-06 01:23
The rust implementation is V3, you just need to work out how to interface to it

neil
2018-06-06 01:32
@uglyog Cool. Sounds like a fun experiment either way. Any docs you could point me to? Also is there any other impl using it yet?

uglyog
2018-06-06 01:32
There is a POC with the Swift implementation, but I don't know where that got to

uglyog
2018-06-06 01:38
A quick google seems that an FFI-based interface will be needed. I also found this: https://github.com/KodrAus/cargo-nuget

neil
2018-06-06 01:43
Nice. Yeah I looked into it a while back and there were a couple of FFI interfaces. The gotcha is making sure we can get .NET core compatibility, which has been quite painful in the past.


gaurav
2018-06-06 06:54
For windows 10 build 1607 onwards, a workaround on user side could be to disable max path using registry key/group policy: https://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx?f=255&MSPPError=-2147217396#maxpath

richard.peckett
2018-06-06 09:34
thanks for the replies guys @gaurav I'll give that a go in the meantime :thumbsup:

richard.peckett
2018-06-06 09:36
@bethskurrie Windows 10

kossling
2018-06-06 10:03
has joined #general

mboudreau
2018-06-06 10:08
@uglyog wait, the rust core is done?! Since when?


richard.peckett
2018-06-06 11:05
Still get the issue when I enable the long file path feature in windows 10, is there something I need to add the project file in Visual Studio to get this to work? :confused:

gaurav
2018-06-06 11:22
It does need a restart @richard.peckett as per the document. Windows typical :stuck_out_tongue_winking_eye:. Just in case you haven't done so.

richard.peckett
2018-06-06 11:22
Yeah I have done :disappointed: @gaurav

gaurav
2018-06-06 11:24
You can test whether it's actually enabled by trying to create a long path with CMD.

gaurav
2018-06-06 11:25
And it also needs at least build 1607.

richard.peckett
2018-06-06 11:30
build is on

richard.peckett
2018-06-06 11:31
when I run mkdir and enter a long file path I get the error "The filename, directory name, or volume label syntax is incorrect."

richard.peckett
2018-06-06 11:31
:neutral_face:

richard.peckett
2018-06-06 11:32
not sure what's going on

mboudreau
2018-06-06 11:54
@uglyog why didn't say so! that's massive news! I need to implement that in pact-node ASAP

matt.fellows
2018-06-06 12:39
@uglyog does this include provider side verification and the stuff we talked about? IIRC one if the primary reasons I didn't adopt it in Pact Go was that a) we had to generate the pact file (unlike how we work with Ruby) and b) the verifier interface hadn't been agreed on. Now that we have message pact, we can probably use the lessons from there

matt.fellows
2018-06-06 12:41
Don't forget we had a fully working Spike in Go, so it doesn't work! E.g. https://github.com/pact-foundation/pact-go/blob/feature/native/dsl/native/mock_server_darwin.go

james.carman
2018-06-06 15:29
Thank you, @bethskurrie

gbeckmann
2018-06-06 18:57
has joined #general

uglyog
2018-06-07 00:14
@matt.fellows there is a verifier, not no verifier language interface. That will come with the first language to interface to it. Maybe .Net is a good candidate.

matt.fellows
2018-06-07 00:48
I'm not sure what words you need from me to confirm that I've already interfaced to it and am ready :laughing:

kra
2018-06-07 06:41
has joined #general

raffi.schmid
2018-06-07 06:41
has joined #general

dervis4
2018-06-07 08:26
Hi guys, could you please guide me to information regarding what the best strategy for testing providers are? At the Norwegian LWA we test our providers against instances that are already deployed and running in Test-environments, however now I am looking into starting local instances of the providers instead. What is your recommendation?

hstene
2018-06-07 08:27
Hello again, Dervis! :slightly_smiling_face:

mboudreau
2018-06-07 08:54
Recommendation? The consumer of you data structure needs use pact to create a contract, that contract can then be shared with pact-broker to the provider (whatever gives the data), the provider, before it goes out to production, would then test to make sure it's not breaking the contract. After both are satisfied, they're not okay to deploy.

mboudreau
2018-06-07 08:54
that is the very very short version of it

hstene
2018-06-07 09:00
They are _not_ okay to deploy? Or did you mean that they _are_ okay?

dervis4
2018-06-07 09:00
We share Pact using the Pact Broker and also tag our deployed Pacts with Production. However, when Jenkins is building our Providers, it runs the Provider-test (using HttpTarget) against an already running instance in the Test-environment.

dervis4
2018-06-07 09:02
My question was more about - every build will then test against the previous version (sort of). I wanted to understand how this idea work when aiming to use the Pact-matrix.

mboudreau
2018-06-07 09:35
@hstene sorry, autocorrect. Meant to say now.



dervis4
2018-06-07 12:36
Thanks :+1:

richard.peckett
2018-06-07 17:40
Peeps, can someone explain to me how verify works? assuming I've started my provider service using something like: " var providerApi = WebHost.CreateDefaultBuilder(null) .UseStartup<Startup>() .UseUrls("http://localhost:9223") .Build(); await providerApi.StartAsync();" Does verify actual query the test server using the URI specified inside the PACT file it retrieves from the broker?

richard.jones
2018-06-07 22:58
has joined #general

matthew.ceroni
2018-06-07 23:28
has joined #general

matthew.ceroni
2018-06-07 23:32
Updated configuration of pact broker as such. But broker still isn?t ordering based on date. This shows in that newly tagged consumer versions, don?t show latest on the latest version.

bethskurrie
2018-06-07 23:33
the latest release of the pact broker has a more elegant solution to the webhooks vulnerability found recently. You will now be able to configure a whitelist to ensure webhooks can only be execute against "safe" hosts. You can read about how to configure the whitelist [here](https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/doc/views/webhooks.markdown#webhook-whitelist)

2018-06-07 23:45
@neil commented on @richard.peckett?s file https://pact-foundation.slack.com/files/UB1CYPWKG/FB2UP3AHE/-.cs: @richard.peckett There is no URI in the pact file. It uses the URI passed to the `ServiceProvider` method

biaofu
2018-06-08 02:23
has joined #general

mmonson
2018-06-08 03:03
has joined #general

peter.odonovan
2018-06-08 03:30
has joined #general

mikey
2018-06-08 03:31
has joined #general

peter.odonovan
2018-06-08 03:31
:wave:

sam.jarrett
2018-06-08 03:32
has joined #general

niek
2018-06-08 07:13
has joined #general

nic
2018-06-08 08:33
has joined #general

richard.peckett
2018-06-08 09:23
@neil cheers Neil :+1::skin-tone-2:

oliver.gramberg
2018-06-08 09:38
has joined #general

bethskurrie
2018-06-08 09:52
Welcome everyone.

mr.matt.r.long
2018-06-08 13:44
has joined #general

gonzalogarcia243
2018-06-08 14:58
has joined #general

snatarajan
2018-06-08 16:38
has joined #general

rlamb
2018-06-08 17:09
has joined #general

matt.fellows
2018-06-09 04:01
:wave:

daniel.delatorrebabi
2018-06-10 10:38
has joined #general

daniel.delatorrebabi
2018-06-10 10:46
Hello guys, I am having some issues when I try to execute gradlew pactVerify from my provider.

daniel.delatorrebabi
2018-06-10 10:48
My jetty server starts correctly but the process gets stuck when it is executing pact:pact-spring-provider:startProvider

daniel.delatorrebabi
2018-06-10 10:49
it seems that it never goes to my pactbroker server to verify the pact

daniel.delatorrebabi
2018-06-10 10:49
any idea about this?

bethskurrie
2018-06-10 11:15
Hi Daniel. Try the pact-jvm channel. I believe there is a way to switch on debug logs for the pact verify, have a look at the docs.

daniel.delatorrebabi
2018-06-10 11:22
Thanks for the answer Beth, I will do

matt
2018-06-11 01:35
has joined #general

bethskurrie
2018-06-11 11:42
Hi I've just released a new version of the Docker Pact Broker image, with environment variables to configure the new webhooks whitelist. Please remember to upgrade to the latest version ASAP if you haven't already to ensure you are not susceptible to the webhooks vulnerability that was found recently. In other news, I've added a heap of new parameters to the webhooks templates that now make it possible to send pact verification status updates to github. Check out the Webhook template library to see how this is done https://github.com/pact-foundation/pact_broker/wiki/Webhook-template-library

mr.matt.r.long
2018-06-11 13:44
Hi is anyone able to confirm if the matchers for header Content-Type values perform a full match including charset value? I'm currently seeing a validation error my my jvm provider for the header matcher `application\\/json` throwing the error `Expected 'application/json; charset=utf-8' to match 'application\\/json'`

mr.matt.r.long
2018-06-11 13:46
Sorry I see the fix for partial matching is included in 3.5.17: https://github.com/DiUS/pact-jvm/commit/f7d73250c3986c812459d9ada3677fbdd14693e3. I'm currently running 3.5.16

vinod.baradwaj
2018-06-12 09:46
Has anyone implemented Pact in their pipeline jobs? I am planning to make use of Pacts as a stub in place of the real provider to perform acceptance tests for my application.. and also as part of the pipeline i need to do the provider verification as well with the pact files to be sure that the contract is not broken. Can anyone provide me a heads up on how to start working on the flow for this pipeline ?



bethskurrie
2018-06-12 10:17
Be aware of the fact that the higher level you use your pact tests for, the more fiddly and higher maintenance they become. Pact is generally best for unit tests, not acceptance tests.


bethskurrie
2018-06-12 10:19
You can re-use the pact that you generate in unit tests to make a stub, but you may have problems with the exact matching https://github.com/pact-foundation/pact-mock_service#stub-service-usage

bethskurrie
2018-06-12 10:20
Generally, the higher level the tests, the more flexible you want your matching.

vinod.baradwaj
2018-06-12 10:25
thanks @bethskurrie for mocking stuff i wont be needing much matchers since i can control the flow of data, and can make sure that the data remains unchanged every time the tests are executed. The reason why i am planning to make use of stubs is to speed up my AT's. if i have to rely on actual provider, it takes me more than 15 mins to bring up the environment.

dominic.jones
2018-06-12 11:51
@vinod.baradwaj we?ve taken the approach you?re talking about and it seems to be working pretty well so far. You definitely have to be careful about the implicit coupling you create between different types of test. We?ve created common fixtures that we draw from to run our pact unit tests (and therefore create the pacts) and to use in our ?acceptance? tests (running against a stub server generated from pacts). That at least makes it clear that there is coupling there, though can still be a bit fiddly

dominic.jones
2018-06-12 11:56
Hello! This is a slightly lazy question, but is it a know problem that publication fails if one tries to publish the verification result for the same pact twice. I am getting a rather gnarly db error being spat out when we publish a verification from our Java provider side tests (using the Junit runner) ``` {"message":"PG::UniqueViolation: ERROR: duplicate key value violates unique constraint \"verifications_pact_version_id_number_index\"\nDETAIL: Key (pact_version_id, number)=(66, 181) already exists.\n","backtrace":["/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:166:in `async_exec'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:166:in `block in execute_query'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/database/logging.rb:49:in `log_connection_yield'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:166:in `execute_query'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:153:in `block in execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:129:in `check_disconnect_errors'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:153:in `execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:514:in `_execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:326:in `block (2 levels) in execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:536:in `check_database_errors'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:326:in `block in execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/database/connecting.rb:301:in `block in synchronize'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/connection_pool/threaded.rb:103:in `hold'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/database/connecting.rb:301:in `synchronize'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:326:in `execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/dataset/actions.rb:1081:in `execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:679:in `fetch_rows'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/dataset/actions.rb:942:in `with_sql_each'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/dataset/actions.rb:950:in `with_sql_first'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/shared/postgres.rb:1607:in `insert_select'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/model/base.rb:2165:in `_insert_select_raw'" ``` (whole error available on request)

dominic.jones
2018-06-12 12:24
ah, ignore that, I accidentally deployed the old pact-broker (pact_broker)

drhansen
2018-06-12 19:25
has joined #general

tlane
2018-06-12 20:58
has joined #general

bethskurrie
2018-06-12 21:44
I can see you've thought it through @dominic.jones. Glad it's working for you.

bethskurrie
2018-06-12 22:15
@dominic.jones is there anything we could do to make it clearer that that one is deprecated?

bethskurrie
2018-06-12 22:16
There's a message in the UI, and the readme, but obviously it's still possible to install it unintentionally.

abhilash.hanumanth
2018-06-13 01:56
I have an array of strings of variable length which is expected in response body. For example : ```"{ Conditions":[ "conditionA", "conditionB", "conditionC" ] }``` How do I use stringType() or stringMatcher() for generalizing while creating pact using LambdaDsl ? Can someone help me with the above problem ?

bethskurrie
2018-06-13 01:57
@abhilash.hanumanth can you ask in pact-jvm please? It makes it easier to find relevant answers.

bethskurrie
2018-06-13 01:58
Please indicate which documentation you have read already, and if there is something missing, let us know which section you would expect it to be in.


vinod.baradwaj
2018-06-13 04:24
@dominic.jones can you share me flow of your process so that i can understand and get an idea how the flow will be ?

dominic.jones
2018-06-13 05:42
I noticed when I loaded it up and saw the UI message, so that was good. Not sure what else you could do without breaking things for people. Maybe add something to logging? But that could be a big faff

dominic.jones
2018-06-13 05:44
@vinod.baradwaj I can try. What would work best? Maybe if I just try to describe in more detail how our process works? I?m busy just now but should have some time later today (I?m in London)

vinod.baradwaj
2018-06-13 05:59
sure, let me know once you are free :slightly_smiling_face:

dominic.jones
2018-06-13 06:13
What time zone are you :slightly_smiling_face: ?

vinod.baradwaj
2018-06-13 06:13
I am from India, IST

zwttgsmu
2018-06-13 08:02
has joined #general

zwttgsmu
2018-06-13 08:07
Hello everyone!)

bethskurrie
2018-06-13 08:09
:wave:

zwttgsmu
2018-06-13 08:10
I want to make a check that an array can contain strings or null Found solutions for Java: "It would also be required to define whether the matchers should be combined with logical AND (all matchers must match) or OR (at least one matcher must match). AND should be the default, but there are cases where an OR makes sense. { "matchingRules": { "header": { "HEADERY": { "combine": "AND", "matchers": [ {"match": "include", "value": "ValueA"}, {"match": "include", "value": "ValueB"} ] } } } }" How can I do this in .NET?

bethskurrie
2018-06-13 08:10
You can't. That functionality is, I believe, being deprecated in the next version of Pact JVM

bethskurrie
2018-06-13 08:11
Let me find the explanation.


bethskurrie
2018-06-13 08:14
Also, the functionality you're describing is in the Pact Specification version 3, and pact net is only up to version 2.

bethskurrie
2018-06-13 09:00
Hopefully someone in the pact-jvm channel can help. Unfortunately, I haven't written or used it, so I'm out of advice!

zwttgsmu
2018-06-13 10:48
Thank you) one more question)) I check for type integer, but in the logs I see an error: -"param1": Bignum +"param1": Fixnum in Google I found such a description: The problem is that FixNum is a platform-dependent type. Ruby automatically switches from FixNum to BigNum if the number becomes bigger than native integer(which has different length on 32-bit and 64-bit platforms). So if you just want to check whether it's an integer you should use Integer for it. For example: timestamp = Time.now.to_i #bad timestamp.is_a? FixNum timestamp.is_a? BigNum #good timestamp.is_a? Integer how can I test this without error?

bethskurrie
2018-06-13 11:40
Can you recreate the issue using this project, and I'll fix the problem in the underlying code https://github.com/pact-foundation/pact-ruby-standalone-e2e-example

matt
2018-06-13 18:12
i'm wondering if we should disable `@` here and `@` channel for regular users.

matt
2018-06-13 18:12
i think slack provides a configuration option to make those admin only

jsyrinek
2018-06-13 23:12
has joined #general

jsyrinek
2018-06-13 23:14
Should we test third-party API's regularly using our consumer contracts?

bethskurrie
2018-06-13 23:15
Pact is not great for testing third party APIs. It assumes you're able to set up provider states without having to use the API you're actually testing.

matt.fellows
2018-06-13 23:16
Thanks for reminding me, this is done :white_check_mark:

bethskurrie
2018-06-13 23:16
Each interaction is tested in isolation, which is fine when you can manipulate the pre-existing data, but not great if you need to set up the data using an API.

jsyrinek
2018-06-13 23:18
That makes sense, but to be clear, my question is more about ensuring that the third-party continues to provide the data our (consuming) application depends on. I'm not asking if we should hit a real API to verify our application/consumer.

jsyrinek
2018-06-13 23:19
Obviously we don't control the third-party API, but if the third-party ever stops providing the things we need, we would want to know.

bethskurrie
2018-06-13 23:19
Indeed. I'm not sure what tool I'd recommend in this situation. If I was using Ruby, I'd use something like VCR.

bethskurrie
2018-06-13 23:19
I don't know what exists in other languages.

jsyrinek
2018-06-13 23:20
I've used yakbak

jsyrinek
2018-06-13 23:20
which is the Javascript analog of VCR, but I'm not sure how to use that in this situation.

bethskurrie
2018-06-13 23:25
I'd probably have a build that ran the live tests regularly and reported if there was a change in the response.

jsyrinek
2018-06-13 23:26
That's what we're thinking as well. And we're thinking of hitting a real API (maybe with Yakback/VCR to mask over third-party outages) then validating using our consumer contract.

jsyrinek
2018-06-13 23:28
We're having a conversation at the office about when/if we should take this approach. In our case, we have a good working relationship with the third-party, so if the contract ever changes, we have a way to address that. I think if we didn't have a relationship like this, we may not take this approach. For instance, if Twitter was the third-party API, we probably can't stop them from changing what they provide. In that case, we should just build the application in a way that it can handle changes gracefully and/or setup alerts when things break so we can take swift action.

jsyrinek
2018-06-13 23:28
I think this thought process is somewhat explained in the bullet points in the FAQ, but you kind of have to piece ideas together.

jsyrinek
2018-06-13 23:29
It might be a good idea to add two recommendations for working with third-party APIs: one for providers that can/will make changes if requested, and one for providers that would not.

bethskurrie
2018-06-13 23:32
That's a good suggestion.

bethskurrie
2018-06-13 23:33
How do you feel about writing those thoughts down and doing a PR to the FAQ page?

jsyrinek
2018-06-13 23:35
I could take a stab at that

bethskurrie
2018-06-13 23:41
That would be greatly appreciated.

matt
2018-06-14 02:57
thank you :simple_smile: now i won't get randomly pinged by people

matt.fellows
2018-06-14 03:15
:slightly_smiling_face:

jonas.lergell
2018-06-14 07:12
has joined #general

oswald.quek
2018-06-14 09:51
has joined #general

dominic.jones
2018-06-14 09:52
we?ve got a bit confused about versions and tags. We version our pacts using the git sha of the consumer code used to produce it. However, as per your docs, the pacts are ordered according ?semver? of version. Obviously this then leads to arbitrary ordering of pacts in our case. If we then want to retrieve the ?latest? (chronologically speaking) pact for a given tag, we seem to be stuck. There is something in your docs about changing a config flag to change how pacts are ordered, but a) we use your docker image b) I?m not sure if this would solve our problem Any suggestions?


bethskurrie
2018-06-14 09:56
Oh, right, the docker version.

dominic.jones
2018-06-14 09:56
and do I have ?access? to that config if I?m using your docker image?

dominic.jones
2018-06-14 09:56
snap

bethskurrie
2018-06-14 09:56
You know what, I've been meaning to change the default any way.

bethskurrie
2018-06-14 09:56
Hang about.

dominic.jones
2018-06-14 09:56
it?s not configurable via env var I assume?

bethskurrie
2018-06-14 09:57
You can insert a config in the db.

bethskurrie
2018-06-14 09:57
But I'll just change it

dominic.jones
2018-06-14 09:58
wow, thanks!

bethskurrie
2018-06-14 10:13
grab 2.22.0-2 when it's built

bethskurrie
2018-06-14 10:13
you'll need to publish another completely new version after you've upgraded to trigger the reordering

dominic.jones
2018-06-14 10:15
ok, great. Thanks very much

bethskurrie
2018-06-14 10:16
np

dominic.jones
2018-06-14 12:16
it works and everything :simple_smile:

bethskurrie
2018-06-14 21:10
Like a shop bought one!

rcheeniyil
2018-06-14 22:26
has joined #general

rcheeniyil
2018-06-14 22:49
Hi there, I see the following warning on verify step: `WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body']` this happens in all tests where each_like is used for type matching array elements in pact-ruby (gem says version 2.7.6). Is this expected behavior or is there some way to use each_like that does not result in this warning?

bethskurrie
2018-06-14 22:50
I'm really sorry - you can ignore that error. It's a very tricky bit of logic to get rid of it, and I just haven't had the brainspace to fix it.

bethskurrie
2018-06-14 22:50
It's all working fine though.

rcheeniyil
2018-06-14 22:50
ya it has expected behavior the warnings are sort of piling up though

rcheeniyil
2018-06-14 22:51
```WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body']['child_events'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body']```

abe
2018-06-15 02:24
has joined #general

omar10594
2018-06-15 02:24
has joined #general

rob.lugton
2018-06-15 02:24
has joined #general

rob-manger
2018-06-15 02:24
has joined #general

rholshausen
2018-06-15 02:24
has joined #general

raul.garcia
2018-06-15 02:24
has joined #general

raghunandanjahagirdar
2018-06-15 02:24
has joined #general

prudhvi
2018-06-15 02:24
has joined #general

pivison
2018-06-15 02:24
has joined #general

phil
2018-06-15 02:24
has joined #general

pfajardo
2018-06-15 02:24
has joined #general

paul.davidson
2018-06-15 02:24
has joined #general

patrick
2018-06-15 02:24
has joined #general

ngbrown
2018-06-15 02:24
has joined #general

sai.dileepjana
2018-06-15 02:24
has joined #general

mzacharska
2018-06-15 02:24
has joined #general

mouser
2018-06-15 02:24
has joined #general

mngau
2018-06-15 02:24
has joined #general

mlk
2018-06-15 02:24
has joined #general

mhargiss
2018-06-15 02:24
has joined #general

mende
2018-06-15 02:25
has joined #general

mellis
2018-06-15 02:25
has joined #general

matthewcanty
2018-06-15 02:25
has joined #general

mattfaries
2018-06-15 02:25
has joined #general

mattcoder
2018-06-15 02:25
has joined #general

abhijeet.daspatnaik
2018-06-15 02:25
has joined #general

matt.canty
2018-06-15 02:25
has joined #general

marcevers
2018-06-15 02:25
has joined #general

rolyat.wilson
2018-06-15 02:25
has joined #general

sdulebskiy
2018-06-15 02:25
has joined #general

m.groeneweg
2018-06-15 02:25
has joined #general

timbailey
2018-06-15 02:25
has joined #general

zac.sims
2018-06-15 02:25
has joined #general

willmadison
2018-06-15 02:25
has joined #general

w.everse
2018-06-15 02:25
has joined #general

vinny
2018-06-15 02:25
has joined #general

vijaynag
2018-06-15 02:25
has joined #general

veganjenny
2018-06-15 02:25
has joined #general

v.lukoyanov
2018-06-15 02:25
has joined #general

trenthornibrook
2018-06-15 02:25
has joined #general

travi
2018-06-15 02:25
has joined #general

tom.vanasch
2018-06-15 02:25
has joined #general

tmok01
2018-06-15 02:25
has joined #general

tmcknight
2018-06-15 02:25
has joined #general

tigris
2018-06-15 02:25
has joined #general

shahzadahmad
2018-06-15 02:25
has joined #general

theresa
2018-06-15 02:25
has joined #general

thadir
2018-06-15 02:25
has joined #general

sumit080
2018-06-15 02:25
has joined #general

sudhapatil3
2018-06-15 02:25
has joined #general

stuparty
2018-06-15 02:25
has joined #general

stein
2018-06-15 02:25
has joined #general

sinclair.calleja
2018-06-15 02:25
has joined #general

siaynoqmage
2018-06-15 02:25
has joined #general

shenahas
2018-06-15 02:25
has joined #general

sheetal
2018-06-15 02:25
has joined #general

shashidesai
2018-06-15 02:25
has joined #general

sharding
2018-06-15 02:25
has joined #general

shamilton
2018-06-15 02:25
has joined #general

m.pleijte
2018-06-15 02:25
has joined #general

zerocooljs
2018-06-15 02:25
has joined #general

lukvermeulen
2018-06-15 02:25
has joined #general

eskimoquinn
2018-06-15 02:25
has joined #general

bangn
2018-06-15 02:25
has joined #general

giuseppe.landolfi575
2018-06-15 02:25
has joined #general

areddy
2018-06-15 02:25
has joined #general

aserafim
2018-06-15 02:25
has joined #general

giuseppe.landolfi
2018-06-15 02:25
has joined #general

lkingsley
2018-06-15 02:25
has joined #general

gareth
2018-06-15 02:25
has joined #general

fpelletier
2018-06-15 02:25
has joined #general

fkoner
2018-06-15 02:25
has joined #general

fitzoh
2018-06-15 02:25
has joined #general

finkingma
2018-06-15 02:25
has joined #general

fergusstrange
2018-06-15 02:25
has joined #general

ecoan
2018-06-15 02:25
has joined #general

harryw
2018-06-15 02:25
has joined #general

dniles
2018-06-15 02:25
has joined #general

divs.kanna
2018-06-15 02:25
has joined #general

d.van.dijk
2018-06-15 02:25
has joined #general

cornelia.zintl
2018-06-15 02:25
has joined #general

cormac
2018-06-15 02:25
has joined #general

coco
2018-06-15 02:25
has joined #general

claire.thomson
2018-06-15 02:25
has joined #general

cass
2018-06-15 02:25
has joined #general

asfan.siddiqui
2018-06-15 02:25
has joined #general

beth
2018-06-15 02:25
has joined #general

berisberis
2018-06-15 02:25
has joined #general

benjamin.l.tse
2018-06-15 02:25
has joined #general

gtondi
2018-06-15 02:25
has joined #general

andycampbell92
2018-06-15 02:25
has joined #general

icapurrofagian
2018-06-15 02:25
has joined #general

kanchana
2018-06-15 02:25
has joined #general

lihongmei
2018-06-15 02:25
has joined #general

liam.fisher
2018-06-15 02:25
has joined #general

acooper106
2018-06-15 02:25
has joined #general

lardcanoe
2018-06-15 02:25
has joined #general

kunwardeep
2018-06-15 02:25
has joined #general

krishnaraj.krishnan
2018-06-15 02:25
has joined #general

kong
2018-06-15 02:25
has joined #general

alexei
2018-06-15 02:25
has joined #general

king-smith
2018-06-15 02:25
has joined #general

kevinkraus
2018-06-15 02:25
has joined #general

kevin.meiresonne
2018-06-15 02:25
has joined #general

j03w
2018-06-15 02:25
has joined #general

ken.westdorp
2018-06-15 02:25
has joined #general

kale.mcnaney
2018-06-15 02:25
has joined #general

kabagchi87
2018-06-15 02:25
has joined #general

james
2018-06-15 02:25
has joined #general

jdbann
2018-06-15 02:25
has joined #general

jeanmarclai
2018-06-15 02:25
has joined #general

jeffutter
2018-06-15 02:25
has joined #general

andrew.nicholson
2018-06-15 02:25
has joined #general

jfeng
2018-06-15 02:25
has joined #general

alok.pandey
2018-06-15 02:25
has joined #general

joel_a
2018-06-15 02:25
has joined #general

jsilver
2018-06-15 02:25
has joined #general

gaurav
2018-06-15 03:42
Does anyone have some experience to share using swagger-request-validator-pact? https://bitbucket.org/atlassian/swagger-request-validator/src/master/swagger-request-validator-pact/ From the looks of it, it looks like quite simpler way of achieving CI of contract tests (in organisations using swagger).

shekharsp27
2018-06-15 05:40
Yeah, it verifies pact contract against Swagger specification and enables contract checking from Consumer side as well. It also provides capabilities to enable checks on Response missing required field,Response has the incorrect type for a field among others thought validations are lenient and can control using properties

gaurav
2018-06-15 05:43
seems like worth giving a try. :slightly_smiling_face:

shekharsp27
2018-06-15 05:52
:+1:

bethskurrie
2018-06-15 06:17
I'll try and get back to it soon.

vk.regs
2018-06-15 08:02
has joined #general

gxsham
2018-06-15 12:03
has joined #general

adamgreen
2018-06-15 13:54
has joined #general

santoshtrip
2018-06-15 17:55
This was something great

santoshtrip
2018-06-15 17:55
@shekharsp27 thanks for sharing this earlier with me

minhdoan
2018-06-16 08:53
Hi team,

minhdoan
2018-06-16 08:54
I face an stuck described in the ticket https://github.com/DiUS/pact-jvm/issues/704

minhdoan
2018-06-16 08:54
Any help is highly appreciated!

minhdoan
2018-06-16 08:54
Many thanks

dsbenghe
2018-06-17 16:26
has joined #general

jonas.lergell
2018-06-18 09:25
Hey, im using the pact broker docker image, getting response code 405 when posting to /webhooks, but /webhooks/provider.... works, does the docker image currently not support creating global webhooks?

bethskurrie
2018-06-18 10:33
Nope. I haven't released that yet.

bethskurrie
2018-06-18 10:34
It's on master, but I have to finish off bit more before it can be released. Try again tomorrow.

bethskurrie
2018-06-18 10:34
The gem itself hasn't been released.

bethskurrie
2018-06-18 11:37
@jonas.lergell I've just released a version of the docker image tagged `edge` with the latest code from the repo (not a released gem). There's a known bug if you try and execute a test request (by POSTing to `/webhooks/UUID/execute`) for global webhooks, or ones that have just a consumer or provider, but they execute correctly during normal operation.

jonas.lergell
2018-06-18 11:47
Awesome! Thx

mats.lundkvist
2018-06-18 11:50
has joined #general

mats.lundkvist
2018-06-18 11:56
Hi, I'm using pact ruby standalone and pact-go to write consumer tests in golang but it looks like the generated json file is wrong ```"metadata": { "pactSpecification": { // this is should be pact-specification right? "version": "3.0.0" } }``` Is this an issue or am I just using it wrong?

bethskurrie
2018-06-18 11:56
Version 3 is not yet supported

bethskurrie
2018-06-18 11:57
Oh, the format of the JSON

bethskurrie
2018-06-18 11:57
No, it's the right format. @uglyog needs to update the jvm impl.

mats.lundkvist
2018-06-18 11:58
ok, so the jvm impl will get an update?

bethskurrie
2018-06-18 11:59
It was supposed to a year ago :-P

mats.lundkvist
2018-06-18 11:59
haha okey, I'll inform the people I work with, thanks for the help :smile:

bethskurrie
2018-06-18 11:59
We ended up with about 3 different formats, and I just made the ruby code read it from all three!

bethskurrie
2018-06-18 12:00
It's an embarrassing shemozle.

matt.fellows
2018-06-18 12:22
Out of interest, which bits are you using pact ruby standalone for?

mats.lundkvist
2018-06-18 12:28
what do you mean?

matt.fellows
2018-06-18 13:07
OH, have you just installed them on the command line as per the instructions? I for some reason had the impression you were explicitly using some of the tools (e.g. manually running provider tests or something)

matt.fellows
2018-06-18 13:07
all good if you?ve just added them to the path :thumbsup:

mats.lundkvist
2018-06-18 13:07
okey good :slightly_smiling_face:

adrian.flucus
2018-06-18 14:45
has joined #general

uglyog
2018-06-18 23:51
Sigh, just checked the JVM code, and I didn't fix it as well as I thought :pensive:

bethskurrie
2018-06-18 23:53
I had the thought last night, I could always fix it in the broker. But that wouldn't help pacts exchanged outside the broker.

uglyog
2018-06-18 23:54
I'm going to change it now, but I have a suspicion that the code will just change itself back

bethskurrie
2018-06-18 23:55
It's obviously got gremlins in it.

vk.regs
2018-06-19 07:00
Hi, A am trying to verify request with null field values on consumer pact tests, but pact Framework return error for such field. How can I process such cases? "description": "A request to get export data", "request": { "method": "patch", "path": "/api/export/data", "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "CState": { "ConceptId": 0, }, "FileName": null } }

2018-06-19 07:05
@bethskurrie commented on @vk.regs?s file https://pact-foundation.slack.com/files/UB9203GES/FB978Q4QY/image.png: @vk.regs which language? Asking im the right channel for your language will help you get a helpful answer.

vk.regs
2018-06-19 07:07
@bethskurrie thanks, It is .net, sorry

matt.fellows
2018-06-19 07:12
np

james.carman
2018-06-19 21:28
When I verify my pact, it prints out the ?returns a response which? part twice. I only specify 1 request

james.carman
2018-06-19 21:32
Would a github link help?


james.carman
2018-06-19 21:38
I am creating a demo ?org? for doing this pact testing.



uglyog
2018-06-19 23:24
Could you raise an issue at the github site for that?

uglyog
2018-06-19 23:48
Oh, there is already an issue raised: https://github.com/DiUS/pact-jvm/issues/706

james.carman
2018-06-20 01:10
It doesn?t really bother me, per se. I was more worried I was doing something wrong. Thanks for the heads-up.

james.carman
2018-06-20 01:30
I?m going to submit a patch for it.

uglyog
2018-06-20 01:35
already fixed it :smile:

james.carman
2018-06-20 01:36
dang it! I wanted to contribute and this one was easy

james.carman
2018-06-20 01:36
oh well

james.carman
2018-06-20 01:37
I would have been done faster, but the wifi here at starbucks is slow and downloading Gradle was taking forever.

james.carman
2018-06-20 01:38
I changed it to: for(i in 0 until runTimes)

james.carman
2018-06-20 01:38
what did you do @uglyog?


james.carman
2018-06-20 01:40
that?d work too

djrimokbp
2018-06-20 07:54
has joined #general

santoshtrip
2018-06-21 01:03
I was trying to convert the project to gradle

santoshtrip
2018-06-21 01:03
But facing some challenges consumer.consumer.SwaggerValidatorPactConsumerTest > testGetOrderWithInvalidResponse FAILED java.lang.NoSuchMethodError: au.com.dius.pact.model.MockProviderConfig.createDefault(Lau/com/dius/pact/model/PactSpecVersion;)Lau/com/dius/pact/model/MockProviderConfig; at au.com.dius.pact.consumer.PactProviderRule.<init>(PactProviderRule.java:51) at au.com.dius.pact.consumer.PactProviderRule.<init>(PactProviderRule.java:110) at com.atlassian.oai.validator.pact.ValidatedPactProviderRule.<init>(ValidatedPactProviderRule.java:33) at consumer.consumer.SwaggerValidatorPactConsumerTest.<init>(SwaggerValidatorPactConsumerTest.java:42) consumer.consumer.SwaggerValidatorPactConsumerTest > testGetOrderWithAdditionalPropertiesInResponse FAILED java.lang.NoSuchMethodError: au.com.dius.pact.model.MockProviderConfig.createDefault(Lau/com/dius/pact/model/PactSpecVersion;)Lau/com/dius/pact/model/MockProviderConfig; at au.com.dius.pact.consumer.PactProviderRule.<init>(PactProviderRule.java:51) at au.com.dius.pact.consumer.PactProviderRule.<init>(PactProviderRule.java:110) at com.atlassian.oai.validator.pact.ValidatedPactProviderRule.<init>(ValidatedPactProviderRule.java:33) at consumer.consumer.SwaggerValidatorPactConsumerTest.<init>(SwaggerValidatorPactConsumerTest.java:42)

santoshtrip
2018-06-21 01:04
at @Rule public ValidatedPactProviderRule provider = new ValidatedPactProviderRule(SWAGGER_JSON_URL, null, PROVIDER_ID, this);

santoshtrip
2018-06-21 01:04
for the consumer tests

santoshtrip
2018-06-21 01:05
@shekharsp27 do you know what could be the potential issue

shekharsp27
2018-06-21 05:51
@santoshtrip Please check your pact version as mentioned in this issue https://github.com/DiUS/pact-jvm/issues/456

shekharsp27
2018-06-21 13:24
Hi, In case there is no change in pact content, is there a automated way to trigger can-i-deploy utility from consumer side or does the consumer team has to trigger the job manually

matt.fellows
2018-06-21 13:31
what are you trying to do?

james.carman
2018-06-21 14:14
I gave a talk about PactBroker at our local Cincinnati Java User Group yesterday and folks seemed really interested. Thanks for all your help while I prepared for the talk, guys (and gals)!

james.carman
2018-06-21 14:15
@matt.fellows are you the same ?Matt? that answers the emails about the hosted PactBroker?

matt.fellows
2018-06-21 21:13
That's awesome! (And yes)

shekharsp27
2018-06-22 05:49
Hi Matt, Thanks for your reply. As mentioned in wiki https://github.com/pact-foundation/pact_broker/wiki/Webhooks#example-cicd-and-webhook-configuration. If the changes in consumer side does not affect the contract( pact content has not changed), so its in pre verified state; in this case how I'll trigger can-i-deploy utility automatically in consumer pip-line or in this case consumer has to trigger this check manually

matt.fellows
2018-06-22 09:23
You might need to give us more context and what you?re trying to do, though. If a new consumer contract is being published, presumably the consumer is the one publishing it, so why do you need something to trigger the `can-i-deploy` utility? It should just be a step in the consumer pipeline. If nothing has changed from a contract point of view, `can-i-deploy` will return true

madhukar.mishra
2018-06-22 09:37
has joined #general

wchuang
2018-06-22 16:30
has joined #general

james.carman
2018-06-22 16:51
@matt.fellows I might want to set up a PB account for my personal email also. Is that something I need to fill out another form for?

0xorial
2018-06-23 11:23
has joined #general

0xorial
2018-06-23 11:36
Hi! I am here following up this: https://github.com/pact-foundation/pact-specification/issues/59#issuecomment-399667103 . From what I understood, pact is going to use shared ruby core approach, which is not something I like - it is slow and difficult to debug (especially since I use debugging as a learning tool). I would prefer to have a clear specifications and implementations for different platforms (v2 specs seems to require only around 1 week of work to implement). Hence I started my own port (https://github.com/0xorial/PactNetCore). Perhaps there is something else I should know?

bethskurrie
2018-06-23 11:37
Hi ironic. The wrapped ruby implementation is going to be replaced by a shared Rust implementation, which will be called via FFI. This means there will only be ONE implementation for all the "business logic" of pact, which can be easily shared to all the other languages.

bethskurrie
2018-06-23 11:38
If you want to contribute to this effort, learning about the Rust implementation and how to make FFI calls would be the best use of your time.

bethskurrie
2018-06-23 11:39
@neil who is the current .net maintainer would be the person to talk to about this, as well as @uglyog who has written the rust implementation.

bethskurrie
2018-06-23 11:39
I know how much work goes into creating a pact implementation, and I do not recommend starting from scratch!

0xorial
2018-06-23 11:40
hm....

bethskurrie
2018-06-23 11:40
We are always keen to have people who want to contribute on the team however!

0xorial
2018-06-23 11:41
I am still quite optimistic about making a new implementation. The one I have now seems to cover a lot of cases already. mostly it doesn't work on some annoying cases like null/empty matching

bethskurrie
2018-06-23 11:41
Which pact-specification version are you targeting?


bethskurrie
2018-06-23 11:42
v2 is quite simple. v3 is where it gets hard. it's why I've only done v2 in the ruby impl :stuck_out_tongue:

0xorial
2018-06-23 11:42
well, the goal is get to v3 - we started the whole thing because we needed to test messages

bethskurrie
2018-06-23 11:42
I've been too busy to pick up the v3 stuff.

0xorial
2018-06-23 11:42
xD damn

bethskurrie
2018-06-23 11:43
message support in .net should be quite simple with the ruby impl

bethskurrie
2018-06-23 11:43
we've already wrapped it in the go and js

0xorial
2018-06-23 11:43
I will think about it... I still dont feel well about including binaries into packages...

bethskurrie
2018-06-23 11:43
unfortunately our .net maintainer has been busy moving state, so he hasn't had a chance to pick it up

bethskurrie
2018-06-23 11:43
none of us like the solution!

bethskurrie
2018-06-23 11:44
but it's been a pragmatic solution to the problem of trying to support so many different languages.

bethskurrie
2018-06-23 11:44
it's quite unusual for a library to have to do that.

0xorial
2018-06-23 11:44
let me have a closer look at v3...

bethskurrie
2018-06-23 11:44
it's a dirty hack, but it's got us a long way. hopefully it can be retired soon.

bethskurrie
2018-06-23 11:45
if message pact is what you're really after, I can explain how to wrap that.

bethskurrie
2018-06-23 11:45
it shouldn't be a big amount of work.

0xorial
2018-06-23 11:46
wait, are you talking about wrapping specifically ruby in the package? because for me it is wrapping binaries in general, be it ruby, rust or js

0xorial
2018-06-23 11:47
well, if we can go with your 'recommended' solution and get it to support messaging, my managers/architects will definitely be happy :slightly_smiling_face:

bethskurrie
2018-06-23 11:47
It has it's problems, but they are fewer than trying to keep 7+ implementations of pact in sync. It's hard enough keeping the java and ruby one compatible.

0xorial
2018-06-23 11:48
hm, isn't it because you don't have a strict spec ?

bethskurrie
2018-06-23 11:48
The spec is not all there is to it.

bethskurrie
2018-06-23 11:49
There is a lot of behaviour in the mock service and the writing of the pacts and the verifications that is not pact of the matching spec.

bethskurrie
2018-06-23 11:49
Matching is the easiest part to enforce.

bethskurrie
2018-06-23 11:50
Yes, we could go through and nut out documentation for every part of pact, but we'd prefer to share the code.

0xorial
2018-06-23 11:51
I see :slightly_smiling_face: well, if you say it should be easy to add messages support to .net wrapper, this sounds like best way to go..

0xorial
2018-06-23 11:52
So far we tried this port (https://github.com/Mattersight/pact-net-messages/) separately for messages but there is no matching at all in it...


0xorial
2018-06-23 11:53
> About time, hey? yes! :grinning:

bethskurrie
2018-06-23 11:54
@matt.fellows is the person who has done the js message impl

bethskurrie
2018-06-23 11:54
If you're comfortable reading javascript, looking at that implementation may help you

0xorial
2018-06-23 11:58
great! I will give a try on Monday :slightly_smiling_face: thanks for all the information!

bethskurrie
2018-06-23 11:58
No worries.

borkke
2018-06-23 13:13
has joined #general

santoshtrip
2018-06-23 22:50
Can someone help me explain the benefits of doing pact validation using swagger request validator vs pact verification by replaying the interaction against a live instance (full blown application)

santoshtrip
2018-06-23 22:50
Trying to weigh both of them

matt.fellows
2018-06-23 23:12
Yes please

matt.fellows
2018-06-23 23:15
@0xorial the reason for using a shared component is so that we can continually push out new features and changes quickly across all implementations.we used Ruby for a number of reasons and has been a good choice IMO. Writing it from scratch will likely take you more than 1 week, and as soon as you need to implement v3 and v4 it gets harder.

matt.fellows
2018-06-23 23:16
We understand Ruby isn't ideal, and that is why we invested in building a proper shared library in Rust


matt.fellows
2018-06-23 23:18
This is the future core engine for all official implementations. If you have the time, we'd love to see you spend it getting that in the current pact net impl rather than create another

matt.fellows
2018-06-23 23:20
Bah, didn't see this thread until I answered similarly in general.

matt.fellows
2018-06-23 23:22
Anywho, adding Rust to .net is not like adding a binary, it's a shared library which is totally different. It would be like importong C Git if you needed to link to that. Trust me, writing this yourself is non trivial. Ron, who has done it several times already and has been involved with pact for years, took a long while to get it into Rust with all of the versions supported

matt.fellows
2018-06-23 23:23
As for pact message and here and now, you could definitely get that working in a couple of days with the current wrapper. I'd be happy to have a Hangouts to describe how it currently works


neil
2018-06-24 10:00
Sorry just saw this. Yeah more than happy to help with getting more support, however as Beth said my free time is very limited at the moment. Ideally we want to move to using the Rust impl, but that is going to take a bit of discovery. The ruby integration at the moment is a stepping stone (hopefully) to something a bit easier to support, debug and maintain

neil
2018-06-24 10:01
We (Pact-Net) originally had a native implementation of the v1 spec, however as we started adding more features it became a real burden to try keep up. That?s why we though moving to a shared core would make sense.

santoshtrip
2018-06-24 19:48
Can we consider contract testing as a replacement for integration testing ?

santoshtrip
2018-06-24 19:49
Whats the advantage of having both rather than one over the other

matt.fellows
2018-06-24 21:56
@santoshtrip to some extent yes you might consider it as replacement for end to end integrated tests, however there are good reasons to have integrated tests in certain circumstances and the answer is "it depends". Things you might consider alongside contract tests are blue green deploys, Canary releases, small batch sizes, continuous delivery, understand as code etc

matt.fellows
2018-06-24 21:56
They all push and pull on the overall test strategy.

matt.fellows
2018-06-24 22:03
One appropriate strategy and my general recommendation is to do the bulk of your integrated test using tools like pact and then supplement your release process with a very small subset of end to end integrated tests - potentially in your blue green env - and that gives you confidence that everything is wired together correctly (i.e. tests your config)

david.j.smith
2018-06-25 09:08
@matt.fellows Do we have a best practice for handling Origin headers in Pact JS? The browser adds the Origin header automatically to an XHR request, so they aren't part of the explicit contract from the consumers perspective. Thoughts?

mboudreau
2018-06-25 09:21
Unless your contract cars about it, don't add it

david.j.smith
2018-06-25 09:28
Well the contract from the consumer side doesn't, and the origin is never explicitly added because it's done by the browser automagically ...but the server requires it. Hence, the origin header will always be sent, but there is no JS code that actually adds the header.

david.j.smith
2018-06-25 09:29
We could add the header explicitly, but that's not technically correct. If you see what I mean.

david.j.smith
2018-06-25 09:29
It's an edge case, but I thought our JS folks must have come across this :slightly_smiling_face:

mboudreau
2018-06-25 09:41
Most people don't care about origin on the backend since it can get spoofed, and no logic should really depend on it

shekharsp27
2018-06-25 10:06
Currently I am trying to incorporate CDC tests in CI pipeline. I have taken following approach 1) I have 4 containers i) Creates pact by executing unit tests & publish pacts to pact-broker ii) Provider application container to run provider application iii) Verify container to verify contract iv) can_i_deploy container to check published results are fine 2) I have created CDC and published those to pact broker, have created webhooks to trigger provider application & verify step (I am checking the application is up and running before executing this step) if there is a content change in pact (by using 'contract_content_changed' for both the steps) and one for when results are published (can_i_deploy) container (by using 'provider_verification_published') 3) This mechanism works well if there is a change in pact content, as webhooks does the job for me 4) However in case there is no change in pact content. I am trying to find-out way, how I can get information that, webhooks from pact broker are not triggered and have to trigger can_i_deploy container by skipping other steps. Please correct me if I am missing something

bethskurrie
2018-06-25 11:18
I would put it in Dave, if it affects behaviour.

bethskurrie
2018-06-25 11:19
If the server requires it.

matt.fellows
2018-06-25 11:35
I would lean towards adding it if you actually have logic on your server side for CORS headers, and not otherwise. In most places as Michel notes it's not really important

matt.fellows
2018-06-25 11:36
It's a good point tho, I think it's not documented anywhere but a related issue on GH

matt.fellows
2018-06-25 11:45
We'll, the whole point of triggering on contract changed means that it only triggers if it changes. You can use that information to your advantage.

matt.fellows
2018-06-25 11:47
My advice is to have one pipeline for your consumer and another for your provider. Each pipeline is simple: build, run tests, publish pacts, can-i-deploy, deploy.

matt.fellows
2018-06-25 11:47
The can-i-deploy step in each pipeline will take care of itself. No need to trigger builds from webhooks.

matt.fellows
2018-06-25 11:48
If a build goes red, it means something went into the mainline before it was added to the provider, or it broke a consumer. Simple

david.j.smith
2018-06-25 12:36
Thanks all :thumbsup:

cfmack
2018-06-25 21:24
Playing with Pact Broker, I think one cannot use both a tag and a consumer version. Can anyone confirm this is true?

matt.fellows
2018-06-25 21:48
What do you mean, Charles?

matt.fellows
2018-06-25 21:49
They are both first class citizens in the broker and they can (and should) definitely be used together. The can-i-deploy tool relies on these to help you make a decision on which bits are deployable at any point in time

santoshtrip
2018-06-26 01:22
Sharing my question again

bethskurrie
2018-06-26 05:14
Hey Charles. A tag belongs to a pacticipant version.

bethskurrie
2018-06-26 05:14
Let me find the docs.


bethskurrie
2018-06-26 05:17
There's also a great doc on versioning in the broker on http://docs.pact.io

shekharsp27
2018-06-26 06:09
@matt.fellows Thank you!!

shilkumarjadhav
2018-06-26 14:54
has joined #general

cfmack
2018-06-26 19:12
That is what I thought. I do not think we can answer the question that is asked on https://github.com/pact-foundation/pact-php/issues/76#issue-328007239 I think this works: GET /pacts/provider/PROVIDER/consumer/CONSUMER/latest/TAG That GET would retrieve the latest version of this consumer-provider pair with the latest version of the consumer that has this tag. My question is a GET like: GET /pacts/provider/PROVIDER/consumer/CONSUMER/version/VERSION/TAG Get me a particular version of this consumer with this tag and this provider. I cannot see the use case where this would apply, as if you know the version of the CONSUMER, what does the tag matter? Perhaps there is some odd use case like a policy verification step that says all pacts must be tagged a certain way ... super weird use case. To revisit the question: GET /pacts/provider/PROVIDER/consumer/CONSUMER/version/VERSION/TAG This does not make sense to be use together based on my understanding of TAGS. Is that correct?

cfmack
2018-06-26 19:44
Thanks, Matt. My question was poorly worded and missing context. It was one of those times where I had been thinking about it for quiet a while in a particular github issue and that did not translate to my Slack question. There's a thread about it with more background.

matt.fellows
2018-06-26 21:29
:slightly_smiling_face:

matt.fellows
2018-06-26 21:31
If your team uses swagger as its format and potentially publishes it to 3rd parties outside of your company (e.g. who won?t use Pact) then it?s a really nice way to guarantee the contract is valid

matt.fellows
2018-06-26 21:32
in addition to that, lots of companies seem to use Swagger internally to document/communicate things, create tooling/stubs, so doing both gives you the benefits of both pact and swagger

spai
2018-06-27 09:26
has joined #general

kuo-tai.hwang
2018-06-27 20:45
has joined #general

bethskurrie
2018-06-27 21:46
Yes @cfmack. You either retrieve a pact by consumer version number, or by latest tag. Not both.

kristine.jetzke
2018-06-27 22:08
has joined #general

kristine.jetzke
2018-06-27 22:21
Hi @mr.matt.r.long I have a question regarding the `can-i-deploy` command. I have a consumer foo in version 1 and two providers bar and baz. The provider bar has two versions, a and b. Both are tagged with the tag `prod`. Version b is the lastest one. Only version a has a successful verification with the consumer. The other provider has one version tagged with prod and it successfully verified the consumer version 1. If I now run ```can-i-deploy -a foo -e 1 --to prod``` I would expect the command to fail because version 1 was not successfully verified against version b of the provider bar (the latest prod). But what happens instead is that the command succeeds and displays only one line in the result, for the other provider, baz. I assume this happens because the matrix contains no row for consumer version 1 and latest provider tag prod. Is that the expected behavior or is it a bug?

bethskurrie
2018-06-27 22:24
Hi @kristine.jetzke. I can help you with this. I need to draw up a diagram to understand it properly though.

kristine.jetzke
2018-06-27 22:25
thanks!

kristine.jetzke
2018-06-27 22:25
I can try to send sreenshots, I need to change names though

kristine.jetzke
2018-06-27 22:28
I'm still using pact broker 2.17.1

bethskurrie
2018-06-27 22:28
I'm just recreating your scenario as a test and seeing what I get. Give me a few minutes.

bethskurrie
2018-06-27 22:32
Did the verification for bar version b fail, or does it not exist?

kristine.jetzke
2018-06-27 22:33
it does not exist

bethskurrie
2018-06-27 22:34
How does it have a version that is tagged with prod in the broker then?

bethskurrie
2018-06-27 22:34
provider versions only get created when a verification is published.

bethskurrie
2018-06-27 22:34
Is there another consumer involved?

kristine.jetzke
2018-06-27 22:38
it's a strange setup. maybe that's the problem. the provider has an old version 0.0.0 (i will use the real ones now, otherwise I get confused.). This was tagged with prod at some point. during our regular provider build job we add new provider versions and tag them with prod once they are deployed to prod. The current prod version is 95.0. We now added a new contract for the consumer and it was verified again against version 0.0.0. 0.0.0 is still tagged with prod, but it's no longer the latest (because 95.0 is the latest)

bethskurrie
2018-06-27 22:38
I think you're using an old version of pact jvm.

bethskurrie
2018-06-27 22:39
You shouldn't have verifications for 0.0.0.

bethskurrie
2018-06-27 22:40
Also, you may have semantic version ordering turned on. Change this to date ordering https://github.com/pact-foundation/pact_broker/wiki/Configuration#ordering-versions-by-date

kristine.jetzke
2018-06-27 22:40
But even if I upgrade now, i still have them in the broker?

bethskurrie
2018-06-27 22:40
Yes, we still have to work out the data issue.

kristine.jetzke
2018-06-27 22:40
I'm already using date ordering

bethskurrie
2018-06-27 22:40
Cool.

kristine.jetzke
2018-06-27 22:42
i'm using 3.5.17 i can try upgrading to 3.5.18

bethskurrie
2018-06-27 22:43
That's a side issue

bethskurrie
2018-06-27 22:43
``` CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? ---------|-----------|----------|-----------|--------- foo | 1 | baz | z | false ```

bethskurrie
2018-06-27 22:43
Is that what you get?

bethskurrie
2018-06-27 22:44
No, it isn't.

kristine.jetzke
2018-06-27 22:44
if i only have one provider, the check fails because it cannot find any pacts

kristine.jetzke
2018-06-27 22:44
but if there is another provider that passes, everything passes

bethskurrie
2018-06-27 22:45
I need to be able to recreate the issue, and I don't think I have yet.

kristine.jetzke
2018-06-27 22:47
i can try setting up some data and a script with the pact commands

kristine.jetzke
2018-06-27 22:47
and file a bug in github, i just wanted to know first if this is expected behavior before doing all that

bethskurrie
2018-06-27 22:48
I'm not sure if your data is just dodgy, or if there is a problem.

kristine.jetzke
2018-06-27 22:48
me neither...

bethskurrie
2018-06-27 22:48
> and it was verified again against version 0.0.0. You definitely need to get rid of these.

bethskurrie
2018-06-27 22:48
These are in there because you're verifying from your local dev machines.

kristine.jetzke
2018-06-27 22:48
ok i can delete the tag and try to recreate the issue.

kristine.jetzke
2018-06-27 22:48
yes

kristine.jetzke
2018-06-27 22:48
and no

kristine.jetzke
2018-06-27 22:48
also because the provider didn't set any version

bethskurrie
2018-06-27 22:48
You should only be verifying from CI. The latest version of pact jvm requires that you explictly turn on verification publishing.

kristine.jetzke
2018-06-27 22:49
in their build job

kristine.jetzke
2018-06-27 22:49
yes i just saw

kristine.jetzke
2018-06-27 22:49
i will change it as well

bethskurrie
2018-06-27 22:49
So you can ensure you're only publishing verifications from "clean" code on your CI.

bethskurrie
2018-06-27 22:49
Yes, delete the prod tag on 0.0.0.

bethskurrie
2018-06-27 22:49
In fact, see if you can delete the version entirely.

kristine.jetzke
2018-06-27 22:50
Ok, I will do it and try to recreate the issue without it. Tomorrow though because it's after midnight where I live. Thanks for your help :slightly_smiling_face:

bethskurrie
2018-06-27 22:51
No worries. I may not be able to help tomorrow, but if you decide it's a bug, raise an issue in the pact_broker project, with all the information needed to recreate the issue, and I'll have a look at it when I can.

bethskurrie
2018-06-27 22:51
Unfortunately, I'm the only person who knows this code.

kristine.jetzke
2018-06-27 22:52
oh no :disappointed:

santoshtrip
2018-06-28 01:40
@Beth do you know if we have a way to publish verification to the pact broker

santoshtrip
2018-06-28 01:40
As in Java command


santoshtrip
2018-06-28 01:41
Mostly from junit classes

matt.fellows
2018-06-28 01:41
JVM has this capability, have you looked at the JVM docs?

santoshtrip
2018-06-28 01:42
Nope

matt.fellows
2018-06-28 01:43
cool, please do and then let us know if you still have questions

kristine.jetzke
2018-06-28 07:50
Hi again, I can't delete the complete version. I get a foreign key violation because there are still verification results. I did delete the prod tag though but it didn't change anything. What is the best way to create an example? Is there a public pact broker somewhere where I can publish the results?

bethskurrie
2018-06-28 07:51
Ah, my bad with the FK.

bethskurrie
2018-06-28 07:51
I may have fixed that in the latest version.

bethskurrie
2018-06-28 07:51
Yes, there is a public broker, I'll get you the creds

bethskurrie
2018-06-28 07:52
Broker user: dXfltyFMgNOFZAxr8io9wJ37iUpY42M Broker password: O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1


kristine.jetzke
2018-06-28 07:52
I just upgraded the pact broker to 2.23.3

kristine.jetzke
2018-06-28 07:52
thanks

bethskurrie
2018-06-28 07:52
I'll raise an issue for deleting provider versions

kristine.jetzke
2018-06-28 08:00
thanks

kristine.jetzke
2018-06-28 13:07
I have created an example to reproduce the issue. The code is here https://github.com/tinexw/pact-broker-example. The matrix is here: https://test.pact.dius.com.au/matrix/provider/de.tine.bar/consumer/de.tine.foo and here: https://test.pact.dius.com.au/matrix/provider/de.tine.baz/consumer/de.tine.foo The output from the last can-i-deploy command is: ``` bin/pact-broker can-i-deploy -a de.tine.foo -e 3.0.0 --to prod Computer says yes \o/ CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? ------------|-----------|-------------|-----------|--------- de.tine.foo | 3.0.0 | de.tine.baz | 20.0.0 | true All verification results are published and successful ``` In the matrix the last version of de.tine.foo is 3.0.0 which was not verified against the latest prod version of de.tine.bar. I think the cause is that I published a new prod version with an already existing version which I probably shouldn't. But I still think that the can-i-deploy command should fail in this case. Maybe someone deploys an older version to prod because they need to do a rollback or they simply misconfigured something.

kristine.jetzke
2018-06-28 13:09
@bethskurrie This is the screenshot from the broker

daniel.kirmse
2018-06-28 16:46
has joined #general

daniel.kirmse
2018-06-28 16:50
Hi, don't where to put this. Can someone tell me a best practice to check multiple consumers against the same contract? Obviously I do have a provider that has to fulfill the contract and I do have several client implementations to comply to the same contract to. I'm done with the first client and got my pact file. How would I use this pact file to develop the other clients (different languages) against this w/o duplicating the interactions for them? Is pact supposed to be used in such a way anyway? Thanks

ssn899
2018-06-28 17:53
has joined #general

matt.fellows
2018-06-28 20:43
@daniel.kirmse each client has its own contract with the provider. It's possible for the clients to evolve over time differently such that they have different needs. Importantly, there are key periods in the application lifecycle where you'll want to make changes to one of them, which is where pact willl help you thru

mboudreau
2018-06-28 22:55
@daniel.kirmse to further matt's point, if you have 2 consumers with the same contract, there's no reason not to use the same code to create the contract between the two consumers :)

bethskurrie
2018-06-29 00:30
@daniel.kirmse here is a FAQ on why you don't use an already generated pact file for another consumer https://docs.pact.io/faq#can-i-generate-my-pact-file-from-something-like-swagger

daniel.kirmse
2018-06-29 06:54
Thanks! I was suspecting this :slightly_smiling_face: I?m fine with this and would support the argument for different contracts too. The code reuse is not possible as the clients are basically a client lib for a remote server (think of proxy pattern) and they are written in python and go and have to have the very same behavior for otherwise I would have introduced an inconsistency. On the other hand having two contracts would enable me to catch up major server changes (new API version) for one client after the other with the ?old? contract still in place for the one client that has to wait (? or never will catch up for it doesn?t need the new API capabilities). Okay, fine, thanks!

davidmichaelkarr
2018-06-29 23:47
has joined #general

davidmichaelkarr
2018-06-30 00:23
I'm pretty new to pacts, but I understand the basic concepts. I see that our organization is using version 3.3.9 of pact-jvm, which is over a year old. Is anyone aware of the version history well enough to say whether there are some particular strong arguments for upgrading to a more recent release?

bethskurrie
2018-06-30 02:36
Yes. The verification publishing has been changed to be off by default, so that verification results are not accidentally published from a dev machine.

bethskurrie
2018-06-30 02:37
This is an important upgrade if you wish to use the pact verification statuses for determining when it is safe to deploy the consumer.


uglyog
2018-06-30 02:39
3.3.9 only supports V2 spec pacts, 3.5.x is full V3

uglyog
2018-06-30 02:40
3.5.x also has JUnit 5, Spring and Java 8 support

davidmichaelkarr
2018-06-30 13:57
can you tell me some important good diffs between v2 and v3 specs?

davidmichaelkarr
2018-06-30 13:59
what does not having java 8 support in 3.3.9 mean exactly? I assume that refers to java 8 features in the pact expression. can you give an example?


slack1409
2018-07-01 08:46
has joined #general

slack1409
2018-07-01 08:53
I saw, that you did merge a Pull Request today https://github.com/DiUS/pact-jvm/pull/721 which I am quite interested in. When do you plan on releasing versoin 3.5.19 which will probably contain the code in this Pull Request? Thx

uglyog
2018-07-01 08:54
Just kicked off the release script. 3.5.19 should be available in maven central in a few hours.

slack1409
2018-07-01 08:55
Great. Thx a lot :slightly_smiling_face:

deshdeepdivakar
2018-07-01 09:35
has joined #general


matthew
2018-07-02 06:07
Need some guidance: I've got an API in Rails that our front end runs pacts against. That API also makes calls out to other APIs that are currently tested with VCR. Any best practices here? The problem we seem to be running into is having the APIs that the API hits be stubbed out when Pact verifies.

can
2018-07-02 09:28
has joined #general


matt.fellows
2018-07-02 10:08
FWIW I usually stub out deps during verify. I find it easier. What's the specific issue you're having?

cve-anton
2018-07-02 10:41
has joined #general

cve-anton
2018-07-02 10:43
Hello guys, I'm going to install (on AWS) Pact for the first time, could you please tell me what platform should I choose?

cfmack
2018-07-02 12:59
I use the docker container provided by Pact Foundation, PostGres PAAS, and EKS

gradzio
2018-07-02 20:53
has joined #general

gradzio
2018-07-02 20:55
hey guys, i am working with pact and i managed to upload my pact file to pact broker (http://pact.dius.com.au) but after that I am not able to upload a new file again. No matter what i get 401 - anyone can help please?

matt.fellows
2018-07-02 21:32
Hi @gradzio there are separate read and write users. Perhaps you're using the read only user account? How did the first contract get in?

elliot.chen7
2018-07-02 21:36
has joined #general

elliot.chen7
2018-07-02 21:56
Hi, I?ve been doing research and I?m struggling to decide how pact fits with grpc calls? I?m using Go in a very new micro service environment. I?m trying to find best practices for integration and/or contract testing. I really like Pacts approach to provider states and was wondering if it was good enough reason to use it. Does anyone have experience with this?

elliot.chen7
2018-07-02 21:56
@matt.fellows suggested I ask here :slightly_smiling_face:

elliot.chen7
2018-07-02 21:59
So far I have been following this approach: https://medium.com/namely-labs/how-we-build-grpc-services-at-namely-52a3ae9e7c35 Each microservice designs it?s .proto defs. They are automatically built and commited in a centralised repo that can been used as a client for other services that communicate with it.

elliot.chen7
2018-07-02 21:59
I?m afraid we?ll lose track of what service communicates with who, etc.

gaurav
2018-07-03 03:14
Hello.. Would `pact-jvm-model:3.5.16` work with both scala version 2.11 and 2.12? Thanks.

gradzio
2018-07-03 07:33
that is right Matt! how could I have missed that? thank you i was using dev account

gradzio
2018-07-03 07:34
it would be nice to get 403 instead of 401 that would lead people into solution

matt.fellows
2018-07-03 09:13
You Probably a good point there

rcheeniyil
2018-07-03 16:11
Hi, Is there support for multipart/form data in Pact Ruby and if so is there any example sitting around? What I've found so far is a post for JVM/JS versions of pact: https://github.com/DiUS/pact-jvm/issues/123

matt.fellows
2018-07-03 21:39
@rcheeniyil same answer for Ruby basically

rcheeniyil
2018-07-03 21:39
do you know if it has to be formatted one line or something weird because I haven't had that working yet

matt.fellows
2018-07-03 21:43
I'm not sure sorry. But as noted in that issue it's possible between JS and JVM (JS uses Ruby under the hood, so that bit is definitely supported)

matt.fellows
2018-07-03 21:44
I would use that example as your starting point

rcheeniyil
2018-07-03 21:49
alrighty ty!

matt.fellows
2018-07-03 21:53
:+1:

ssn899
2018-07-03 22:53
To add onto @elliot.chen7's question, is grpc contract testing in Pact's timeline? If so, has there been any work/progess yet? I would love to contribute to or start the effort.

elliot.chen7
2018-07-03 22:58
Same, I would like to contribute. I'm fairly new to the concept so I just need a little guidance

bethskurrie
2018-07-03 23:01
Hi @rcheeniyil there isn't explicit support, however, it wouldn't be too hard to do it.

bethskurrie
2018-07-03 23:02
What exactly would you want to assert about the file?

bethskurrie
2018-07-03 23:04
As @matt.fellows says, if you can do it in js, you can do it in Ruby, because the js uses the ruby under the covers.

bethskurrie
2018-07-03 23:04
Have you tried doing it as per the example?

matt.fellows
2018-07-03 23:18
Thanks @ssn899 and @elliot.chen7. What language are you using (I know Go is in the mix).

matt.fellows
2018-07-03 23:19
The reason I ask, is that we probably need to do some spikes before we know what it is that we can and more importantly, _should_ do.

ssn899
2018-07-03 23:19
Currently, I am using Pact-JVM.

matt.fellows
2018-07-03 23:19
The latest implementation in Pact JS/Go for message support is protocol/transport agnostic, so in theory could support gRPC. But there are still open questions about the value it provides.

matt.fellows
2018-07-03 23:19
awesome

ssn899
2018-07-03 23:20
But I am pretty flexible

matt.fellows
2018-07-03 23:20
I would think a white paper (in the form of a gist like https://gist.github.com/bethesque/c858e5c15649ae525ef0cc5264b8477c) stating the problem space would be a starting point

matt.fellows
2018-07-03 23:20
we can then collaborate in the open on some technical spikes that might guide implementation

ssn899
2018-07-03 23:21
I can create that

matt.fellows
2018-07-03 23:21
that?d be great!

elliot.chen7
2018-07-03 23:22
@ssn899 let me know how I can help

elliot.chen7
2018-07-03 23:22
@matt.fellows only go for me at the moment

matt.fellows
2018-07-03 23:22
cool, thanks

rcheeniyil
2018-07-03 23:27
not exactly as per example but i've taken generated code from postman and I'm getting a null response for a post I'll take another look at it on thursday and reply here. I'll try to follow the example more thoroughly on my next attempt.

ssn899
2018-07-03 23:29
https://gist.github.com/SnewsButton/91901ac8a0ea63c474ac673457d05e45 here is just a stub for the gist. Feel free to post comments on what exactly needs to be done.

rcheeniyil
2018-07-03 23:30
my `will_respond_with` response assertion is just a json body that worked when I was doing requests with a json body instead of a multipart nothing else is being asserted at this time

rcheeniyil
2018-07-03 23:31
I'll do another round of attempts I just figured I'd ask about it here before throwing too much time at the problem since it doesn't seem to be a common use case

matt.fellows
2018-07-03 23:32
@matt.fellows pinned a message to this channel.

matt.fellows
2018-07-03 23:32
awesome, thanks

matt.fellows
2018-07-04 03:54
I?ve added a couple of thoughts of how we might go about doing it just now (gists don?t get notifications sadly).

liran.tal
2018-07-04 18:56
has joined #general

liran.tal
2018-07-04 18:57
hola amigos! :wink:

liran.tal
2018-07-04 18:57
congrats on your new home

bethskurrie
2018-07-04 22:12
Hi @liran.tal!

bethskurrie
2018-07-04 22:13
Welcome

bethskurrie
2018-07-04 22:13
Much better than gitter

paisrikanth
2018-07-05 02:13
has joined #general

paisrikanth
2018-07-05 02:16
Hey Guys I get this error "Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)" When I try to do pactPublish from build gradle file

paisrikanth
2018-07-05 02:18
plz help

matt.fellows
2018-07-05 02:25
@paisrikanth hello, please try in #pact-jvm and also, you?re going to need to provide more detail (see https://coderanch.com/wiki/659862/Show-Effort)

liran.tal
2018-07-05 05:22
yep!

liran.tal
2018-07-05 05:22
thanks

liran.tal
2018-07-05 05:49
we are refactoring some of our devops and pact patterns flows and I wanted to run a draft plan by you and get some feedback: ``` Consumer ????? PR FLOW: -> Build step -> Run contract tests (we do this as integration tests, I know the docs suggest unit) -> Pact contracts are created -> Pact contracts are pushed to broker (can we push on an existing version? will it override the existing contract of the same version?) -> Identifying the contract with: - Consumer name - Provider name - Version: is the build number - Tag: build -> CI step -> Download the Pact contract from the previous step of the build based on: - Consumer name - Provider name - Version: the build number is passed from the build step to the CI step - Tag: build -> Use the pact contracts to spin up mocked providers using docker pact runner -> Perform Backend E2E tests -> Successful build THEN PR IS MERGED TO MASTER MASTER JOB FLOW BEGINS: -> Build Step ? same as for PR -> CI step ? same as for PR -> If CI succeeds - Increment version for app (tag container image, publish to docker hub, etc) - Publish to Pact Broker with: - Consumer name - Provider name - Version: the app incremented version number - Tag: development NOTES: * We tag the contract as 'development' because the contract may not yet be implemented and we don't want to break the build for the provider. * We accept that tagging it as 'production' (meaning its available on prod) is a manual process that requires clear communication to do so. Provider: -> Build step ? nothing relevant to the contract to be done here -> CI step -> Download the Pact contracts of all of my consumers - Consumer name - Provider name - Version: latest - Tag: production -> Run provider contract tests verification (ensure all contract integrations are not broken) -> Successful verification per contract updates the broker ```

bethskurrie
2018-07-05 05:52
Looks pretty sane. I've got a few questions. What is your version number format?

bethskurrie
2018-07-05 05:53
> can we push on an existing version? will it override the existing contract of the same version? Yes. Yes. Not recommended. Ideally, you should have a unique version number for each pact publication, ideally using or including the git sha if possible. I'll find you a link on this.


bethskurrie
2018-07-05 05:59
For your PRs, you say, the tag is the build - what does that mean?


fergusstrange764
2018-07-05 10:26
has joined #general

zwttgsmu
2018-07-05 14:32
Hello! I run the test on the provider side, the error is displayed: JSON::ParserError: A JSON text must at least contain two octets! as I understood, this is because the response is not in json format Does the pact compare non-json formats? or what is the way to solve this problem?

liran.tal
2018-07-05 20:25
1. we follow semver so our version number format is going to be that. But what I was thinking to use during the build step is that version will be set to the build number: i.e just a simple `159` if that?s the current build number because the published contract to the broker at that point is only used so it can be then downloaded for the CI step and used as a stub with pact runner for the E2E. At that point the contract also doesn?t mean anything. Only when we press the merge button to merge a PR to the master branch then we follow the same testing phase and at that point after CI we do increment version and publish it. so the version being the build number is also because you can have multiple PRs open at the same time. And also the app version doesn?t mean anything, like if I had `v1.1.1-build159` then v1.1.1 doesn?t convey anything because the PR can be open for a week and by that time the version in my `package.json` is obsolete since master is now at `v2.0.0`

liran.tal
2018-07-05 20:27
2. as for ``` can we push on an existing version? will it override the existing contract of the same version? ``` I asked this because it is possible that someone might re-run the PR by actually going to jenkins and restart the build it?s probably an edge case.

liran.tal
2018-07-05 20:31
3. when I publish a contract from the build step to the CI step I tag it as `build` just for semantics, as it doesn?t have any other meaning or purpose (the version number is also the build number so the contract is not really conveying anything important at that point). once `master` successfully finishes CI then we increment a version, set that version in the contract, and tag is as `development` which is semantic again but conveys more meaning at this point.

liran.tal
2018-07-05 20:33
4. will read that article, thanks for sharing! what I really miss is some recipes for devops integration for making CDC happen. there are many deployment and source code versioning strategies (github flow/tbd/etc) where that recipe will change to adapt different workflows.

matt.fellows
2018-07-05 20:53
It can compare non JSON but there are two caveats - the first is that catching rules don't work and it will be comparing by string equality. The second is that you'll need to set the correct content-type so that the framework knows it's media type


bethskurrie
2018-07-06 05:18
@liran.tal I'm working on an idea that will allow "wip" (work in progress) pacts to be verified without actually breaking the provider's build. A "wip" pact would be one with content that has not yet been successfully verified. This means that a consumer could publish a changed pact and get feedback on whether or not it passes, without breaking the provider's build. Once it has successfully been verified, it would be up to the consumer team to promote it to one of the tags that is officially supported by the provider (eg "master", "prod") that _would_ break the providers build.

bethskurrie
2018-07-06 05:19
This also means that any merged branch from the consumer should never block at can-i-deploy, because the pact content should be pre-verified.

vinod.baradwaj
2018-07-06 06:16
@liran.tal we are trying out a similar pipeline in my organisation with pact. Also @dominic.jones has done that

kra
2018-07-06 13:02
Hello Pact community! I just had a lively discussion with a coworker. Since we are using Pact, do we still need another API documentation like Swagger or RESTDocs? The Pact Broker offers pretty good live-documentation of all APIs. Any thoughts/experiences/suggestions on this?

matt
2018-07-06 15:17
I think Pact and Swagger solve different problems, they can even be used together :slightly_smiling_face:

liran.tal
2018-07-06 20:19
@vinod.baradwaj that?s really cool. would be interesting to hear what kind of things you?ve been experimenting with and what challenges you found.

liran.tal
2018-07-06 20:19
@beth yeah, and that brings up another challenge - say I have a consumer and provider contract set in place (tagged production). but then there?s a new API integration between them (i.e: through an API Version header flag) or even a simple new field in the response to support. I can?t just add this interaction to the existing consumer-provider contract that is in production because again, that specific new API is still in development phase of the provider. so I can?t just tag the contract ?development? again to not break providers build because they could be breaking the previous API contract. seems the only way to get around it is via naming the provider differently to get a new contract made just for that.

nick
2018-07-06 22:53
has joined #general

matt.fellows
2018-07-07 01:48
It's a good discussion for this group. Our official position is that they solve different problems and can be used together.

matt.fellows
2018-07-07 01:49
But I'd love to see what other responses you get

gaurav
2018-07-07 03:13
I think Pact Broker is not suitable for documentation purposes at all. Reason is that it shows contract between provider and consumers.. which can be different for different consumers. consumers might need only few fields from provider as response and in that case Pact Broker will only show those few fields as a part of their Pact. Swagger is aimed at documentation and from my opinion, both should be used together. Using Pact with Swagger makes CI integration and pact verification super easy and fast (google swagger-request-validator-pact).

yamad
2018-07-07 09:45
has joined #general

bethskurrie
2018-07-07 11:23
> I think Pact Broker is not suitable for documentation purposes at all. What I'd add to that is that it documents the integration between a particular consumer and provider very well. It doesn't, however, provide _general_ documentation for a provider, which Swagger does very well.

polvara
2018-07-07 11:48
has joined #general

polvara
2018-07-07 11:58
Hello everyone, I'm joining this chat in response to my tweet https://twitter.com/Gpx/status/1015233318848262144?s=19 At my company we're trying to decide if Pact is the right tool for us. I hope someone with more experience than me can help. In a nutshell, we're testing our React application with Selenium using a Django server as a backed. We have huge latency issues due to network calls. We were thinking to replace the server with Pact to speed things up. Is this recommendable? Has someone done something similar before? Thank you

liran.tal
2018-07-07 12:06
Hi @polvara. that can definitely work, although if you are working through some CRUD flows and doing more than just smoke tests then it can be a little bit more work to get things to play together.

gaurav
2018-07-07 14:52
Hello all, I have a question about `ConsumerInfo` class in `pact-jvm-provider_2.12-3.5.19`: `consumerInfo.getPactSource()` gets an instance of `BrokerUrlSource`.. how do I retrieve consumer source from this instance. Sorry I am not really familiar with kotlin. For example: if `consumerInfo.getPactSource().toString()` gives: `BrokerUrlSource(url=http://localhost:52821/pacts/provider/Provider/consumer/Consumer1/version/123, pactBrokerUrl=http://localhost:52821, attributes={}, options={})`, I am interested in `consumerInfo.getSource().someMethod()` that gives `http://localhost:52821/pacts/provider/Provider/consumer/Consumer1/version/123` Thanks a lot.

liran.tal
2018-07-07 15:47
@bethskurrie in https://github.com/pact-foundation/pact_broker/wiki/Pacticipant-version-numbers why is `2.0.0` regarded as a bad example for application version? it is following semver and should be unique for apps.

liran.tal
2018-07-07 17:49
hi all, I?m trying to decide on a good title for a talk I?ll be giving about CDC with Pact, it will mostly intro the subject, show an example, and provide a recipe for teams to adapt in their organisation through devops ci/cd pipelines. ``` 1. Testing Microservices and Staying Alive To Tell The Story 2. Testing Microservices and Staying Alive 3. Testing Microservices and avoiding Integration Hell 4. Contracts Testing for a Microservices Architecture 5. Consumer Driven Contracts testing for SOA 6. <your own suggestion> ``` which do you like most? I?m open to your own suggestions! thanks :wink:

david.j.smith
2018-07-07 18:12
"Life's too short for Dev VM's"? :stuck_out_tongue:

liran.tal
2018-07-07 18:14
:slightly_smiling_face:

ar7ai
2018-07-07 18:25
has joined #general

ar7ai
2018-07-07 18:28
Hello! I use ProviderStateMiddleware. Why is the "private void AddData ()" method executed before the test, is this the correct behavior? (I do according to your example https://github.com/tdshipley/pact-workshop-dotnet-core-v1/blob/master/CompletedSolution/Provider/tests/Middleware/ProviderStateMiddleware.cs)

david.j.smith
2018-07-07 18:32
I'm not familiar with that middleware, but it sounds correct. All provider state setup actions need to run before the tests because their job is to put the provider into a known state before the test executes. For example, if the tests relies on being able to use query params to find document with id 12, then document with id 12 will need to be there in advance!

ar7ai
2018-07-07 18:35
I also think so but so far in this example there is first testing, and only then setting a precondition (adding data)

ar7ai
2018-07-07 18:35
and I do not understand why :disappointed:

ar7ai
2018-07-07 18:37
"Why is the "private void AddData ()" method executed after the test, is this the correct behavior?" sorry, not exactly written

david.j.smith
2018-07-07 18:42
I'm not following you sorry, the code you've sent over isn't a test, and (ok my C# is rusty) I can't see it running a test either. Looks like a ProviderState management class to me?

uglyog
2018-07-07 23:44
try consumerInfo.getPactSource().getUrl()

gaurav
2018-07-08 01:53
hmm I was trying to do.. However just noticed that `getPactSource()` actually returns an object type so need to cast that to `BrokerUrlSource`. So `((BrokerUrlSource)(consumerInfo.getPactSource())).getUrl()` is working! Thanks a lot!

bethskurrie
2018-07-08 02:17
Hi @ar7ai please note the guidelines for raising issues that were sent to you by the greetbot, and ask your question in the relevant channel for your technology. It helps keeps the conversations focussed, and lowers the noise in the general channel.

greetbot
2018-07-08 02:18
has joined #general

paulswilliams
2018-07-08 09:00
Hey all, having run with Pact JVM for a month on our production project, I'm really enjoying it's coverage. As we're around half way through our development phase, we're soon going to need to start thinking about production, api versioning, releasing, branching etc. I've read the matrix page, and wondered if anyone can recommend other supporting documentation / videos etc to best prepare us for go live. If it helps, we're currently developing a single provider, that will be consumed by around 6 consumers, although at this moment, only 1 consumer will be in play. Looking forward to any responses.

bethskurrie
2018-07-08 09:49
1!

bethskurrie
2018-07-08 09:52
Because it doesn't uniquely identify the exact version of your repository that made the contact. You ruin the ability of the matrix to safely allow you to deploy if you can't map your code version to your pact version 1 to 1.

bethskurrie
2018-07-08 09:54
You get some extra benefits by using the sha because you can send verification statuses back to github or gitlab (or equivalent) as commit statuses.

bethskurrie
2018-07-08 09:55
If you must use sem ver, then including the sha as metadata will ensure that your version numbers are unique and can be mapped back to the version of the code that created them.

bethskurrie
2018-07-08 10:06
I think you said you increment the patch version with each build, so you should at least have unique numbers. The reason being able to map back to the sha is if you need to do the last step of the "pact nirvana" document, and you have to check out the production version of the provider to verify it against the new consumer. If you're deploying the provider frequently though, you most likely won't have to do this.

bethskurrie
2018-07-08 10:08
Welcome @paulswilliams this document (though it's still in draft, and pretty ugly, sorry!) should help https://docs.google.com/document/d/e/2PACX-1vRf1kSDccImNipOOm1G-bjcSs-ifbZjf1v54K-dIcq8BLKeFPAAm_bf_p71UKqkRMIx30QWWL-kN8TI/pub

bethskurrie
2018-07-08 10:10
Let me know if you have any further queries after reading this. Because everyone's workflow is different, it's hard to describe exactly how to set things up.

paulswilliams
2018-07-08 10:10
Oh thank you. I will have a good read this afternoon. Thank you for you and everyone?s work on Pact. I had a shaky start, but it?s really starting to show value now.

bethskurrie
2018-07-08 10:11
Good to hear! We know that it's difficult to ramp up.

bethskurrie
2018-07-08 10:11
What did you find most difficult?

steve.cook
2018-07-08 10:15
has joined #general

2018-07-08 10:15
Welcome to the Pact #general channel @steve.cook! Please join the relevant channels for your Pact implementation as well, so you can discuss your issues with the audience who can best help you.

bethskurrie
2018-07-08 10:17
Hi @polvara paxt can definitely help you, but I would caution against writing too many contact tests that go through the full layer. Often you'll end up with an explosion of interactions that you've only added because you're trying to test some element of the UI. We'd generally recommend using Pact to unit test the interactions between the API client (a class in your consumer codebase that is responsible for making the calls to the provider) and the API. You can then use the pact *stub* server to stand up a stub for tests that involve the UI.

paulswilliams
2018-07-08 10:34
Concepts. Thinking I could use Pact to create mocks for acceptance tests, rather than focusing on integration components. Some of the JVM docs using Groovy over Java add unneeded cognitive load. Also, sceptical colleagues who are more confident with end to end tests, but unversioned stored procs in shared database have caused so many issues that they?ve seen the light in embracing decoupling.

bethskurrie
2018-07-08 10:35
Ouch!

bethskurrie
2018-07-08 10:35
Yes, it is a conceptual leap.

paulswilliams
2018-07-08 10:36
Once handling the matrix is understood and battle hardened, I?d hope that we?ll use this approach a lot.

bethskurrie
2018-07-08 10:36
That first one is a really good point. Should we make that clearer somewhere?

paulswilliams
2018-07-08 10:36
I work at a contracting company, the shared db is a customer thing :face_with_head_bandage:

bethskurrie
2018-07-08 10:37
I work for a consulting company - I've also seen things I'd rather forget!

paulswilliams
2018-07-08 10:37
Perhaps. If others feel same pain? I can?t recall a ?what Pact doesn?t do? section which might be useful.

bethskurrie
2018-07-08 10:38
There is a "what is pact not good for" section actually.

paulswilliams
2018-07-08 10:38
Yeah, although these anti-patterns are making us be creative.

bethskurrie
2018-07-08 10:38
In the docs, underneath the "what is it good for" section.

paulswilliams
2018-07-08 10:39
Yeah, i couldn?t recall it, but then I started a couple of months back.

bethskurrie
2018-07-08 10:39
Next time I'm looking at the main section, I'll have a think if there's any way to make that clearer.

bethskurrie
2018-07-08 10:40
I value the impressions of people who have recently read the docs, because those of us who know pact too well are bad at working out what needs improving.

paulswilliams
2018-07-08 10:41
Okay, cheers. I?ll try and add an issue or PR on docs if I get chance. Lots of juggling as you no doubt experience

bethskurrie
2018-07-08 10:42
Constantly!

paulswilliams
2018-07-08 14:41
That tagging / wip content is exactly what I was looking for. I will read it again in depth after pondering this evening. Cheers!

polvara
2018-07-08 19:10
Thanks for the reply. Yes, that?s what we wanted to do, use the stub server when we run our E2E tests. Most of our UI is tested with unit and integrations tests. We use E2E to check the main workflows, we don?t cover edge cases. I guess the main issue from my side is to understand how much can you push Pact before you have an explosion of interactions

polvara
2018-07-08 19:13
Hey, thanks for the reply and thanks for the tweet too :bow: Our slowness is due to the server. We tried to use a static server for one of our E2E tests and the increase in speed is noticeable?we?re talking minutes vs seconds. As I wrote also here https://pact-foundation.slack.com/archives/C5F4KFKR8/p1531077014000029?thread_ts=1530964717.000011&cid=C5F4KFKR8 the thing that confuses me the most is to understand when a smoke test becomes too specific and it will force us to work agains Pact

bethskurrie
2018-07-09 00:23
> We use E2E to check the main workflows, we don?t cover edge cases Yay!

obradford
2018-07-09 07:08
has joined #general

2018-07-09 07:08
Welcome @obradford!

greetbot
2018-07-09 07:12
@greetbot has left the channel

violeta.minkov
2018-07-09 07:28
has joined #general

bethskurrie
2018-07-09 11:14
@liran.tal no, this new interaction should be added by creating a feature branch of the consumer codebase, and publishing the pact with a tag that matches the name of the feature branch. You can then go to the provider team and say, hey, can you support this new pact (give them the name of the tag). Once that new pact is supported, and deployed to production, then you can merge in your feature branch in your consumer and deploy.

bethskurrie
2018-07-09 11:15
As the "pact nirvana" document outlines, you'll find it much easier if you use tag names that map to your branch names in development, and tag names that match your environments when you deploy.

bethskurrie
2018-07-09 11:16
Your provider should verify the "master" and "production" tags if you follow this scheme.

bethskurrie
2018-07-09 11:17
The approach I outline above for adding new features (using a branch and another tag) will allow you to add new interactions without breaking everything.

bethskurrie
2018-07-09 11:18
Does that make sense at all?

bethskurrie
2018-07-09 11:29
Hi `can-i-deploy` users. I've added a `--retry-while-unknown` option to allow your consumer pipeline to wait for the provider to finish running the pact verifications when it is triggered by a webhook (which is triggered by a changed pact). Remember, however, that pacts can be pre-verified on feature branches to avoid blocking your master build. You can read about how to do this in https://docs.google.com/document/d/e/2PACX-1vRf1kSDccImNipOOm1G-bjcSs-ifbZjf1v54K-dIcq8BLKeFPAAm_bf_p71UKqkRMIx30QWWL-kN8TI/pub

jannik.falkner
2018-07-09 13:10
has joined #general

jannik.falkner
2018-07-09 13:15
Hi, can someone explain why injection with `@Autowire` in this example does not work when verifying via the Gradle Pact plugin? https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-spring#using-a-spring-runner-version-357 I need to inject a bean of `RabbitMqBackend` but it says `kotlin.UninitializedPropertyAccessException: lateinit property rabbitMQBackend has not been initialized`

ssn899
2018-07-09 19:37
@matt.fellows there has been some discussion in the gist.

bethskurrie
2018-07-09 23:25
Hi @jannik.falkner. Welcome to the pact slack. You'll get the audience for your question by asking in the pact-jvm channel

bethskurrie
2018-07-10 02:59
Hi all! To help get the word out about new features in Pact, and to help Pact users share their experiences with each other, we're trying out a fancy new blog at http://blog.pact.io I've written the first couple of posts to get us started.

bethskurrie
2018-07-10 03:00
Here's a quick intro to the new retries feature in can-i-deploy http://blog.pact.io/2018/07/10/retries-for-can-i-deploy/

bethskurrie
2018-07-10 03:01
We'll be adding new posts as new features come out, so be sure to add it to your feed reader.

bethskurrie
2018-07-10 03:04
added an integration to this channel: https://pact-foundation.slack.com/services/BBM3NQTMF

bethskurrie
2018-07-10 06:44
@gaurav would you be interested in writing a blog post about your pact/swagger set up and experiences on the new http://blog.pact.io?

bethskurrie
2018-07-10 06:47
Hi @santoshtrip sorry, I'm not sure if you ever got an answer. The swagger validator is better in situations where there are more consumers than the provider team can realistically maintain provider state data for (maybe 10?)

bethskurrie
2018-07-10 06:47
The down side is that you lose a bit of confidence, because you're adding an extra layer of abstraction.

bethskurrie
2018-07-10 06:48
The up side is that you can get very fast feedback, and in some situations, fast feedback is more valuable that waiting for slightly more accurate feedback.

bethskurrie
2018-07-10 06:49
The broker doesn't current support the exchange of swagger documents, but it's something we're planning on adding in the future

bethskurrie
2018-07-10 06:49
@gaurav has had experience with the pact swagger workflow.

bethskurrie
2018-07-10 06:50
Keep in mind that you need to ensure that your swagger document is in sync with your code either by using dredd or by generating the swagger document from the code itself.

bethskurrie
2018-07-10 06:52
What you lose is the ability to verify what a particular resource looks like with various combinations of data - the "provider states" that pact gives you. This may or may not be particularly important for your api, however.

gaurav
2018-07-10 07:47
Thanks @bethskurrie. I would love to do that but my setup for pact/swagger is not complete yet. Swagger-validator was using quite old pact version so I was working on upgrading the version recently in my fork (there were many changes!). Also wanted to take this chance to understand the internals of swagger-validator. I am ready to create a PR but there is a delay because of organisational processes (they need some CLA for corporate contributors so need to involve legals). Anyways, point is that although my quick evaluation looks very promising.. it would take me some time.. may be a month to be at a stage where I can share experiences about both good and pain points in more practical sense. On side notes, I really think that Pact Foundation and Atlassian should work together to have a complete and easier contract testing solution (I don?t see many contributors in that repo).. Also asked the contributor there to request a slack channel here because of increasing interest in swagger-validator here.. and to be updated with latest pact discussions.

bethskurrie
2018-07-10 07:50
Having a channel here is a good idea. You're right, that we haven't collaborated on this. Some of the atlassian teams wrote it to solve their own problems (much like pact was originally written!) and then open sourced it afterwards.

bethskurrie
2018-07-10 07:51
We'd love to have better integration and support in the broker for this flow, but it just hasn't reached the top of the priority list yet.

bethskurrie
2018-07-10 07:53
I saw that one of the atlassian contributors is going to be at a conference I'm attending soon, so I'll try and catch him to talk about this.

gaurav
2018-07-10 07:57
Sounds like a good idea.. As they are already using swagger-validator for longer than anyone else, they will be good candidates to share experiences as well. :slightly_smiling_face: May be convince them to remove CLA thing.. :wink:

alex.bednarczyk
2018-07-10 13:18
has joined #general

rlamb
2018-07-10 16:51
Is anyone using a tool like RDoc or YARD to document provider states?

sjani
2018-07-10 23:30
has joined #general

bsayers
2018-07-11 07:35
has joined #general

bethskurrie
2018-07-11 07:48
I reckon the devs probably don't have much say over a CLA unfortunately.

raido.letterbox
2018-07-11 07:48
has joined #general

bsayers
2018-07-11 08:07
Hi all, are there many users of swagger-mock-validator in here? My team is considering adding OpenApi 3 support to it and am wondering if that is of interest to anyone here.

polvara
2018-07-11 08:27
Hello, all my API calls to Pact are returning status code `222`. Any idea why is that or how to debug the issue?

raido.letterbox
2018-07-11 08:30
Hi all. I am a bit confused about consumer tests concept. Are they meant just to generate PACT json file or to test the request which the consumer sends too?

abubics
2018-07-11 08:57
They just generate the pact file, and help assert that your API client deserialises the stubbed response properly.

abubics
2018-07-11 08:57
A separate process verifies the pact file against the producer :)

uglyog
2018-07-11 09:20
Is that the HTTP status code?

polvara
2018-07-11 09:39
Yes, which is weird because it?s a code that doesn?t exist

uglyog
2018-07-11 09:45
What language are you using? Is this during the consumer test?

raido.letterbox
2018-07-11 09:45
Thanks! I was writing a response to you and understood a few thing by myself :slightly_smiling_face: Just a small question left: if we are verifying that the consumer deserialises the response correctly, does this mean that the consumer tests should be written in the same language as the consumer itself?

polvara
2018-07-11 09:48
Yes, consumer test in node

polvara
2018-07-11 09:49
``` provider.addInteraction({ state: 'admin user exists', uponReceiving: 'a sign in request', withRequest: { method: 'POST', path: '/be-mock/api-login/', body: { username: '', password: 'welcome' }, }, willRespondWith: { status: 200, body: { token: 'eyJ, }, }, }) ```

polvara
2018-07-11 09:49
This is how I define the interaction

uglyog
2018-07-11 09:53
Wow, that is weird. Maybe the logs from the mock server will help

polvara
2018-07-11 09:56
``` I, [2018-07-11T11:54:38.132877 #1529] INFO -- : Received request POST /be-mock/api-login/ D, [2018-07-11T11:54:38.133058 #1529] DEBUG -- : { "path": "/be-mock/api-login/", "query": "", "method": "post", "body": { "username": "", "password": "welcome" }, "headers": { "Content-Length": "61", "Content-Type": "application/json", "Host": "localhost:1234", "Connection": "keep-alive", "Origin": "http://localhost:3000", "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36", "Accept": "*/*", "Referer": "http://localhost:3000/login", "Accept-Encoding": "gzip, deflate", "Accept-Language": "en-US,en;q=0.9", "Cookie": "_ga=GA1.1.419063753.1531302868; _gid=GA1.1.551748798.1531302868; _gat=1; mp_7c7a4eab3982d24cf551ff2e97f58b30_mixpanel=%7B%22distinct_id%22%3A%20%2216488c3732012d-01429e40c5e0a-163b6950-13c680-16488c37321858%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; __stripe_mid=a13be528-1a35-4766-80f6-eda2e807ecf4; __stripe_sid=0d317bf2-c1a8-47b3-b4cb-9938c22928f7", "Version": "HTTP/1.1" } } I, [2018-07-11T11:54:38.135619 #1529] INFO -- : Found matching response for POST /be-mock/api-login/ D, [2018-07-11T11:54:38.135714 #1529] DEBUG -- : { "status": 200, "headers": { }, "body": { "token": "eyJ" } } ```

polvara
2018-07-11 09:56
They look fine

polvara
2018-07-11 09:57
Is it as if the server responds correctly but something changes the response

polvara
2018-07-11 10:04
It?s probably a problem with testcafe because if I query the server with curl it works

hstene
2018-07-11 10:10
I am writing a pact where i care about the content of a string, but not capitalization. So in my pact I want to see if the provider returns the string `'hello'`. The provider does in fact return `'HELLO'` but either way (`'hello'|`HELLO`) is fine by me- How do I represent that in a pact test? I am specifically using pact-jvm

polvara
2018-07-11 10:11
Ok, the problem seems to be this header `'x-hammerhead|fetch|request-credentials: include'`

polvara
2018-07-11 10:11
Any idea why?

can
2018-07-11 10:12
Hi, Henrik! Have you used regular expressions before?

hstene
2018-07-11 10:15
Yes, does pact support regex-types in individual fields? :smile:


hstene
2018-07-11 10:18
Thanks!

bethskurrie
2018-07-11 10:52
Yes

bethskurrie
2018-07-11 10:52
You would use pact to write tests for the client class or classes that make the calls to the API.

bethskurrie
2018-07-11 10:53
Generally unit tests are recommended, to keep the contract focussed.

bethskurrie
2018-07-11 10:53
You are testing that the client class makes the expected http requests, and that it handles the expected responses correctly.

bethskurrie
2018-07-11 10:54
Generally this means deserialising the response into a class that represents the resource.

raido.letterbox
2018-07-11 10:59
Thanks a lot

bethskurrie
2018-07-11 11:02
There have been a few people asking about it recently, so if you do a search, you should find them.

polvara
2018-07-11 11:56
I think it?s a problem in the FE. I contacted testcafe https://github.com/DevExpress/testcafe/issues/1134#issuecomment-404123524 Thanks for the support

matt.fellows
2018-07-11 12:01
@bsayers :point_up:

bsayers
2018-07-11 12:13
@gaurav Our legal team is not negotiable on the CLA. It?s not unusual to need to sign one of these if you want to contribute to open source projects owned by bigger companies, Facebook, Google, Microsoft, Amazon are a few examples of other companies that also require this.

gaurav
2018-07-11 12:44
Sure @bsayers. That was more a light comment. :slightly_smiling_face: may be I am just unhappy with all these legal stuff in general.. but yes, I am sure they are there for reasons!

matt.fellows
2018-07-11 12:58
As per above Been, should we create a channel to discuss the swagger tools you guys have created?

gaurav
2018-07-11 14:08
There is a channel already #swagger-validator

matt
2018-07-11 15:50
I think OpenApi 3 support would be awesome.

santoshtrip
2018-07-11 16:50
@bethskurrie thanks for the detailed explanation. This is what I was looking for.:+1:

santoshtrip
2018-07-11 16:51
Awesome!

bsayers
2018-07-12 00:09
I won?t argue with you there @gaurav, I don?t think highly of the legal overhead either. Unfortunately the choice is open source the way we do today or don?t open source anything!

argos83
2018-07-12 00:46
has joined #general

mikey
2018-07-12 20:43
Hullo! First of all, Pact is *awesome*. Incredible work, ya?ll! We?re about to add Pact for a Javascript consumer. We use Karma to drive our javascript test suite. Which javascript Pact lib would you recommend? I?m thinking https://github.com/pact-foundation/karma-pact but I want to check with the experts who know more about the Pact ecosystem than I :simple_smile:

mikey
2018-07-12 20:46
We use Nodejs for our frontend and I saw pact-node and pact-js too, but I?m not sure how to determine which lib would best meet our needs.

mikey
2018-07-12 20:47
looks like karma-pact uses pact-node?

matt.fellows
2018-07-12 21:05
Hi @mikey! You might want to join us over in #pact-js

matt.fellows
2018-07-12 21:05
short answer is yes, longer answer is avoid Karma where possible

mikey
2018-07-12 21:06
oh right on, thank you! Joining now.

minhdoan
2018-07-13 03:12
Hi team, anyone has experience with request with space(s) in URL, when executing pactVerify the space should encoded to %20, unfortunately the '+'. I am stuck and don't know how to fix https://github.com/DiUS/pact-jvm/issues/693 Could you please help on it? Many thanks in advance!

mboudreau
2018-07-13 03:19
is this for a query string or for the actual URL path?

minhdoan
2018-07-13 03:21
Hi Michel, The actual URL is: /odata/CHAIR?$filter=CREATED_BY/FIRST_NAME eq 'LIMS'&$orderby=Id asc It is the code i wrote in consumer side: .path("/odata/CHAIR") .query("$filter=CREATED_BY/FIRST_NAME eq 'LIMS'&$orderby=Id asc")

minhdoan
2018-07-13 03:21
And the result shown on Broker: { "method": "GET", "path": "/odata/CHAIR", "query": "$filter=CREATED_BY%2F_FIRST_NAME+eq+%27LIMS%27&$orderby=Id+asc" }

mboudreau
2018-07-13 03:25
yep, as it should be. HTTP specification says that all query strings should use `+` for spaces

mboudreau
2018-07-13 03:26
if you've use anything that uses HTTP, it should transform it for you when you add spaces

mboudreau
2018-07-13 03:26
and should still work with pact

minhdoan
2018-07-13 03:27
Do you mean if my provider scheme is HTTP, the pactVerify will encode space to + and sent out the URL

minhdoan
2018-07-13 03:27
If the scheme is HTTPS, it is Ok, right?

mboudreau
2018-07-13 03:28
https will do the same

minhdoan
2018-07-13 03:28
yes, i also try with HTTPS and it not works

minhdoan
2018-07-13 03:28
So please help to instruct me how to overcome it

mboudreau
2018-07-13 03:29
are you just trying to verify, or trying to use the mock?

minhdoan
2018-07-13 03:37
I faced the issue when executing pactVerify against actual provider

minhdoan
2018-07-13 03:38
the mock in consumer side is Okie

minhdoan
2018-07-13 03:38
So the pact records are sucessfully created and published to Broker

bethskurrie
2018-07-13 04:46
As Michel says, `+` is the correct character to use when encoding a space in a query parameter. `%20` is what to use when there is a space in the path.

minhdoan
2018-07-13 04:51
Hi @bethskurrie, Nice to meet you

minhdoan
2018-07-13 04:51
Do you mean the URL: /odata/CHAIR?$filter=CREATED_BY/FIRST_NAME eq 'LIMS'&$orderby=Id asc

minhdoan
2018-07-13 04:52
When executing pactVerify, It would be encoded to: %2Fodata%2FCHAIR%3F%24filter%3DCREATED_BY%2FFIRST_NAME+eq+%27LIMS%27%26%24orderby%3DId+asc

minhdoan
2018-07-13 04:52
and send to actual provider

minhdoan
2018-07-13 04:53
it is a correct behaviour of our pact-jvm, right?

minhdoan
2018-07-13 04:53
So the actual provider should handle the '+', right?

bethskurrie
2018-07-13 04:53
yes

minhdoan
2018-07-13 04:54
Do we have any option to encode space to %20 in the query path as well?

bethskurrie
2018-07-13 04:55
If your HTTP library cannot unencode a + symbol in a query parameter, there is a problem with it.

bethskurrie
2018-07-13 04:56
What library are you using?

minhdoan
2018-07-13 04:58
I think i am using pact-provider-gradle

minhdoan
2018-07-13 04:58
plugins { id 'au.com.dius.pact' version '3.5.9' } group 'ODataPactProvider' version = '1.0.0' // PACTs require SemVer task wrapper(type: Wrapper) { gradleVersion = '4.2' }

bethskurrie
2018-07-13 04:59
I mean, what http library

minhdoan
2018-07-13 05:01
I am unsure Beth, i only know when i execute pactVerify task then the pact library will create a request and send to configured provider service

minhdoan
2018-07-13 05:01
Do we know the info with stacktraceshow option?

bethskurrie
2018-07-13 05:03
Sorry, I have to go.

bethskurrie
2018-07-13 05:03
I could be wrong, but I think you need help with your http framework, rather than pact.

minhdoan
2018-07-13 05:04
Many thanks for your help @bethskurrie and @mboudreau !

mboudreau
2018-07-13 05:04
np

minhdoan
2018-07-13 05:07
Though I am still not clear, in consumer side i used Spring Boot RestTemplate for initialize and send request to mock service

minhdoan
2018-07-13 05:07
No issue in consumer side, pact records created without issue

minhdoan
2018-07-13 05:08
But in provider test, pactVerify fails as demonstrated

mboudreau
2018-07-13 05:08
again, pact isn't the issue, it's the thing that calls the pact specified URL that is

minhdoan
2018-07-13 05:08
So i dont know the issue with http framework you mentioned here is the http framework used in Consumer, Spring Boot, right?

mboudreau
2018-07-13 05:08
since the RFC specification for HTTP calls says that query strings needs to be using `+` and not `%20`

minhdoan
2018-07-13 05:09
Yes, i also see that pact record is Okie

minhdoan
2018-07-13 05:10
But i only need to clarify again that whether our actual provider service must handle the + in the query path?

minhdoan
2018-07-13 05:10
If yes, i must raise a change request to dev team

minhdoan
2018-07-13 05:11
The web serivce must support the + in query option

minhdoan
2018-07-13 05:13
Or the actual issue from the http framework which initialize the request sent to the web service, it should replace the + by %20 before sent???

minhdoan
2018-07-13 05:13
Again, i am really not clear so i must take too long

minhdoan
2018-07-13 05:14
And i thank you so much for your help, very very very much

bethskurrie
2018-07-13 06:08
Yes, your service should accept + as a space delimiter in a query.

bethskurrie
2018-07-13 06:10
> The web serivce must support the + in query option This.

bethskurrie
2018-07-13 06:13
Please see the URL encoding section on https://en.wikipedia.org/wiki/Query_string

minhdoan
2018-07-13 06:54
@bethskurrie It is so cool. Only one more concern to fulfill the change request that whether pact-jvm, pactVerify support any configuration to configure the encoding by ourselves, e.g: replace + by %20 or anything else

bethskurrie
2018-07-13 06:57
There is no configuration option to do that. @uglyog can tell you more about it though.

minhdoan
2018-07-13 08:07
Hi team, i am executing pact provider test, the pact-jvm-provider-gradle library is used. My test suite contains 4 test cases (provider MULTI_USERS_PROVIDER has 4 consumers). My system requires login first so we must add an authorization header to each request as below: pact { // Configure the Pact verification log reports { defaultReports() // adds the standard console output json // report in json format } serviceProviders { MULTI_USERS_PROVIDER { requestFilter = { req -> // Add an authorization header to each request // because of our system needs login first with credential: user:password req.addHeader('Authorization', 'Basic dXNlcjpwYXNzd29yZA==') } protocol = providerScheme host = providerHost port = providerPort path = providerScheme + "://" + providerHost + ":" + providerPort + "/webservice" hasPactsFromPactBroker(pactBrokerScheme + "://" + pactBrokerHost + ":" + pactBrokerPort) } } } But in the test suite, there is one test case must use other user , instead of user:password. So i try to use the stateChange for this one: pact { serviceProviders { MULTI_USERS_PROVIDER { requestFilter = { req -> // Add an authorization header to each request // because of our system needs login first with credential: user:password req.addHeader('Authorization', 'Basic dXNlcjpwYXNzd29yZA==') } hasPactWith('AnotherUser_Consumer') { stateChangeUsesBody = false // defaults to true pactSource = url('http://pact-broker-local-repo.net/provider/MULTI_USERS_PROVIDER/consumer/AnotherUser_Consumer/latest') stateChangeRequestFilter = { req -> // Add an authorization header to each request // another:password req.addHeader('Authorization', 'Basic YW5vdGhlcjpwYXNzd29yZA==') } protocol = providerScheme host = providerHost port = providerPort path = providerScheme + "://" + providerHost + ":" + providerPort + "/webservice" hasPactsFromPactBroker(pactBrokerScheme + "://" + pactBrokerHost + ":" + pactBrokerPort) } } } But it seems the credential is not overwritten for specific test case. Anyone has experience on this stuff? Could you please help?

uglyog
2018-07-13 08:30
I don't think `stateChangeRequestFilter` can take any parameters. You'll have to do it in the `requestFilter`, but you might be able to provide a `requestFilter` for `AnotherUser_Consumer`

liran.tal
2018-07-13 08:31
Because we?re using a trunk based development workflow and we merge integrations even if they aren?t yet ready (we have feature flags and API versioning for this) then the whole process of relying on feature branches and specific branch names is not going to work well for us.

liran.tal
2018-07-13 08:32
:+1:

liran.tal
2018-07-13 08:35
my code version will always be the same as my contract version. when I publish a production contract it is tagged with 2.0.0 which is the consumer version that goes to production. when I tag a new production contract as 2.0.1 that is again the new consumer version as well that is deployed to prod. does that make sense ?

minhdoan
2018-07-13 09:13
@uglyog Thanks so much! But i have a concern that it seems new authentication credential used in AnotherUser_Consumer is also used for the test cases which be executed after it.

minhdoan
2018-07-13 09:13
Do you face that situation?

bethskurrie
2018-07-13 10:39
The version that you supply when you publish *is* the code version (it's the consumer application version). The *pact* version is managed for you by the broker (it's a sha based on the content).

bethskurrie
2018-07-13 10:40
Generally, you tag a version resource with the environment name, or the branch name, rather than a version number, because it generally already has a version number as its identifier.

bethskurrie
2018-07-13 10:41
It would be like tagging version "2.0.0" with a tag "2.0.0".

bethskurrie
2018-07-13 10:42
Are you doing this because you want to verify all your prod versions of a mobile api for backwards compatibility, and that's the easiest way to make the verification configuration do that for you?

bethskurrie
2018-07-13 10:45
Then, how about using the feature tag names?

bethskurrie
2018-07-13 10:46
I've been hoping to find someone with a feature toggle use case.

minhdoan
2018-07-13 12:00
Any solution for each case?

jiinliin
2018-07-15 22:33
has joined #general

bethskurrie
2018-07-15 22:59
@minhdoan if you believe you have found a bug, can you create a github repository with an executable example to demonstrate the issue. This will make any issue easy to identify, and allow us to show that it has been fixed.


minhdoan
2018-07-16 11:30
@bethskurrie I am not sure, i need an option to printout the Authorization for each request to investigate further. Any option ?

minhdoan
2018-07-16 11:30
I have tried with --debug, -i, --info but not info about Authorization.

bethskurrie
2018-07-16 11:31
I'm afraid I don't know much about the JVM implementation. Try asking in the JVM channel. If I was having problems with a library, I'd hook up the debugger and step through the code. Have you tried that?

minhdoan
2018-07-16 11:35
Thanks, Beth! I will try but i am not a developer so i am lack of skill to debug deeply :smile:

bethskurrie
2018-07-16 11:44
Oh, I see. Pact is generally used by developers.

bethskurrie
2018-07-16 11:44
Are you a tester?

minhdoan
2018-07-16 11:53
Hi team, i have a provider with 10 consumers so there are 10 pact records on Broker. And 7 test cases use the default authorization credential, and remaining 3 cases use distinct ones. So i must add requestFilter for each as below code: `'PERMISSION_PROVIDER {` ` requestFilter = { req ->` ` // Add an authorization header to each request` ` // because of our system needs login first` ` //default credential is: superuser:123456` ` req.addHeader('Authorization', 'Basic c3VwZXJ1c2VyOjEyMzQ1Ng==')` ` }` ` protocol = schemeProperty` ` host = hostProperty` ` port = portProperty` ` hasPactsFromPactBroker(brokerScheme + "://" + brokerHost + ":" + brokerPort)` ` // Consumer 1 need the credential: test001:123456` ` hasPactWith('Consumer_1') {` ` pactSource = url('http://localhost/pacts/provider/PERMISSION_PROVIDER/consumer/Consumer_1/latest')` ` requestFilter = { req ->` ` // Add an authorization header to each request` ` // because of our system needs login first` ` // with cre: test001:123456` ` req.addHeader('Authorization', 'Basic dGVzdDAwMToxMjM0NTY=')` ` }` ` }` ` // Consumer 2 need the credential: test002:123456` ` hasPactWith('Consumer_2') {` ` pactSource = url('http://localhost/pacts/provider/PERMISSION_PROVIDER/consumer/Consumer_2/latest')` ` requestFilter = { req ->` ` // Add an authorization header to each request` ` // because of our system needs login first` ` // with cre: test002:123456` ` req.addHeader('Authorization', 'Basic dGVzdDAwMjoxMjM0NTY=')` ` }` ` }` ` ` ` // Consumer 3 need the credential: test003:123456` ` hasPactWith('Consumer_3') {` ` pactSource = url('http://localhost/pacts/provider/PERMISSION_PROVIDER/consumer/Consumer_3/latest')` ` requestFilter = { req ->` ` // Add an authorization header to each request` ` // because of our system needs login first` ` // with cre: test003:123456` ` req.addHeader('Authorization', 'Basic dGVzdDAwMzoxMjM0NTY=')` ` }` ` }` ` }` And i want to ensure that each request will have correct Authorization header info when pactVerify is executed, but i tried with: `gradle pactverify [--info | --debug | -i]` But no option show the Authorization information. Could you please help on it? Many thanks!

minhdoan
2018-07-16 13:04
Yes, i am a tester. We want to apply Pact to our project, replace Integration test

minhdoan
2018-07-16 13:06
And maybe create mock services with Pact

bethskurrie
2018-07-16 19:59
@minhdoan I actually suggested you ask in the #pact-jvm channel. We try to keep the general channel for non language specific discussion.

bethskurrie
2018-07-16 21:15
:+1:

bethskurrie
2018-07-16 21:17
Given that Pact is generally implemented by developers (pact tests on the consumer side are typically unit tests for the provider client classes) I'm interested to know why you've been doing it? Are the developers not interested? Do they think it's a tool for testers?

michael.follmann
2018-07-16 21:36
has joined #general

kaushalye
2018-07-17 01:23
has joined #general

mr.matt.r.long
2018-07-17 12:42
Hi, I've been POC the rollout of Pact within an enterprise organisation, and have had queries regarding how well Pact (specifically the Broker) can scale. I appreciate that the self hosted Broker is scaled according to it's deployment mechanism and infrastructure. However are there any case studies I could refer to? The numbers quoted are 8000 services using the Broker. My suggestion would be to deploy the broker and monitor it and scale as necessary, but I presume that it wouldn't require huge resources

david.j.smith
2018-07-17 16:13
Has anyone seen a problem where pactbroker retrieves the pacts in reverse order i.e. it treats the oldest as latest?

matt.fellows
2018-07-17 21:20
Have you got sort by date added or sort by a versioning scheme enabled?

bethskurrie
2018-07-18 00:42
If you don't have the "order by date" turned on, it will use semantic ordering. If you are using git shas, it currently will accept them, but give you a strange order.

bethskurrie
2018-07-18 00:42
I've changed it to sort by date by default now.

bethskurrie
2018-07-18 00:59
What version of the broker are you using, what are you using for your version numbers, and what version ordering setting are you using?

david.j.smith
2018-07-18 09:53
Now that I?ve been forced to dig into it, I think we?re on a really old version - will see if we can do an upgrade. The problem is on one particular part of the relationships it?s just picking a weird order. It?s ignoring both semantic version and date. But lemme push for an upgrade before we continue - thanks!

david.j.smith
2018-07-18 09:57
Two questions about the versions: 1. Is there somewhere in the UI that gives you the pact broker version? (we may not have it of course if, as I suspect, we have an older version) 2. What is the latest version of pact-broker? I couldn?t see the latest version number on the git readme?s or wiki? Might have just missed it.

bethskurrie
2018-07-18 10:29
It's in the response headers.

bethskurrie
2018-07-18 10:30
If it's not, it's ooooooold man.

bethskurrie
2018-07-18 10:30
You'll find the current version number in the releases page https://github.com/pact-foundation/pact_broker/releases

bethskurrie
2018-07-18 10:30
2.24.0

msc.consults
2018-07-18 13:39
has joined #general

msc.consults
2018-07-18 13:50
Hi everyone, Has anyone looked into creating a pact for non-HTTP protocols for Java? I have this scenario whereby my providers HTTP Endpoint is a Apache Knox Gateway, which is a passthrough API, thus I ideally need to create contracts with the underlying apps (which are not accessible via a HTTP protocol). I've come across this article: https://github.com/pact-foundation/pact-ruby/wiki/Why-Pact-may-not-be-the-best-tool-for-testing-pass-through-APIs - which points to: https://gist.github.com/bethesque/0ee446a9f93db4dd0697, but this is written in Ruby

kra
2018-07-18 19:22
Hei guys I just saw a Tweet saying: "Oh WSDL is called CDC these days. Déjà-vue" What are your arguments against this?

matt.fellows
2018-07-18 20:12
Can you share the link? Seems like a good conversation starter :grinning:


matt.fellows
2018-07-18 20:49
thanks

matt.fellows
2018-07-18 20:50
OK, here goes

matt.fellows
2018-07-18 20:50
1. Is the concept behind WSDL even a bad thing?

matt.fellows
2018-07-18 20:51
2. Maybe, but we learned, and moved forward to REST - where Swagger and OAS has picked things up

matt.fellows
2018-07-18 20:51
3. CDC is an _approach_ and a _concept_ for API design and evolution, WSDL/Swagger etc. is a definition language for implementing it. You can literally _do both_!

matt.fellows
2018-07-18 20:52
4. CDC actually started _during_ the WSDL days _using_ WSDL as the message exchange format (see https://martinfowler.com/articles/consumerDrivenContracts.html)

david.j.smith
2018-07-18 20:54
As it turns out, my plea to upgrade after your security announcement was heeded, and we were already running 2.20.0 :smile: The issue was the sorting config hadn?t been added. Thanks for the help as always :thumbsup:

matt.fellows
2018-07-18 20:55
So it?s a bit confused to equate the two.

matt.fellows
2018-07-18 21:05
@matt.fellows pinned a message to this channel.

bethskurrie
2018-07-19 02:42
My understanding of WSDLs (correct me if I'm wrong) is that all the consumers have to be working on the same version of the document and that if you make an update (add a field) you have to send out the new wsdl to all consumers, even if they don't care about that field. It may be cdc, but it seems to break postel's law in a very annoying way. (disclaimer, I haven't used WSDLs for maybe 10 years, so I may be mis remembering)

bethskurrie
2018-07-19 02:43
Pact JVM supports message pacts. Have a look at the docs.

bethskurrie
2018-07-19 02:45
Generally speaking, the protocol is irrelevant. You should separate your message handling code from your protocol specific code and then you can just test the contract between the message consumer and the message producer "business logic" classes.

bethskurrie
2018-07-19 02:45
No worries.

matt.fellows
2018-07-19 03:20
Yep, that was one of the main issues with it. You had to synchronise deployments or deploy multiple versions (which wasn't very common)

bethskurrie
2018-07-19 21:23
I love it when I open a pact stackover flow issue from my inbox and people have already answered it better than I could! Thanks pact community! https://stackoverflow.com/questions/51386591/how-and-if-test-syntactic-bad-request-validation-with-pact

matt.fellows
2018-07-19 21:24
yep!!

peeter.ulst
2018-07-20 10:48
has joined #general

peeter.ulst
2018-07-20 10:52
Hi, is there anywhere info on the `free` hosted beta service as in how it will fare in the future - for now it's free but when the beta ends then it's not free any more I assume?

bethskurrie
2018-07-20 10:53
Hi @peeter.ulst the free tear will continue to exist. The paid offering will simply add more features.

bethskurrie
2018-07-20 10:53
The free tear will basically be (as it is now) a hosted version of the open source codebase.

peeter.ulst
2018-07-20 10:54
so there will be no functionality loss compared to current beta?

bethskurrie
2018-07-20 10:54
No

bethskurrie
2018-07-20 10:54
The paid tear will have better auth and improved UI, amongst other things.

peeter.ulst
2018-07-20 10:55
and I can tell my company to keep using the beta as it will be seamlessly upgraded to production version and we can continue using it forever?

bethskurrie
2018-07-20 10:56
Indeed.

peeter.ulst
2018-07-20 10:56
:+1: thank you!

bethskurrie
2018-07-20 10:56
It will not lose any functionality while the hosted product exists.

brentbarker9
2018-07-20 18:23
Should a pact fail if there is additional data coming back from a provider test?

suliu
2018-07-20 21:00
has joined #general

uglyog
2018-07-21 00:11
If the data is important, it should be specified in the pact. Anything not in the pact should be ignored.


liran.tal
2018-07-21 00:21
no, it?s all basically app to app api calls, no mobile. but I think we?re aligned on this now. we do trunk based development so the pact version is indeed the consumer version. I don?t tag the contract with a version number, instead I tag it as either ?dev? or ?prod? depending if it should break the provider?s CI (due to the fact that this contract agreed to be on implemented & in prod)

liran.tal
2018-07-21 00:22
I?ll read about the feature tag names though not sure I want to couple to that

bethskurrie
2018-07-21 03:26
Can you outline the problems for me?

bethskurrie
2018-07-21 03:27
So, the provider verifies the "prod" ones in the build, but not the "dev" ones?

liran.tal
2018-07-21 07:47
it verifies both. ?dev? to check for the progress of its implementation and to check whether they can be really moved to ?prod? tags, and ?prod? for whats already in prod and then it will break the build if they fail.

bethskurrie
2018-07-21 08:27
Tell me about your process for introducing changes.

liran.tal
2018-07-21 08:31
my own team is following TBD. So every dev is creating a fork of the repo. Doing changes in their own branches. Opening a PR and when code review and checks are done it gets merged into the upstream repository?s master branch (there aren?t any other branches). once a merge happens to that master branch the server gets deployed.

liran.tal
2018-07-21 08:31
another team which is working on a legacy code base isn?t yet able to benefit from this workflow so even if they merge everything to a ?develop? branch, it doesn?t get deployed until end of iteration.

liran.tal
2018-07-21 08:32
while for them it?s easier to keep a feature branch on the side, for our fast-paced teams I prefer not to.

kaushalye
2018-07-23 04:58
~Hi folks, Im trying to get the pact provider side working with ``` &amp;lt;verificationType&amp;gt;ANNOTATED_METHOD&amp;lt;/verificationType&amp;gt; ``` ref: &lt;https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-maven&gt; Following the example in the above reference, I defined the .groovy file as follows (ignore the simple return type), which get compiled to .class in the test classpath ``` class VehicleTxnResourcePactTest { @PactVerifyProvider('a processed transaction') String verifyTransaction() { JsonOutput.toJson("some string") } } ``` However I am getting the following complaint ```Verifying a pact between MIRB and IPS - a processed transaction Given transactions are processed No signature of method: au.com.dius.pact.provider.ProviderVerifier.invokeProviderMethod() is applicable for argument types: (java.lang.reflect.Method) values: [public java.lang.String net.nxbos.ips.vehicletxn.resource.VehicleTxnResourcePactTest.verifyTransaction()] Possible solutions: invokeProviderMethod(java.lang.reflect.Method, java.lang.Object)```~

kaushalye
2018-07-23 04:58
Any help is highly appreciated.

kaushalye
2018-07-23 04:58
Side question: What do you expect in the classpath? .class file or a .groovy file ?

kaushalye
2018-07-23 04:59
@matt.fellows / @uglyog :wave: :slightly_smiling_face:

kaushalye
2018-07-23 05:03
and Following is the plugin configuration ``` <plugin> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-provider-maven_2.12</artifactId> <version>3.5.18</version> <configuration> <serviceProviders> <!-- You can define as many as you need, but each must have a unique name --> <serviceProvider> <name>IPS</name> <verificationType>ANNOTATED_METHOD</verificationType> <consumers> <consumer> <name>MIRB</name> <pactFile>/Users/malinda/Code/ips-microservice-vehicle-txn/src/test/resources/pacts/MIRB-IPS.json</pactFile> </consumer> </consumers> </serviceProvider> </serviceProviders> <classpathElements> <classpathElement> target/test-classes </classpathElement> </classpathElements> <pactBrokerUrl/> <configuration> <pact.showStacktrace>true</pact.showStacktrace> </configuration> </configuration> </plugin> ```

uglyog
2018-07-23 05:05
@kaushalye let's move this to the #pact-jvm channel

kaushalye
2018-07-23 05:05
:thumbsup:

matt.fellows
2018-07-23 05:17
Ron is your man I?m afraid - what is _maven_ ? :smile:

matt.fellows
2018-07-23 05:17
j/k but I?ve never done any Pact JVM!

thirumal.net
2018-07-23 05:50
has joined #general

kaushalye
2018-07-23 05:59
I have to use pact JVM *Unfortunately* :smile:

minhdoan
2018-07-23 06:47
I want to build a response with Json format as below: {"value":[ { "attribute": "att1", "url": "/att1" }, { "attribute": "att2", "url": "/att2", "type": "Chemistry" }, { "attribute": "att3", "url": "/att3", "type": "Construction" } ] } I have tried with pact consumer code: .body(new PactDslJsonBody() .minArrayLike("value", 2,2) .object() .stringType("url", "/att1") .stringType("attribute", "att1") .closeObject() .object() .stringType("url", "/att2") .stringType("attribute", "/att2") .stringType("kind", "Chemistry") .closeObject()) But the object() method must have a name: `throw new UnsupportedOperationException("use the object(String name) form");` If using another approach as: .body(new PactDslJsonBody() .array("value") .object() .stringType("url", "/att1") .stringType("attribute", "att1") .closeObject() .object() .stringType("url", "/att2") .stringType("attribute", "/att2") .stringType("kind", "Chemistry") .closeObject()) The format is right, but the actual response body contains more than 3 elements (this is unknown number depends on the test system) in "value" array so verification fails. Could you please help to confirm that the format to build a response as example, whether it is supported in pact V3 or i must wait for the V4? Many thanks and nice day, team! (edited)

matt.fellows
2018-07-23 07:02
Can you please move this to #pact-jvm @minhdoan ?

minhdoan
2018-07-23 07:04
@matt.fellows Is Okie, Matt? But i also want to know that others pact libraries support this format? Please help to clarify!

matt.fellows
2018-07-23 07:08
To my eye it doesn?t look out of the ordinary, and it should be doable

minhdoan
2018-07-23 07:14
@matt.fellows Could you please help on it? Many thanks in advance!

matt.fellows
2018-07-23 07:17
Sorry @minhdoan I?m not across the JVM enough to give you specific advice here. Generally speaking, I would start by paring back your Pact test to just a few elements, and then gradually adding bit-by-bit

minhdoan
2018-07-23 07:18
:+1:

minhdoan
2018-07-23 07:18
Thank Matt for your help!

matt.fellows
2018-07-23 07:19
no worries!

psyrez
2018-07-23 07:26
has joined #general

brentbarker9
2018-07-23 16:36
Ok thank you

jim
2018-07-23 17:58
has joined #general

stan
2018-07-23 22:21
has joined #general

arne.zelasko
2018-07-24 07:00
has joined #general


ng.viet.quynh
2018-07-24 07:38
has joined #general

bethskurrie
2018-07-24 09:30
Welcome to all the newcomers :relaxed:

djrimokbp
2018-07-24 10:23
anyone managed to run pact verifications using MockMvcTarget and a controller having Jersey annotations (Java)?

ng.viet.quynh
2018-07-24 10:32
Hi everyone! And thanks for the warm welcome @bethskurrie :relaxed: Not sure where to put this but I am actually writing my bachelor thesis about contract testing in microservices with Pact and would really really appreciate if someone can share their experience implementing Pact in their own team/project. Since I only have a simple prototype, I would love to hear from you guys who have more seriously and intensively work with Pact. - What have run smoothly and what have been difficult for you? - Did contract testing with Pact become a part of your software development lifecycle? Why or why not? - Do you implement Pact in already developed services or in designing new services? Any opinion would be much appreciated! Many thanks!

bethskurrie
2018-07-24 10:36
@djrimokbp try in the pact-jvm channel.

iain.olliver
2018-07-24 10:45
has joined #general

arunesh.rajak
2018-07-24 14:05
has joined #general

gerrymcgovern
2018-07-24 14:26
has joined #general

mohammed.a
2018-07-24 14:32
has joined #general

bethskurrie
2018-07-25 04:11
Pact users. I need some help with a new Pact feature I'm developing. In the languages you've used, are the terms "wip" or "pending" used? And if so, is there a preference for one or the other? Do they have different implications? The feature I'm trying to describe is "if these pacts fail verification, they won't fail the build". I've used "wip" in the code, but I'm tossing up about the term "pending" instead. I'm not sure which is the most cross-language compatible. Doing a quick google comes up with more results for "pending" than "wip". One reason I went for "wip" was that "pending" implies that it is a failing test, and in this case, it's more that we don't know if they'll pass or fail. Happy to take suggestions if you think you have a more descriptive term.

abubics
2018-07-25 04:17
all the other words that I?d associate with that concept are long :stuck_out_tongue: e.g. incomplete, unfinished, etc

abubics
2018-07-25 04:18
but the associated stigmas for wip are intuitively closer to the right concept than pending for me

timothy.clifford
2018-07-25 04:33
For me it comes down to this: `pending` implies that something is planned, but may not yet have been started/finished; `wip` is something that is currently being worked on, but not yet complete

liran.tal
2018-07-25 06:10
agree with timothy and boris

bethskurrie
2018-07-25 06:46
In ruby, if a test that is marked as `pending` passes, the suite actually fails, so that you are alerted that you need to update your test code. Does this behaviour exist in other languages? (This is _not_ the behaviour that we want for this feature, btw - we want the process to exit with a success code all the time, whether the pact verifications pass or fail.)

bethskurrie
2018-07-25 06:47
/poll "What should I call the 'if these pacts fail verification, they won't fail the build' feature?", "WIP pacts", "Pending pacts", "Other (please suggest below)"

sguisado
2018-07-25 10:54
has joined #general

bethskurrie
2018-07-25 11:57
One things I should add to the above description of the "wip/pending" pacts feature is that once the pact is verified successfully, it ceases to be a wip/pending pact.

can
2018-07-25 11:57
Automagically or by the dev that implements the change?

bethskurrie
2018-07-25 11:58
I'm leaning towards "pending" now, as I think "something that was pending that has now succeed" we kind of assume is now not pending. I'm not sure if the same assumption applies to "wip".

bethskurrie
2018-07-25 11:58
Automagically.

bethskurrie
2018-07-25 11:58
It's then up to the consumer team to decide what to do with that previously pending pact.

niedra91
2018-07-25 11:59
has joined #general


can
2018-07-25 12:03
:pray: Thanks for the reading material!

bethskurrie
2018-07-25 12:04
The suggested process for introducing changes would go: * Provider is configured to verify `master` tagged pacts * Consumer creates git branch, modifies pact tests, publishes pact with tag = git branch * Webhook triggers build of provider * Provider runs verification with `master` and "wip/pending" pact but DOES NOT FAIL if the "wip/pending" pact does not pass * If pact passes, consumer merges in branch, and publishes new pact as `master` * If pact does not pass, people talk.

bethskurrie
2018-07-25 12:07
The "wip/pending" pact verification will be an automatic step in the verification process when retrieving pacts from a broker.

can
2018-07-25 12:11
So I guess on the `If pact passes, consumer merges in branch, and publishes new pact as master` is the step where a WIP pact is converted to a concrete one?

mats.lundkvist
2018-07-25 13:26
Hi, I have an issue with providers test in go with json pact generated in java. My go tests cannot find the state when the json looks like this ```"providerStates": [ { "name": "this is my state" } ]``` which is generated with pact-jvm but when I change to ```"providerState": "this is my state"``` it works. This is the metadata in the json ```"metadata": { "pactSpecification": { "version": "3.0.0" }, "pact-jvm": { "version": "3.5.19" } }``` Does anyone have an idea why it is like this?

antonello
2018-07-25 15:46
has joined #general

bethskurrie
2018-07-25 21:46
@mats.lundkvist because go doesn't support v2 pact specification yet.

bethskurrie
2018-07-25 21:47
The consumer will need to write a v2 pact for you.

bethskurrie
2018-07-25 21:47
Exactly @can

anthony.herman
2018-07-25 22:10
has joined #general

bethskurrie
2018-07-26 01:25
I think in the next release of Pact go, you may be able to use the v3 format, but it will ignore any v3 features it can't understand

niedra91
2018-07-26 07:43
Hi everybody! I?m trying to integrate Pact with a SCIM connector for the needs of a project. The development environment is Java + Maven. I checked out the Workshop project which helped me to understand the integration steps. Using this project and the pact-jvm project, I could successfully write a UT for the connector using Pact Mock Server. I described the Pact using Java 8 Lambda. At this point, I wanna go further and: 1/ Incorporate matchers for the Pact 2/ ?Build? the Pact as json data, as it?s done within the workshop project, but from the Java-8 DSL. I don?t need at the moment to automatically export the generated Pact to the provider through the pact broker. 3/ Test the generated pact against the real provider. I?m kind of stucked here. 1/ I looked in the matchers sub-project of pact-jvm, but could find only Scala or Kotlin classes. Are there any matchers for the Java DSL? Where could I find revelant documentation? 2/ I didn?t see any way to build the Pact in java. Is there a sample maven plugin available? Thanks in advance for your support :slightly_smiling_face: *edit*: copied to #general2

uglyog
2018-07-26 08:59
@niedra91 Are you asking how to define a matcher on an attribute in the Java-8 DSL?

niedra91
2018-07-26 09:00
Yes indeed :slightly_smiling_face:

uglyog
2018-07-26 09:01
There are methods in the DSL (like `stringValue` or `stringMatcher`) that will add the appropriate matcher

uglyog
2018-07-26 09:03
Not sure I understand what you mean by "?Build? the Pact as json data". Do you mean generate the pact file?

niedra91
2018-07-26 09:05
yes indeed

niedra91
2018-07-26 09:06
where could I find the documentation for these methods or the package name so that I could browse it directly into my IDE?

niedra91
2018-07-26 09:13
You mean the methods from PactDslRootValue and PactDslJsonRootValue in au.com.dius.pact.consumer.dsl I guess?


uglyog
2018-07-26 09:15
`PactDslJsonBody` would be the one to look at

niedra91
2018-07-26 09:15
:thumbsup:

niedra91
2018-07-26 09:15
Thanks :slightly_smiling_face:

pikestar
2018-07-26 09:25
has joined #general

pikestar
2018-07-26 09:33
Hello, I'm introducing Pact where I work and am starting with creating unit tests on the front end app - a React app. I'm new to front end development and JS. I have followed the guide on install and setup and have a test written however on running 'npm run pactTest', I get the following error:

pikestar
2018-07-26 09:34
my pactSetup.js lives here: /Users/adampike/web-project/packages/app

pikestar
2018-07-26 09:36
my package.json lives in the same directory and the script is:

uglyog
2018-07-26 09:37
is there a `pactSetup.js` file in /Users/adampike/web-project/packages/app/src?

pikestar
2018-07-26 09:37
No. it seems lke the rootDir is wrong and should be up one level

uglyog
2018-07-26 09:38
oh, yeah, maybe try `--setupFiles ../pactSetup.js`

pikestar
2018-07-26 09:38
ok thanks

pikestar
2018-07-26 09:40
yep worked :+1:

pikestar
2018-07-26 09:40
thanks

nicolas.clertan
2018-07-26 15:58
has joined #general

dipjyotimetia
2018-07-27 04:10
has joined #general

kurst03
2018-07-27 04:31
has joined #general

ashish.dubey91
2018-07-27 07:50
Hi guys. I have a question - is there any way to generate an HTTP client out of a pact definition?

bethskurrie
2018-07-27 07:50
No. Can you explain your usecase?

ashish.dubey91
2018-07-27 07:52
so imagine a consumer defines a contract. as part of the contract it defines how it sends the request. This data is also used by pact-verifier I'm guessing when it builds the requests to the provider for verification. What I want is a method by which I can write an HTTP client that sends this request to the provider

bethskurrie
2018-07-27 07:54
Can you explain more about what you're trying to achieve?

ashish.dubey91
2018-07-27 07:56
sure. I have an Android app which defines a contract test for the backend API at a URL /v1/someapi, with some specific headers. Now I want to write some integration tests for this backend API for which I'd have to make the same request with the same headers. I wondered if I could re-use the contract definition to make this easier

bethskurrie
2018-07-27 07:58
You could easily write some code to parse the file and turn the request definitions into a live request, and then execute each request.

bethskurrie
2018-07-27 07:58
I wouldn't recommend it though.

bethskurrie
2018-07-27 07:59
Contract tests have different aims to functional tests.

bethskurrie
2018-07-27 07:59
And you'd be coupling your functional tests to the requests the consumer defines in the pact file.


bethskurrie
2018-07-27 08:01
Please read the above explanation about the difference.

ashish.dubey91
2018-07-27 08:03
that's true I've read this one. This thought started when we were discussing the possibility to start using swagger for documenting APIs and then being able to easily generate clients for those APIs

ashish.dubey91
2018-07-27 08:05
but it also occurred that we've tried out pact and it seems useful for contract testing so we're definitely going to be using it a lot it seems. And since request definition is quite tight in a contract test (which is also what pact docs recommend) it's quite possible to re-use that metadata to generate these API clients

ashish.dubey91
2018-07-27 08:06
functional tests I agree ideally should be decoupled from these contract test definitions

ashish.dubey91
2018-07-27 08:08
but for folks in the team who might want to play with the API for some reason, I thought these could be useful

antonello
2018-07-27 10:39
Hi all! I have a question / some thoughts around verifying responses by type only, using matchers, and wanting to be more strict for particular fields. If I decorate the whole response body with a `like`, can I then override that and make sure a specific field is verified also by value?

bethskurrie
2018-07-27 12:04
You can override it with a regex, just make it match exactly.

antonello
2018-07-27 12:14
Thanks @bethskurrie. So a `term` matcher nested within a `like` matcher will win, is that correct?

niedra91
2018-07-27 17:32
For those who may have been wondering, the PACT was generated for the last UT to be runned inside the ?pacts? directory of my build directory. Although I had two pacts described, one different in each UT, there were not combined. I guess I need to set one unique PACT with various interactions for the whole Test class instead.

bethskurrie
2018-07-27 23:02
Yes

matt
2018-07-28 21:38
> if these pacts fail verification, they won't fail the build may be a bit late to the party, in JUnit this is called `Ignore`

bethskurrie
2018-07-29 21:32
Ta. I'm not sure if I can call the feature "ignore pacts" though!

bethskurrie
2018-07-29 21:32
"ignore failure pacts" is accurate, but a bit clunky.

antonello
2018-07-30 08:32
Thanks!

mark.bridgett
2018-07-30 12:11
Hey there. Anyone know how I can get my Java provider tests to output the full provider response? I'm trying to debug a failed test and would like to see what my service is sending back that is failing. All I have to go on at the moment is this output which doesn't help much : $.some_property -> [{mismatch=Expected List() to have minimum 1, diff=}]

can
2018-07-30 12:13
Hi Mark! I think the folks over at #pact-jvm might be better equipped to help you :slightly_smiling_face:

mark.bridgett
2018-07-30 12:19
Ahh, i'll try there thanks :slightly_smiling_face:

antonello
2018-07-30 14:17
I had the same issue the other day when I was playing with a failure when using an `eachLike` matcher.

oswald.quek
2018-07-30 16:06
hello. in a pact consumer test, is there a way to manually verify a call to a certain endpoint was called x number of times? use case: calling an endpoint on our consumer service (and passing it an auth token in the header) causes it to call another authentication service (the provider). however we're caching the valid tokens on the consumer service so i want to verify that making calling the endpoint multiple times only causes the authentication service to be called once.

can
2018-07-30 16:11
Hmmm. I'm not an expert at this but that doesn't strictly sound like a contract test. Looking forward to what others say!

oswald.quek
2018-07-30 16:19
well there's a contract between the consumer service and the authentication service for sure

matt
2018-07-30 16:21
maybe "Ignore failures"

matt.fellows
2018-07-30 21:34
Yeah, this is better served with traditional unit tests and not worth Pact.

bethskurrie
2018-07-30 22:22
@mats.lundkvist did you get this sorted?

bethskurrie
2018-07-30 22:22
Did you get a chance to read this @can? I'd love any feedback you have.

bethskurrie
2018-07-30 22:27
@liran.tal I came across a use case that demonstrates why you have to be very careful if you put a build number in the version. If you have a webhook that triggers a provider build when the pact changes, you'll end up building a particular SHA of the provider multiple times. If your provider is both a consumer and a provider, you need to make sure that this build publishes its own pacts when it does the verification, otherwise the "latest" version of the provider will have the verification results, but no pacts. This means that when you come to deploy that version `can-i-deploy` will say "NO!".

jarrodlilkendey
2018-07-31 01:53
has joined #general

richard.jones
2018-07-31 05:49
Hi folks, we?re seeing a very strange pact verification failure here in the Java verifer: https://gist.github.com/richard-reece/85d58d296aa8e4806bd59496a39780d1 - so even though our pact is specifying matching by type, I think the verifier is failing because the values don?t match.

bethskurrie
2018-07-31 05:51
That does not look like that Java verifier

bethskurrie
2018-07-31 05:51
It looks like the ruby one, and it only supports v2

bethskurrie
2018-07-31 05:51
If your pact is in v3 format, it won't work.

richard.jones
2018-07-31 05:52
Oh! Sorry, I?m passing on information second-hand from our Java dev here. I?ll clarify with him?

bethskurrie
2018-07-31 05:52
Hm. The matching rules look like v2.

bethskurrie
2018-07-31 05:54
And I take it back - the verifier output has a slight difference to the ruby.

bethskurrie
2018-07-31 05:54
I didn't realise it copied the output so closely.

bethskurrie
2018-07-31 05:55
There might be a bug in the Java type comparison for boolean

richard.jones
2018-07-31 05:55
Ah, righto.

bethskurrie
2018-07-31 05:56
It should be identifying the pact spec version from the file, but there might be a problem with that.

bethskurrie
2018-07-31 05:56
Also, lets move this to a thread.

bethskurrie
2018-07-31 05:57
Can you see any output that says which pact spec version is being used?

richard.jones
2018-07-31 05:58
I?m asking :slightly_smiling_face:

richard.jones
2018-07-31 06:06
I think the Java dev has gone for the day, thanks for trying to help tho.

bethskurrie
2018-07-31 06:15
Can you make sure they're running the latest version tomorrow (I'm not sure what that is)

bethskurrie
2018-07-31 06:15
@uglyog can probably help you more, but he's stuck in a basement with no reception at the moment!

richard.jones
2018-07-31 06:16
ouch for @uglyog :confused:

imran.khan2
2018-07-31 07:16
has joined #general

imran.khan2
2018-07-31 07:17
Hey folks

imran.khan2
2018-07-31 07:18
I was looking for some help with pact usage in the java ecosystem

imran.khan2
2018-07-31 07:19
Is this the right place for those types of questions?

bethskurrie
2018-07-31 07:22
Best place to ask is #pact-jvm @imran.khan2

imran.khan2
2018-07-31 07:23
Thanks @bethskurrie

can
2018-07-31 07:49
From my discussions internally with @antonello, we'd found it to fit the process quite nicely! His feedback would be most valuable, though.

oswald.quek
2018-07-31 08:49
yeah after sleeping on it last night i think so too. thanks.

uglyog
2018-07-31 09:30
Hmm, that doesn?t look right. You?ll need to enable debug logging to see what is going on

antonello
2018-07-31 10:55
Just to make sure I understand correctly: 1) a WIP pact is a pact tagged with a feature branch name that has not yet been successfully verified (ie. either there are no verification results, or the verification failed). 2) any pact that is tagged as `master` will not be considered a WIP pact and the provider pipeline will fail if the verification fails

bethskurrie
2018-07-31 10:55
`master` is just an example name

antonello
2018-07-31 10:56
ok, it will be configurable

antonello
2018-07-31 10:56
because my next question was going to be what if you want to force build failure for more than one branch (for example `master` and `release_candidate_v1.1.1`)

bethskurrie
2018-07-31 10:56
1 is almost correct - it's the "latest" of any tag that is not configured to be verified by the provider.

bethskurrie
2018-07-31 10:57
Usually, the provider has certain tags it chooses to verify - eg `master` and `prod`. WIP pacts are any that are the latest of their tags that aren't in the set of names the provider has chosen to verify.

antonello
2018-07-31 10:57
right, which answers my question above your last message.

bethskurrie
2018-07-31 10:58
Basically we take the list of all the head pacts that have no successful verifications, and remove the pacts that the provider is about to verify.

bethskurrie
2018-07-31 10:59
The one thing I haven't solved yet is what to do with pacts that never get successfully verified, and will never be verified because they are wrong, or the functionality has been decided not to be implemented.

bethskurrie
2018-07-31 11:00
We either need a clean up function, or the ability to remove them from the WIP set when running the verifications.

antonello
2018-07-31 13:08
I went to a meeting and just caught up with the messages now and I?m still a bit confused. I?ll try to give an example.

antonello
2018-07-31 14:08
In the processing of trying to write an example, I was wondering if it may be a useful feature to be able to specify an additional criterion for a webhook based on a list of tags. In other words, make it possible to only trigger a webhook if a pact with a specific tag (or list of tags) has changed.

antonello
2018-07-31 14:23
If that was possible, you could create a specific webhook so that, if a consumer publishes a changed pact from a feature branch (tagging it as `consumer_branch_1`), the pact can be verified by a specific provider branch, which will only verify pacts tagged as `consumer_branch_1`.

oswald.quek
2018-07-31 14:26
so my team ran into a problem recently, and I would like to check if there is a bug with the pact broker, or if our build pipeline is faulty... 1. we have a consumer service and a provider service, both of which have already been deployed to our test, staging and production environments. versions of both services are tagged with "test", "staging" and "production" respectively. 2. we changed the consumer pact to add more interactions and committed to master branch. (API wasn't changed on the provider service). our master build also automatically deploys to the test environment, but this failed because can-i-deploy said we couldn't deploy. makes sense because at this point there is no provider service deployed tagged with "test" that verifies the new consumer pact. 4. this was resolved by re-building the provider service (which A. pulls the new consumer pact from its master branch B. runs the provider tests and tells the pact broker the new pact is verified and C. sets a new version for the provider) and re-deploying (which tags the provider with "test"). the consumer service could then be deployed. 5. for the staging/production environment however, re-deploying the provider service first failed because can-i-deploy blocked the deploy of the provider service. i guess this is expected because for the new version of the provider, there is a new interaction from the consumer side, even though nothing has changed in the provider. note that do we not re-run provider contracts tests on the staging and production deployment builds. so we have a chicken-and-egg scenario - we can't deploy the consumer, because there's no corresponding provider tagged with "staging/production", but we can't deploy the provider, because there's no corresponding consumer tagged with "staging/production". what's the solution and/or what is wrong with my build pipeline? thanks.

nabrosimova
2018-07-31 17:58
has joined #general

nabrosimova
2018-07-31 18:05
Hi, I am trying to figure out how to do file_upload in ruby. Both provider and consumer are written in ruby. I did see pact-jvm examples with scala. But really need examples of how .i can set it up in ruby

nabrosimova
2018-07-31 20:39
@channel

clasalle
2018-07-31 21:24
has joined #general

matt.fellows
2018-07-31 21:49
@nabrosimova I can see you posting in a few channels here. The Ruby channel is probably the most appropriate place for this. That being said have you read through the FAQ, including https://docs.pact.io/faq#how-do-i-test-binary-files-in-responses-such-as-a-download?

matt.fellows
2018-07-31 21:50
In short, testing the actual body is not a recommended practice (but is possible). You can?t use matchers either.

nabrosimova
2018-07-31 21:55
@matt.fellows see I'm trying to upload file with post request which is a bit different problem than download

matt.fellows
2018-07-31 21:55
What?s the problem/difference?

matt.fellows
2018-07-31 21:56
If we take away the actual binary payload, the problems are quite similar. Our advice would be to set the correct path, mime types etc. and test those, ignoring the specific payload contents

nabrosimova
2018-07-31 21:58
well provider has to receive media, and send back it's id and status. the response part is just text but i need media to make the actual api call on the provider side

bethskurrie
2018-07-31 22:06
@antonello I've been expecting someone to ask for that eventually.

bethskurrie
2018-07-31 22:06
I'll put it on the backlog


bethskurrie
2018-07-31 22:11
@oswald.quek I will sit down and work through your scenario as soon as I have a moment.

richard.jones
2018-07-31 22:23
@uglyog the spec version 2 pact should be compatible, yeah?

richard.jones
2018-07-31 22:24
sorry it?s not in that gist (I didn?t want to paste the entire pact, there?s a dozen interactions in it) but the version is declared at the end ?metadata?: { ?pactSpecification?: { ?version?: ?2.0.0" } }

zb582
2018-08-01 02:27
has joined #general

thirumal.net
2018-08-01 06:20
PACT Verifier Issue

thirumal.net
2018-08-01 06:21
i am able to mock using mock service but when i try to verify the mock against the provider, it is throwing error. instead of mocking total service response, i did mock only one item. can you please help me what might be the issue ? Mocking Code : def test_callAPI (self): url = 'http://localhost:1234' expected = {'class': 'HealthCheck'} pact.given ( 'sending a request to url' ). upon_receiving ( 'class name should match with HealthCheck' ). with_request ( 'get', '/' ). will_respond_with ( 200,body=expected) with pact: result = callAPI ( url ) self.assertEqual ( result,expected )' *Mock JSON* : '{ "consumer": { "name": "consumer" }, "provider": { "name": "provider" }, "interactions": [ { "description": "a request for the health check", "providerState": "the health of the system is OK", "request": { "method": "get", "path": "/" }, "response": { "status": 200, "headers": { }, "body": { "class": "HealthCheck" } } } ], "metadata": { "pactSpecification": { "version": "2.0.0" } } }' *Real Service Provider Response* : '{ "class": [ "HealthCheck" ], "properties": { "timestamp": "2018-08-01T00:10:00+0000", "systemName": "Test", "buildInfo": { "buildDate": "2018-07-27T07:38:19+0000", "appVersion": "1111", "revision": "2 ", "branch": "develop" }, "health": "OK", "checks": [] }, "links": [ { "rel": [ "self" ], "href": " check" } ] }' i am trying to check only one item from real service response .getting below Error when running against real provider : *Failure/Error: expect(response_body).to match_term expected_response_body, diff_options Encoding::UndefinedConversionError: "\xE2" from ASCII-8BIT to UTF-8***

timothy.clifford
2018-08-01 06:28
Um, is it because your real service provider is returning `{ class: [ "HealthCheck" ] ...}` instead of `{class: "HealthCheck"}`?

thirumal.net
2018-08-01 06:40
@timothy.clifford -Thanks, Yes , real service is giving class: [ "HealthCheck" ] so i have changed my mock url = 'http://localhost:1234' expected = {'class': ['HealthCheck']} but unfortunately same error is coming

thirumal.net
2018-08-01 06:44
@timothy.clifford - am i doing correct for just checking only item from real service response , even though it gives 3 items ? Thank you in Advance

timothy.clifford
2018-08-01 06:46
try it with both and see what happens? ¯\_(?)_/¯

matt.fellows
2018-08-01 06:48
@thirumal.net you probably want to use Matchers to match array contents: https://github.com/pact-foundation/pact-python#eachlikematcher-minimum1

matt.fellows
2018-08-01 06:48
If you expect exactly 1 element, but get back 3 it will fail. This matcher says ?I want an array to contain _at least one_ of these types of elements?

matt.fellows
2018-08-01 06:49
that being said, almost certainly there is another problem going on. It seems to be related to encoding.

matt.fellows
2018-08-01 06:50
I suggest we move this to #pact-python where you can get python specific help

thirumal.net
2018-08-01 07:06
@matt.fellows -Thanks, i have changed mock code as you mentioned 'def test_callAPI (self): url = 'http://localhost:1234' expected = EachLike({'class': ["HealthCheck"]}, minimum=1) pact.given ( 'the health of the system is OK' ).upon_receiving ( 'a request for the health check' ).with_request ( 'get', '/' ).will_respond_with (200, body=expected ) with pact: result = callAPI ( url ) self.assertEqual ( result, expected )' after doing this code change two things happened 1) mock was generated 2) even though mock creation successfull, there is error showing in mock it self *AssertionError: [{'class': ['HealthCheck']}] != <pact.matchers.EachLike object at 0x07244E90>*

thirumal.net
2018-08-01 07:07
if i execute the pact verifier same below errors are coming

thirumal.net
2018-08-01 07:07
* 1) Verifying a pact between consumer and provider Given the health of the system is OK a request for the health check with GET / returns a response which has status co de 200 Failure/Error: expect(response_status).to eql expected_response_status expected: 200 got: 403 (compared using eql?) 2) Verifying a pact between consumer and provider Given the health of the system is OK a request for the health check with GET / returns a response which has a matchin g body Failure/Error: expect(response_body).to match_term expected_response_body, diff_options Encoding::UndefinedConversionError: "\xE2" from ASCII-8BIT to UTF-8 1 interaction, 1 failure *

matt.fellows
2018-08-01 07:14
Please avoid posting all of this to general, at the very least keep it contained to a thread. Let?s move it to Pact Python - it?s not something everyone can help with

thirumal.net
2018-08-01 07:20
Sorry @matt.fellows. sure, Lets move to pactpython .i have asked the same question over there .

oswald.quek
2018-08-01 08:44
@bethskurrie thanks. maybe the solution is to have an option to disable can-i-deploy on a deploy of the provider if we know nothing has changed.

bethskurrie
2018-08-01 09:07
@oswald.quek you say "C. sets a new version for the provider" What are you using for your version number? Do you have a build number in there?

bethskurrie
2018-08-01 09:12
Which tags does your provider verify?

bethskurrie
2018-08-01 09:12
Just so you don't have to wait another day for me to reply, I'll give you a couple of potential problems/fixes.

bethskurrie
2018-08-01 09:14
Your provider should be configured to verify `test`, `staging`, `production` (and `master` if that's what you call your main development branch). Also, your version number should not contain a build number. I'll see if I can work out how to explain this.

bethskurrie
2018-08-01 09:18
If you are changing the provider version with every build, but you aren't verifying the test/staging/production pacts with every build, you won't have a verification result that links those versions of the consumer with the latest provider.

bsayers
2018-08-01 09:27
Feel free to direct me to the right place to ask this if in here is wrong: We recently had an incident that spawned a debate on what is and is not the responsibility of Pact to detect. The incident was caused by a client who set the request content type header to ?application/json? (which by default has an encoding of utf-8) but it then encoded the request body using a different charset (ISO-8859-1). When the consumer side tests using pact were run they passed and recorded a pact file, but at this point the charset of the request body had been changed by pact as it saves the body within a utf-8 encoded json file, so we are not able to detect this issue via the pact file. So with green pact tests we deployed and the production provider rejected the requests with a http 400 response. So my question is should Pact be responsible for failing on the consumer side when the requests content encoding and the request body encoding do not match? Or should Pact be recording the requests more precisely (a much bigger deal as changing the pact format is hard)? What is the philosophy on what Pact should and should not be validating?

bethskurrie
2018-08-01 09:29
That's a tricky one. Ideally, I'd like to say Pact could catch that, but we often have issues with anything that's not UTF-8 encoded.

bethskurrie
2018-08-01 09:30
TBH, I thought application/json had to be UTF-8 encoded.

bethskurrie
2018-08-01 09:30
I'm quite willing to be corrected on that though.

bethskurrie
2018-08-01 09:31
I suspect the answer is, it would be great if it could, but it may be too technically difficult.

bethskurrie
2018-08-01 09:32
I don't think you can mix file encodings, so having a ISO-8859-1 encoded body inside a UTF-8 pact file would seem impossible to me.

bethskurrie
2018-08-01 09:33
Maybe we should detect and warn about that scenario.

bsayers
2018-08-01 09:39
I agree detecting it on the provider side via a pact file is difficult, you?d have to find a way of encoding the file without losing the information. I can imagine options where the encoding that was used is saved separately and the pact replay mechanism knows how to reproduce that encoding during verification. What are your thoughts on detecting this on the consumer side? Should pact attempt to detect bad requests based on basic knowledge of http?

bethskurrie
2018-08-01 09:39
If you can suggest some reasonable logic, I'd be ok with adding it.

bethskurrie
2018-08-01 09:40
Could your scenario have been detected on the consumer side though? If it was a default, rather than an explicit encoding?

bsayers
2018-08-01 09:41
In our case the logic that rejected the request came from a framework rather then provider specific code

bethskurrie
2018-08-01 09:42
We could warn "hey, you're using something that's not utf-8 and that's not normal", but there's nothing apart from convention to make that warning on.

bsayers
2018-08-01 09:42
So some generic sever code looked at the request and decided it was invalid

bsayers
2018-08-01 09:44
That might prevent some incidents, although our experience tells us warnings are ignored more often then not.

bethskurrie
2018-08-01 09:44
I agree.

bethskurrie
2018-08-01 09:45
I would never suggest that contract tests can or should be able to identify every integration issue - I think in this case, if you think it's worth trying to come up with a technical solution, we can raise a card for it, or we can say, the effort required for adding this is not proportional to the risk of not having it.

bsayers
2018-08-01 09:50
Ok so your main concerns are around cost and complexity of implementing such checks

bsayers
2018-08-01 09:51
You are ok with the idea of Pact ensuring requests are valid in terms of http in principal

bsayers
2018-08-01 09:51
Have I got that right?

bethskurrie
2018-08-01 09:51
Yes, I think so. Others may disagree!

bethskurrie
2018-08-01 09:51
In principle, I'd like to see encoding faithfully represented, however, I'm unsure of the effort/reward ratio.

bsayers
2018-08-01 09:53
Hmm I see a difference between capturing the request faithfully vs detecting the request is no good up front and just refusing to record it

bsayers
2018-08-01 09:53
Do you have a preference?

bethskurrie
2018-08-01 09:54
Yes - the second one is much easier!

bethskurrie
2018-08-01 09:54
Seeing as you're the first team who has encountered this issue that we know of, I'd say the effort/number of people affected ratio is much better for the second option.

bethskurrie
2018-08-01 09:57
Gtg, but can chat more later.

matt.fellows
2018-08-01 11:08
hi all, I?d like to announce that I?ll be in the US later this year for re:Invent: - San Francisco: 19th-24th November - Las Vegas: 25th Nov - 1st Dec (re:Invent) The plan is to get to a few meetups in SF and also to run some hands-on workshops. If anybody would like to catch up, attend a workshop or digitally hangout in a local timezone, please DM me - I?d :heart: to chat! (P.S. I?m one of the core contributors and are in constant comms with other core contributors, in case you were thinking ?who the **** is that guy??)

hstene
2018-08-01 11:16
Very cool!

mats.lundkvist
2018-08-01 15:26
@bethskurrie right now we're doing it manually but I'll have a look after my vacation, thank you for the help :)

oswald.quek
2018-08-01 15:37
when I say "C. sets a new version for the provider", I lie! it's just the git commit sha of the latest commit. in this case, it happens there were new commits (non-API related) on the provider side.

oswald.quek
2018-08-01 15:41
actually, i'm not sure why step 4 worked for me. even though i rebuilt the provider here, i'm not sure how can-i-deploy gave it the green light for the provider to be deployed? (we're asking the pact broker whether we can deploy the provider where the tag is "test")

oswald.quek
2018-08-01 15:46
because when i rebuilt the provider (which runs the provider tests), it fetches the consumer pact where tag is "master" and presumably publishes verification where the tag is "master". so I don't know how it got deployed to the test environment, because we're asking can-i-deploy whether we can deploy the provider where the tag is "test"

oswald.quek
2018-08-01 15:47
when you say my provider should be configured to verify `test`, `staging`, `production` and `master` should that be happening in step 4 where I run the provider build?

balthasarbiedermann
2018-08-01 18:28
has joined #general

tushar.gavhane
2018-08-02 04:05
has joined #general

bethskurrie
2018-08-02 07:13
Yes.

bethskurrie
2018-08-02 07:13
That's your problem.

bethskurrie
2018-08-02 07:14
If you only verify master, then there is no verification result between the current test, staging or production consumer versions.

bethskurrie
2018-08-02 07:14
So can I deploy will return false.


oswald.quek
2018-08-02 08:36
yes that makes sense! thanks for all your help.

bethskurrie
2018-08-02 08:37
Np

fatih.kuyucuoglu
2018-08-02 09:35
has joined #general

fatih.kuyucuoglu
2018-08-02 10:06
Hi all, I have a question about the @PactFilter annotation. I need to run a method after a specific state in provider test. In my case the only way to do this is separating the test states in different test classes and using @After annotation for that specific state. Anyway, to get this behaviour, I use the @PactFilter. Everything works fine, but the verification results are not published, I get this message "Skipping publishing of verification results as the interactions have been filtered". Is it possible to publish the verification results of filtered states? If I can not publish the verification results, what is the goal of @PactFilter annotation? Thanks in advance for your support :slightly_smiling_face:

shekharsp27
2018-08-02 10:37
@fatih.kuyucuoglu are you using latest version of pact?

fatih.kuyucuoglu
2018-08-02 10:47
Hi Shekhar i am using the version, which is https://github.com/DiUS/pact-jvm here given as latest. So: Version 3.5.19

uglyog
2018-08-02 10:47
The provider states support a teardown call, which will be invoked afterwards. But it is not implemented for JUnit. Maybe raise an issue for this.

uglyog
2018-08-02 10:58
If the test execution is filtered, the verification results will not be published. This is because the verification status is for the entire pact file.

fatih.kuyucuoglu
2018-08-02 11:05
Hi uglyog thanks for the quick answer. :slightly_smiling_face: Could you give me some clue, starting point, i would like to try to find a solution for that. I will create also an issue.

balthasarbiedermann
2018-08-02 12:30
I'm planning to implement a Kotlin DSL for Pact. My current proposal is in the #pact-jvm channel: https://pact-foundation.slack.com/archives/C9UN99H24/p1533212507000007 *Feedback is very much appreciated*

mark.bridgett
2018-08-02 14:10
Anyone here use the pact-stub-server much?

matt.fellows
2018-08-02 21:10
I use it, what's up?


uglyog
2018-08-02 22:55
It will need to change to support a teardown call afterwards

sethimudit2002
2018-08-03 06:35
has joined #general

fatih.kuyucuoglu
2018-08-03 09:59
Thak you for the answer, i will look at this.

cparrish
2018-08-03 18:42
has joined #general

liran.tal
2018-08-05 18:03
I only put a build number in the version to transfer the pact contract from the unit/integration testing phase to the CI which needs to pull it again from the broker for E2E, when that?s done the contract with the build number as version becomes useless and I tag it as ?development? or ?production? and the consumer?s version which is semver (i.e: 2.1.0). any webhook triggers I will have will only work on the ?development? and ?production? contracts which use actual consumer version, never a build version.

liran.tal
2018-08-05 20:36
where-as the recommended pattern on the consumer side is to create the contracts during unit testing of the consumer?s http client implementation, I wonder what is the recommended approach on doing API testing on the consumer side (think `supertest` or `spring test mvc`) ? anything else beyond just mocking the http client call at that phase ?

dhanarajvallabhuni
2018-08-05 20:54
has joined #general

bethskurrie
2018-08-05 23:10
I think the answer is "whatever works for your situation". I've worked on MS where we didn't mock anything, and other services where we provided mock implementations of certain classes, and others where we used standard mocking frameworks.

david.dyke
2018-08-06 06:30
has joined #general

sgarvey
2018-08-06 11:22
has joined #general

tcanascimento
2018-08-07 14:28
has joined #general

emre.duendar
2018-08-07 14:35
has joined #general

joshua.haney
2018-08-07 15:39
has joined #general

liran.tal
2018-08-07 19:26
to clarify, when I said API testing I referred to integration tests (not e2e test for the server-side). - when you say one option was to not mock anything do you mean you used CDC to make a real request and return stubbed responses? I?m thinking that I can re-use the same mocks that will be used for the unit test in the integration tests.

conallbennett
2018-08-07 22:12
has joined #general

rabih
2018-08-08 09:16
has joined #general

rabih
2018-08-08 09:23
Hello, I am using pact for contract testing for our microservices built in golang. I have added some integration tests in a consumer and added build integration tests to CircleCI. I am using hosted pact broker http://pact.dius.com.au. The issue is that the tests are running without updating the contracts in the broker. Any help regarding this issue or any one have worked with integrating pact with CircleCI :question:

antonello
2018-08-08 09:25
I imagine your code is explicitly publishing your pacts?

rabih
2018-08-08 09:39
after adding the interactions, yes I am publishing pacts with the pact broker settings

antonios.klimis
2018-08-08 09:41
has joined #general

rabih
2018-08-08 10:53
ci config : service-integration: <<: *defaults environment: PACT_BROKER_HOST: ?https://.http://pact.dius.com.au/? PACT_BROKER_USERNAME: ?? PACT_BROKER_PASSWORD: ?? steps: - checkout - setup_remote_docker - run: name: Authenticate with GCR command: | docker login -u _json_key -p ?${}? https://eu.gcr.io - run: name: Create source volume command: | docker create -v ${CIRCLE_WORKING_DIRECTORY} --name source alpine:3.7 /bin/true docker cp ./ source:${CIRCLE_WORKING_DIRECTORY} - run: name: Running integration tests command: CONTAINER_NAME=service-integration make integration - run: name: Copying integration test results command: docker cp service-integration:${CIRCLE_WORKING_DIRECTORY}/test/. ./test - store_test_results: path: ./test destination: test - store_artifacts: path: ./test destination: test

antonello
2018-08-08 12:02
What do your logs say when the tests run?

rabih
2018-08-08 12:22
Consumer: ^@^@Running tests: === RUN TestGetTriggers --- PASS: TestGetTriggers (0.00s) === RUN TestGetTriggerByID --- PASS: TestGetTriggerByID (0.00s) === RUN TestGetTriggerByStatus --- PASS: TestGetTriggerByStatus (0.00s) === RUN Test_pactTriggerControlConsumer_CreateTriggerEvent --- PASS: Test_pactTriggerControlConsumer_CreateTriggerEvent (0.00s) === RUN Test_pactTriggerControlConsumer_TriggerCancelledEvent --- PASS: Test_pactTriggerControlConsumer_TriggerCancelledEvent (0.00s) === RUN Test_pactTriggerControlConsumer_TriggerDeletedEvent --- PASS: Test_pactTriggerControlConsumer_TriggerDeletedEvent (0.00s) === RUN Test_pactTriggerControlConsumer_TriggerErroredEvent --- PASS: Test_pactTriggerControlConsumer_TriggerErroredEvent (0.00s) === RUN Test_pactTriggerControlConsumer_TriggerFailedEvent --- PASS: Test_pactTriggerControlConsumer_TriggerFailedEvent (0.00s) === RUN Test_pactTriggerControlConsumer_TriggerCompletedEvent --- PASS: Test_pactTriggerControlConsumer_TriggerCompletedEvent (0.00s) === RUN TestPactProvider --- PASS: TestPactProvider (0.00s) PASS ok

rabih
2018-08-08 12:23
provider: ^@^@Running tests: === RUN Test_pactTriggerControlProvider_Verify --- PASS: Test_pactTriggerControlProvider_Verify (0.00s) PASS ok

matt.fellows
2018-08-08 12:28
Can you please share your test code? You need to explicitly set the verification to true

matt.fellows
2018-08-08 12:32
When you say "not updating in the broker" what do they mean. Contracts aren't being published from the consumer? Verification status not updating from the provider?

rabih
2018-08-08 12:43
both, contracts are not being updated or published and the verification status not updated

rabih
2018-08-08 12:59
req := types.PublishRequest{ PactURLs: []string{filepath.ToSlash(fmt.Sprintf(?%s/triggerconsumer-controlprovider.json?, pactDir))}, PactBroker: os.Getenv(?PACT_BROKER_HOST?), BrokerUsername: os.Getenv(?PACT_BROKER_USERNAME?), BrokerPassword: os.Getenv(?PACT_BROKER_PASSWORD?), ConsumerVersion: ?1.0.0?, Tags: []string{?latest?}, }

rabih
2018-08-08 12:59
pact.VerifyMessageConsumer(t, message, triggerCompletedHandlerWrapper) p := dsl.Publisher{} err := p.Publish(getRequest())

codypumper
2018-08-08 13:10
has joined #general

liran.tal
2018-08-08 13:10
@rabih on the consumer side, I advise to only do contract testing for unit testing the http client

rabih
2018-08-08 13:13
we are using it also for Message Queue integration testing

liran.tal
2018-08-08 13:17
MQ or HTTP, you probably want to unit test both. do you create the contracts through unit tests or integration tests ?

rabih
2018-08-08 13:20
through integration tests

liran.tal
2018-08-08 13:21
can you share more on how you do integration tests? are you actually hitting some endpoint to trigger the flow?

rabih
2018-08-08 13:22
when testing it without CI it is working, when the CircleCI build runs it is not


liran.tal
2018-08-08 13:26
that doesn?t say much about how you are actually running and what you?re doing in integration tests. the problem is in the terminology - people mean different things when they say integration testing.

liran.tal
2018-08-08 13:27
regardless though, my input for you would be that you might be hitting 2 different providers in a single integration test flow and I noticed that this complicate and couples the flow

smuthaiah
2018-08-08 16:42
has joined #general

mbudde
2018-08-09 08:46
has joined #general

richard.hulm
2018-08-09 09:13
has joined #general

rabih
2018-08-09 15:24
the issue is resolved, by adding pact cli tools in the docker image

rabih
2018-08-09 15:24
however, I am getting this issue now unable to convert consumer test to a valid JSON representation: error creating message: exit status 127 STDERR: /go/lib/ruby/bin/ruby: line 6: /go/lib/ruby/bin.real/ruby: No such file or directory STDOUT:

rabih
2018-08-09 15:27
however, I am getting this issue now unable to convert consumer test to a valid JSON representation: error creating message: exit status 127 STDERR: /go/lib/ruby/bin/ruby: line 6: /go/lib/ruby/bin.real/ruby: No such file or directory STDOUT:

bethskurrie
2018-08-09 21:57
@rabih please ask questions about pact-go in the #pact-go channel.

bethskurrie
2018-08-09 21:59
Also, if you can provide a executable example, you will get better help.

such.su
2018-08-10 07:37
:wave:Does anyone know whether pact-python provides a matcher for matching or ignoring an object key?

bethskurrie
2018-08-10 08:26
In the consumer or provider?

bethskurrie
2018-08-10 08:27
You must specify all keys on the consumer side, and any key you don't specify will be ignored on the provider side.


such.su
2018-08-10 09:25
To be accurate, my question is exactly the same as this one - https://stackoverflow.com/questions/48317108/pact-python-matching-keys-in-response

bethskurrie
2018-08-10 11:49
This is not yet supported in python.

gergia
2018-08-10 17:06
has joined #general

davidmichaelkarr
2018-08-10 18:05
I haven't done much with pact-jvm yet, but I have a question about the json pact file. Our team has a different convention for the name of the pact file, and they've designed this somewhat messy AfterClass method that they want everyone to put in their tests, to rename the file. Is there a cleaner way to do this?

uglyog
2018-08-11 03:18
You can override it in code by extending the Pact model class. There is no configuration for the filename.

gaurav
2018-08-11 11:34
In defining mock for `BigDecimal`, I set type as decimal: `.decimalType("amount", new Decimal(100))`.. but on provider side (I am using mockMvc), it fails with `$.result.parent.0.child.0.amount -> Expected 100 to be a decimal number`. I am pretty sure that on provider side, `amount` in model is `BigDecimal` type. Should I set different type in mock definition? Anything I am doing wrong? Thanks.

gaurav
2018-08-11 13:11
Stacktrace for :point_up:

gaurav
2018-08-11 14:28
Changing to `numberType` worked!

simon.nizov
2018-08-12 09:00
has joined #general

liran.tal
2018-08-12 14:16
is it possible to define multiple responses (meaning they span across multiple requests made) for a single interaction? the purpose is to test API interactions like pagination or continuation tokens

liran.tal
2018-08-12 14:17
admittedly this is probably more of an internal test where I?d just mock the entire request entirely but having them on the same test suite (both mocking the request being made as well as not mocking it and doing an actual request to CDC) feels awkward a bit

liran.tal
2018-08-12 14:18
probably best practice is to mock this internally, let me know if you feel otherwise

antonello
2018-08-12 14:52
@liran.tal IMHO - even if you were able to specify multiple request/responses for one interaction with pact - it wouldn?t be a good idea. I?m not sure if this is what you mean when you say ?mock internally?, but I would simply have separate interaction and use the provider state for each one to make sure that you set up the state in the provider so that it returns what you need in each case.

liran.tal
2018-08-12 15:14
that?s what I?m saying too basically.. it?s more about testing internal handling (the consumer ms) of bulk requests. Not sure though what you meant about the provider state, because basically this is a single test case.

antonello
2018-08-12 15:19
Could you give an actual scenario of what the test is just to make sure I understand unambiguously?

antonello
2018-08-12 15:28
To me it sounds like you want to test a session in a single test.

liran.tal
2018-08-12 15:37
yeah of course. the use-case is where my provider has an API to get a list of items but I can?t request more than 10 in one request, so if I want to request 20 item ids I need to split that to sending 2 requests of 10.

antonello
2018-08-12 15:43
How different is the second request from the first one? I assume both responses will have the same contract.

liran.tal
2018-08-12 15:46
exactly. that?s why I?m saying it?s probably an internal logic test for the consuming microservice

antonello
2018-08-12 15:54
If the two requests are different though, there may be a case for some contract testing. It?s difficult to say without an actual example.

liran.tal
2018-08-12 16:52
while I see that query param arrays are supported through `query: { ids: ['1', '2'] }` which translates to `/someapi?ids=1&ids=2` is it possible to specify a query param array list with the [] notation? i.e: `/someapi?ids[]=1&ids[]=2` ?

bernardo.guerreiro
2018-08-12 19:43
has joined #general

wilkin4
2018-08-12 19:56
has joined #general

david.j.smith
2018-08-12 20:17
Scala-Pact versions `2.2.5` (SBT 0.13.x) and `2.3.2` (SBT 1.x) released. http://io.itv.com/scala-pact/change-log.html

bethskurrie
2018-08-13 00:03
Nice work @david.j.smith

bethskurrie
2018-08-13 00:05
Hm. With which implementation @liran.tal?

bethskurrie
2018-08-13 00:05
Anything that wraps the ruby expects array param names to have square brackets at the end.

lindblad.n
2018-08-13 07:26
has joined #general

liran.tal
2018-08-13 07:59
I?m referring to the javascript/node implementation. maybe @matt.fellows knows more about how to specify an array for the `ids[]=1` type of notation

such.su
2018-08-13 08:30
Got it. Thanks.

matt.fellows
2018-08-13 11:33
Ah, there was an issue with this. I?ll dig it up

liran.tal
2018-08-13 11:35
ahh thanks

liran.tal
2018-08-13 11:35
for now I just hardcoded `query: 'id[]=1'` but would like to find a fix for it which allows me to dynamically compose the query with use of matchers


matt.fellows
2018-08-13 11:36
It might not be obvious, but the `eachLike` matcher works here - it?s an array too!

matt.fellows
2018-08-13 11:36
so something like ``` describe.only("get /dogs using builder pattern", () => { before(() => { const interaction = new Interaction() .given("I have a list of dogs") .uponReceiving("a request for all dogs") .withRequest({ method: "GET", path: "/dogs", headers: { Accept: "application/json", }, query: { param: eachLike("1"), }, }) .willRespondWith({ status: 200, headers: { "Content-Type": "application/json", }, body: EXPECTED_BODY, }); return provider.addInteraction(interaction); }); ``` should work

liran.tal
2018-08-13 11:37
not quite. this will create an expected interaction of query being like `param=1&param=2` which will not be compatible with my request using square brackets: `param[]=1&param[]=2`

liran.tal
2018-08-13 11:37
unless I?m mis-reading that issue (it?s quite long so maybe I missed something)

matt.fellows
2018-08-13 11:41
Hmm, let me doubl check this

matt.fellows
2018-08-13 11:47
you?re right.

matt.fellows
2018-08-13 11:47
so if you want the array notation, you can do this: ``` query: { 'param[]': eachLike("1"), }, ```

liran.tal
2018-08-13 11:56
thanks! I?ll try and will add to my to do list to update the docs and code examples for it

nathanrobert.smith
2018-08-13 12:34
has joined #general

matt.fellows
2018-08-13 13:16
That?d be amazing, thanks!!

amitojduggal
2018-08-13 14:47
has joined #general

antonello
2018-08-13 15:58
Hi all! One of the ?buts? that it?s often brought up when I talk to people about pact is: ?_But how do you make sure that the responses that you expect are up to date? What if you forget to add a field that you?ve recently started consuming?_? My usual answer is ?_There is no guarantee that you won?t forget, but it?s like adding any other type of test. If you forget to write a test for a specific scenario, you won?t be covered for that. It?s a matter of discipline, mixed with code inspections such as code reviews_?. However, I can understand why it may be useful to have some kind of mechanism to help you catch cases in which you forget to update your expected responses. The only way that I can think of, if for example you are lucky/unlucky enough to have some functional tests that mock provider responses, is to use the same responses for those tests and for your consumer pact tests. I am playing in my mind with the above idea and it would be very simple to achieve if your expected pact responses were json objects (which will certainly be if you?re using `pact-js`). However, it gets a little more complicated if you?re using matchers, in which case you would have to perform some kind of _reification_, similarly to what?s done here: https://github.com/pact-foundation/pact-support/blob/master/lib/pact/reification.rb What do people think? Any reason why it may be a bad idea? Finally, should we want to port the reification logic, would you have recommended approaches?

liran.tal
2018-08-13 16:31
I hear you but I think your response to that was well put. Pact doesn't protect you from forgetting and it's not its goal and I'm concerned you might be complicating it too much if you'll try to do it

harris.osserman
2018-08-13 16:54
has joined #general

david.j.smith
2018-08-13 17:04
@antonello To go to the original question: ```"But how do you make sure that the responses that you expect are up to date? What if you forget to add a field that you've recently started consuming?"``` If you?re testing your client code correctly in your consumer tests**, and verifying the pacts against the provider? this should not be possible? (** This might be easier in a statically typed language because you would typically deserialise into a real Type, which is a way of proving that all the fields you expect are indeed there? - perhaps that?s what you meant by reification?)

antonello
2018-08-13 18:35
@david.j.smith That makes complete sense, it?s what the documentation recommends, but, as you say, it?s not easy in JavaScript, if at al possible. You may need to go quite high up the stack to actually have a degree of certainty, which would be impractical and make the tests quite complicated.

can
2018-08-13 18:39
Hey @antonello - As you know, my mission here is to Kotlin everything. Though I haven't used Kt/JS interop, it might make testing JS a little easier?

antonello
2018-08-13 18:41
It is the language of the application code that matters. Unless the front-end teams decide to re-write them or parts of them in kt, it probably won?t help. Typescript has started to be used though, which will help in the long term.

antonello
2018-08-13 18:46
Talking about js consumers, in order to test them you probably end up repeating mocked responses a lot. So having a way of removing the repetition and the pain of having to update responses in multiple places when they change would be something positive, imho. For the same reasons you?d want to use builders in strongly typed languages.

codypumper
2018-08-13 20:31
Our team has been able to use Typescript to define a type, then create an "expected object" of that type (letting the linter check for properties/types). Then, before creating the interaction, we take that expected object, and loop through its properties to apply the matchers and create yet another object which then gets passed to the Pact interaction.

antonello
2018-08-13 21:01
Interesting! Would you be able to provide an example?

abubics
2018-08-14 02:05
The pattern I use (and recommend) is to have a connector that converts the api client model (on-the-wire data model) into a application domain model, and asserting that it has the right shape and types in the Pact test. This lets Pact focus on the transport verification (in `given` and `when`), and the unit test focus on domain verification (the `then` part).

abubics
2018-08-14 02:06
How strict you want to be about types, etc, is up to the application developers. You can use typescript of flowtypes or whatever if you want better safety :slightly_smiling_face: All these concerns should be decoupled

paul.davies
2018-08-14 03:31
has joined #general

paul.davies
2018-08-14 04:18
Hi all, I'm pretty new to Pact and have checked the Stack Overflow but no luck with my problem. I'm having an issue with a Date query parameter which is handled by a DateTime argument resolver at runtime. When debugging my application I can hit the endpoint with this command: GET http://localhost:9090/plan/master/active?from_start_date=2018-08-01T22:00:00.000Z and I can see the date has been correctly interpreted, however when I run my Pact Provider test, which has this in the Pact contract:

2018-08-14 04:18
This message was deleted.

paul.davies
2018-08-14 04:18
~The date comes through as null~

bethskurrie
2018-08-14 04:19
Hi @paul.davies You'll get more focussed help if you ask in the channel for your language.

paul.davies
2018-08-14 04:19
Ah right, thanks. It'll be Java - I'll post there. Cheers!

antonello
2018-08-14 06:04
@matt.fellows What are your thoughts on this?

antonello
2018-08-14 08:06
@david.j.smith By reification in this context, which is what the class in the link does, I mean taking a body with matchers and transform the matchers into a response body without matchers.

simon.nizov
2018-08-14 08:18
Hi! Newcomer here. This project looks incredible so far :smile: I noticed that there is a LOT of useful ?theoretical? information present in the pact-ruby github wiki that I feel should be in the general docs at http://pact.io. For example, took me a while before I found this: https://github.com/pact-foundation/pact-ruby/wiki/Provider-states which was very helpful to understand how provider verification works. I realize this probably happened because the ruby project was the first to be developed. Is there a plan to move this into the general docs? I can help out with the dirty work if someone can guide me on where to put things.

bethskurrie
2018-08-14 08:42
Hi @simon.nizov you're right about the ruby project having the documentation first, but most of it should have been migrated. For example, here are the provider state docs https://docs.pact.io/getting_started/provider_states

bethskurrie
2018-08-14 08:42
If there are things missing, please do let us know so we can move them. Always happy to accept PRs for improving the docs.

simon.nizov
2018-08-14 08:48
Ahh.. weird that I missed that one. I?ll keep an eye out, thanks!

david.j.smith
2018-08-14 09:03
Interesting. I had a similar idea ages ago? thanks for the description!

antonello
2018-08-14 09:09
That is exactly what?s done when a pact file is written. The matchers are stripped out, replaced by an example and matchers sections added to the pact json.

amitojduggal
2018-08-14 11:38
Hello guys, want to know what scheme or workflows everyone is using for the service that is being consumed by the UI interfaces and not by another service. For example, Provider: P Consumer: UI Interface. So the provider tests will be kept in the codebase for "P" but what about the Consumer Test, which service repository should those be kept in? if its an app. Should those be kept as part of android/ios code base?

matt.fellows
2018-08-14 12:24
Tests belong with their code

matt.fellows
2018-08-14 12:26
That's a good starting point unless you have a good train not to

matt.fellows
2018-08-14 12:28
Help is always welcome though, and that website is fully managed in GitHub. If you see small things feel free to send a PR but for big things maybe have a chat in #documentation first

simon.nizov
2018-08-14 12:30
Already did a couple of days ago :wink: https://github.com/pact-foundation/pact.io/pull/58

simon.nizov
2018-08-14 14:52
Is there a way to share matchers between services? Imagine you have domain-specific rules that you?d like to use as matchers across multiple services, written in different languages. For example, the ID of a quote must start with ?Q-?.

codypumper
2018-08-14 14:56
Sure! Our metadata call tests call that responds with our "MetadataRes" type: ```// Metadata for SS35538_35538_29885250, "If the Color Changes" const expectedMetadataObject: MetadataRes = { 'title': 'If the Color Changes', 'category_name': '', 'icc_profile_loc': null, ... } // We want to use Pact to verify the types of the properties on the response let matcherMetadataObject = {} Object.keys(expectedMetadataObject).forEach( (key) => { matcherMetadataObject[key] = Matchers.somethingLike(expectedMetadataObject[key]) })``` Where `expectedMetadataObject` is a sample object of that form. And in this case we're testing the form of the top level properties on the response, so we loop through the values, and add matchers for each one to `matcherMetadataObject`, which is then used in: ``` willRespondWith: { status: 200, headers: { 'Content-Type': 'application/json' }, body: matcherMetadataObject }```

codypumper
2018-08-14 14:58
The `MetadataRes` type is used for this response within our app, so expectations of properties are pretty solid and consistent

codypumper
2018-08-14 14:59
@simon.nizov Something like a shared Regex library could handle that pretty well?

simon.nizov
2018-08-14 15:00
What if the services are written in different languages?

antonello
2018-08-14 15:06
:thumbsup:

antonello
2018-08-14 15:13
@codypumper if you?re applying a `somethingLike` to all properties, why not just decorate the whole object with `like`?

sandeep.seshadri
2018-08-14 15:18
has joined #general

matt.fellows
2018-08-14 22:52
:ok_hand:

dagarwal
2018-08-15 06:42
Hi ,is it possible to create interactions in JS like this ?matchingRules?: { ?$.query.var1[0]?: { ?match?: ?regex?, ?regex?: ?.*? }, ?$.query.var2[0]?: { ?match?: ?regex?, ?regex?: ?.*? },

dagarwal
2018-08-15 06:42
what should i pass in var 2 that my two api calls are successful


dagarwal
2018-08-15 06:43
Is it possible to do by provider states?

abubics
2018-08-15 06:44
If you?re trying to do it in JS, try in #pact-js :slightly_smiling_face: you?ll get better answers

dagarwal
2018-08-15 06:44
Thanks

abubics
2018-08-15 06:44
also, try and post code wrapped in back-ticks, e.g. ```

codypumper
2018-08-15 16:27
Is there a way to pass an object to like()? I see that I can give it a list of properties, and I could iterate through properties similarly, but based on the docs, I can't just `Matchers.like(expectedMetadataObject)` and expect type matching for properties

codypumper
2018-08-15 18:39
Using ".like()" on the object results in: ```"matchingRules": { "$.body": { "match": "type" } }``` in the Pact. I'm assuming this is top level only? As in this would only verify that the body is an _object_ type

codypumper
2018-08-15 19:14
Say you have two different object forms that come back from the same endpoint, but via different IDs. ID1 returns an object with audio metadata, and ID2 returns an object with message metadata. Would the Pact assumption be to match for the combination of all available properties on ID1 object and ID2 object?

codypumper
2018-08-15 19:15
:thinking_face:

codypumper
2018-08-15 19:19
It's ugly, but I was imagining a shared file of regex strings essentially

codypumper
2018-08-15 19:19
¯\_(?)_/¯

antonello
2018-08-15 20:30
That is my understanding. That if you do it on the whole object, all properties will be matched by type. I can?t check the docs now, but I remember @bethskurrie also confirming.

antonello
2018-08-15 21:12
> Note that you can wrap a like around a single value or an object. When wrapped around an object, all values and child object values will be matched according to types, unless overridden by something more specific like a term.


david.dyke
2018-08-15 23:03
I've had a similar situation, the way I've gone about it is to write the unit tests of my consuming application to run through handling both of these scenarios, first it will make a call to ID1 and process that response, then make a call to ID2 and process that one. The Pact mock will provide these differing responses as my tests run. The validation at a provider level will require it to respond differently for ID1 and ID2 with the correct objects, for this you need to use providers states which will be along the lines of "ID1 is an object with audio data" and "ID2 is an object with message data"... the consumer sets these states in the Pact so that the provider knows how to setup its state before running the validation. Thus for validation of the provider, ID1 should return one kind of response and ID2 should return another

davidkgp
2018-08-16 14:37
has joined #general

codypumper
2018-08-16 18:38
Thanks @david.dyke! That makes sense, and I hadn't considered using states

codypumper
2018-08-16 18:42
Thanks for the reference Anto!

leomayleomay
2018-08-16 19:29
has joined #general

leomayleomay
2018-08-16 19:34
I am trying to setup Pact for test like ``` Pact.service_consumer 'Authentication Service Consumer' do has_pact_with 'Authentication Service Provider' do mock_service :authentication_service_provider do port 1234 end end end ``` and got an error saying ``` Failure/Error: mock_service :authentication_service_provider do port 1234 end RuntimeError: Port 1234 is already being used by Authentication Service Provider #<Pact::MockService::App:0x007f874ef487b0> ``` please help to advise what's going wrong here, cheers

matt.fellows
2018-08-16 22:02
Looks like you are starting multiple services on the same port

pburls
2018-08-17 08:33
has joined #general

pburls
2018-08-17 09:02
Hey, I was wondering if anyone has used Pact Contracts and Pact Broker to help capture a "to-be" architecture for a new project? I like the idea of teams using the Pact Broker as a reference to start and then slowly creating and validating contracts with the actual implementations.

rrosa
2018-08-17 09:24
has joined #general

david.j.smith
2018-08-17 09:47
I?ve thought about it. The relationship visualisations - currently amazing to most people - would need to be cleverer. Also the ?problem? with Pacts is that they only show the aspects on a API that a consumer cares about. If it?s a microservice architecture that?s likely fine because they probably care about all of it, but if there?s a monolith in there somewhere your documentation would have holes in it. We do write Pacts in advance of services being built for a) stubbing in leu of a real service and b) a TDD style validation point for the team doing the provider service build. This means we have the relationship in pact broker before it?s ?real?.

pburls
2018-08-17 10:19
True, there would be holes where there are monoliths, but generally there is one team maintaining those. So in terms of them understanding new interactions with other services, it would be fine.

pburls
2018-08-17 10:20
It's good to hear though that creating Pacts in advance isn't a crazy idea.

pburls
2018-08-17 10:22
How are you creating these new Pact Contracts though? Hand cranked or creating some kind of prototype unit test to generate it?

matt.fellows
2018-08-17 10:50
I?ve used it a few times to describe potential designs with other teams (green fields / new items only). Obviously it?s a shallow ?architecture? as it only shows which systems communicate with each other - it doesn?t show types of communication, queues, other systems in context

david.j.smith
2018-08-17 11:52
The scenario for us has typically been: A supplier up stream is going to build us a new API. We discuss the design and when we think we?ve got it, we put together a project that will become our consumer service and just write the Pact tests first. Once generated, the Pact contracts can be sent over to make sure both parties have the same expectations for the new API.

pact-box
2018-08-17 19:53
has joined #general

pact-box
2018-08-17 19:56
I need to spin up an HTTP server for every provider test in Golang (1.0.0-beta). I can do this easily enough using provider states but then how do I tear it down when each test is complete?

pact-box
2018-08-17 21:51
I no longer need an answer but Slack won't let me delete the above message.

matt.fellows
2018-08-17 22:23
All good, it can linger. I don't think you can delete after a certain time

richarddalziel
2018-08-18 21:22
has joined #general

richarddalziel
2018-08-18 21:25
Hey folks - Looking for some help. I'm using PactJS with Karma+Jasmine in my Angular project. I'm essentially following this sort of style - https://github.com/paucls/task_list_ui-angular/blob/feature/pact-consumer-contract-tests/src/app/tasks-list/tasks.client.pact.spec.ts It worked fine when i just had one spec file - but since i've got many services i've started spinning up several of these files. Ever since i've done this i seem to get a lot of incosistent failures on my CI Builds

richarddalziel
2018-08-18 21:26
It's hard to tell - but it seems like the issue relates to specifying "new PactWeb" more than once. But i can't figure out how to maintain it's lifecycle with Karma and Jasmine the correct way and can't find any examples online with more than one spec file

richarddalziel
2018-08-18 21:27
I get a consistent spam of 500s in my terminal for mocked interactions which is fairly annoying. That's possibly a symptom to the issue. I get these even if the tests are passing

uglyog
2018-08-19 02:44
moved to #pact-js

richarddalziel
2018-08-19 09:34
Ah apologies - didn't notice!

pau
2018-08-20 10:52
has joined #general

tonimellodic
2018-08-20 15:05
has joined #general

ted.chung
2018-08-20 20:52
has joined #general

richarddalziel
2018-08-21 07:26
What's the correct way to manage queries based of resource Id when Id is not known? Do you normally just setup seeded defaults with Ids for this or is there a smart way to chain tests together?

abubics
2018-08-21 07:51
"chaining tests" sounds like you're trying to test behaviour :slightly_smiling_face: that's not the intended usage

abubics
2018-08-21 07:52
Each test should encapsulate its own state (using the `given` keyword, usually), and not interact with other tests

richarddalziel
2018-08-21 07:55
It does in my head too (Lead to behaviour) - which is what brings me to the question. There are many "GetById" or children creation tests which base off Id where i care about the contracts too. How should these Ids be handled within the tests?

abubics
2018-08-21 08:39
could you elaborate on that? I'll try and give you a general example in the meantime . . .

abubics
2018-08-21 08:41
Say you have a test that expects an entity with some particular seed data in it, you might just specify a provider state as "a user with some foos and bars", which describes the situation abstractly, but then the consumer and provider know which specific data can be expected to exist

abubics
2018-08-21 08:42
so maybe given *a user with some foos and bars*, you can do a `GET /user/3` for a result of `{"id":"3","foo":["x","y"],"bar":["a","b","c"]}`, or whatever you need to be able to assert on

richarddalziel
2018-08-21 08:44
Here's a series of interactions i'm thinking of in RPC style GetAllClients - returns all clients with required schema. (_Links, _embedded etc) GetClientById (HTTPGET "/client/{Id}") - Returns Client with _Links/Other Props CreateChildForClient (HTTPPOST "client/{Id}") - Returns 201 Created and Whatever Body

abubics
2018-08-21 08:46
Someone else might be better at helping with that kind of scenario . . . I tend to stick to ReST APIs. What I can say, though, is while you stick to requests with no side-effects, you can chain as many as you want and still reason about the system :slightly_smiling_face:

abubics
2018-08-21 08:46
So you can chain many read-only requests before finishing on the thing you care about (which may have side-effects)

abubics
2018-08-21 08:48
But also, if you set your state up well, you don't need to do the first 2 GETs, because you can know which IDs they'll have ahead of time.

abubics
2018-08-21 08:48
and each test can just exercise one endpoint at a time

richarddalziel
2018-08-21 09:51
Apologies - i'm only using RPC terminology for convenience of writing here. I suspect the answer is more about setup my state. The detail that's tricky here is that i use Guids for my Ids. So i can't make any assumptions - i need to feed data returned from one call to the next. Which means the contracts are going to be test-run specific

richarddalziel
2018-08-21 09:59
How do you normally go about setting up your state @abubics?

abubics
2018-08-21 13:36
Maybe we need to step back a little... How much of your provider stack are you trying to verify? If you don't stub/replace at least the data layer, you'll have pretty complicated tests :)

abubics
2018-08-21 13:38
For the example you gave, I'd have at least 3 separate tests: 1. List clients (given some clients, given no clients, etc) 2. Get client details (given a client with known id, given no clients (e.g. returns a 404)) 3. Create a child for a client (given a client with known id, etc)

abubics
2018-08-21 13:39
And in the provider you need to facilitate the states by providing expected data somehow. How you do it depends on the provider platform.

abubics
2018-08-21 13:41
My example implies 3 endpoints, at least 2 provider states, and 5 separate tests (one interaction per test) ^_^

richarddalziel
2018-08-21 14:40
That's pretty much along the lines of the tests i'm thinking - i suspect the sticking point in my head is i'm creating restrictions by not having a representative data seed scenario. I think what i need to do is have a representative data seed scenario which can be used specifically for contract testing with known ids, that sounds like it'll be a cleaner solution than faffing with behaviour style tests.

richarddalziel
2018-08-21 14:41
The only counter in my head here is that this implies the consumers have some prior knowledge as to how the provider seeds data for testing scenarios. I do like the idea of the consumer not really caring how the provider goes about their business, just that they adhere to the specified contract.

richarddalziel
2018-08-21 14:55
Just to touch on your first point - i want to test as much of my provider as the consumer uses. If the consumer cares about hateos links, then i want it in the contract. If it cares about x, y, z properties - i want it in the contract. Same goes for any relevant headers etc

richarddalziel
2018-08-21 14:55
It just so happens in this case i have a consumer which uses the API fairly extensively

thirumal.net
2018-08-21 19:58
can we write pacts if project is written in C++ ? if yes can you please point me to the link for more info

matt.fellows
2018-08-21 21:30
Not to my knowledge sorry!

matt.fellows
2018-08-21 21:32
But you could run the mock service (consumer) and provider externally to your service. E.g. https://github.com/pact-foundation/pact-mock_service/blob/master/script/example.sh


nmalinip
2018-08-21 23:23
has joined #general

abubics
2018-08-22 00:41
My question about "how much" was more about how far down your provider protocol stack are you trying to test. So, if you have a strongly layered stack, you might have web-framework endpoints at the entry point, a business layer with controllers, entities, gateways, etc, and connectors to talk to databases, etc.

abubics
2018-08-22 00:42
You certainly wouldn't want to test across another network boundary (e.g. database), and I'd suggest even going past the core entity layer isn't so valuable.

abubics
2018-08-22 00:43
You're right that the consumer shouldn't care *how* the provider does things (such as allocate IDs), but at some point, the consumer will cache an ID for a future request. That's the situation you want to represent with the "given" states.

abubics
2018-08-22 00:44
i.e. pretend you already did a request to list all Clients. Now you have some IDs, and you can do either of the other requests.

abubics
2018-08-22 00:46
Pact tests are more for verifying the shape of the data, not the concrete content. Things that are part of the request can be verified as literals in the response. Anything generated in the provider should be flexibly matched (by type and/or regex), so the tests aren't brittle.

abubics
2018-08-22 00:50
And yeah, we basically share fixture expectations across consumers and providers.

richarddalziel
2018-08-22 10:38
It's funny - in any of my diagrams for representing this i never include the full stack (To Database). But my current setup has this! I'll need to dig around a bit for how to setup the Given states/caches and see how i can leverage them! I'll be honest - this is a bit more of a faff than i'd hoped. There is a temptation just to mark my own homework here with unit tests on the API. The additional effort is feeling simpler than the state management for theses tests

bherrera
2018-08-22 17:05
has joined #general

bsolosy
2018-08-22 17:08
has joined #general

jkoropchak
2018-08-22 17:23
has joined #general

thirumal.net
2018-08-22 18:41
@matt.fellows - Thank you for the info, i think same applies to languages like SAP ABAP,SFDC APEX,BW . am i correct ? unable to find any documentation for above languages.just want to re confirm that we can't write native pacts for above programming languages.

tmok01842
2018-08-22 21:46
has joined #general

matt.fellows
2018-08-22 21:49
correct

tmok01
2018-08-22 22:02
hey all - does there exist an equivalent .net version of the can-i-deploy feature (which checks the matrix to determine whether things can be deployed)? (just left this query in the pact-net channel as well)

matt.fellows
2018-08-22 22:07
hmm not sure. It should be on the system somewhere (as the CLI tool will be there). If it?s in a predictable path, you could just invoke it directly (it?s what I do with node, for example)

tmok01
2018-08-22 22:18
'k, thanks Matt

bethskurrie
2018-08-22 22:29
You can use can-i-deploy from the command line in windows @tmok01

thirumal.net
2018-08-22 22:45
Thank you Matt

tmok01
2018-08-22 22:55
Ok - thanks @bethskurrie. I'm just starting out on this stuff.


abubics
2018-08-23 00:58
The shallowest version of contract testing I've done just stubbed responses at the controller layer :slightly_smiling_face: Especially if your DB makes it hard to be deterministic, there are heaps of ways to avoid it. Otherwise you're just building integrated tests with the wrong tools :stuck_out_tongue:

abubics
2018-08-23 01:04
And the highest technical value of contract tests is literally unit tests for the network interface. Unit tests for your API won't keep consumers and providers in sync. That's the main thing Pact aims to solve?letting you know if it's safe (or not) to deploy changes.

richard.jones
2018-08-23 04:56
@bethskurrie I?m struggling to find that pact best practices document you wrote and shared a while back, please hit me with the clue bat? :slightly_smiling_face:

abubics
2018-08-23 05:03
is it the "The steps to reaching Pact Nirvana" doc?

richard.jones
2018-08-23 05:25
I think so!

richard.jones
2018-08-23 05:25
Yep, that got me to it, thanks!

richarddalziel
2018-08-23 06:37
I pretty much agree 100% with what you're saying. I think there still is an element of state that needs to be considered. But it doesn't need to be considered with the full stack behind it. Like what Ids generate not found, which generate bad request and all the other variations (if they matter to the consumer).

abubics
2018-08-23 07:09
Yep, totally. The states are test fixtures that are shared (to some extent).

dev
2018-08-23 07:19
has joined #general

komalahluwalia06
2018-08-23 07:21
has joined #general

scott.jungers
2018-08-23 14:30
has joined #general

dniles
2018-08-23 16:23
Hello - I'm trying to find a way to hook into the rest call during a pact provider verification task in order to get a response body, is this possible? My scenario is that the provider verification creates a resource when it makes a call, and the provider responds with the ID of the newly created resource. I want to be able to get the ID from that response to do clean up in the tear down step of the provider state, but as-is I'm unable to access the response from the verification task's rest call at that point. I'm using the Ruby pact-provider-proxy gem to run the provider verification. Thanks in advance for any insight anyone might have.

thirumal.net
2018-08-23 19:10
@matt.fellows - by chance do you know any future plans to support for C++ ?

matt.fellows
2018-08-23 20:50
No plans that I'm aware of, although we do have a set of static libraries that can be linked in from c, so it's entirely possible without having to write it from scratch


nmalinip
2018-08-23 20:53
versions used in my project are 'au.com.dius:pact-jvm-consumer-java8_2.12:3.5.16' 'au.com.dius:pact-jvm-consumer-junit_2.12:3.5.16'

tmok01
2018-08-23 22:41
Um - did Pact Broker just go down?

bethskurrie
2018-08-23 22:41
Let me check

tmok01
2018-08-23 22:42
seems up again now - but was getting 'service unavailable' on a couple of requests

bethskurrie
2018-08-23 22:42
Test one is up, pm me your broker domain

bethskurrie
2018-08-23 22:45
We're currently working on a new multi tenant architecture, which we should be moving customers to over the next few weeks. It will be much more stable than the existing infrastructure.

amitojduggal
2018-08-24 09:22
Guys, what strategy you use for formatting the PactDslJsonBody code blocks in IntelliJ?

richarddalziel
2018-08-24 11:02
For whatever reason i can't seem to find anything in the docs. Is there much documentation around the usage of states aside from just specifying them in Given/Object based setups? I've only ever seen the text referenced but never what the underlying components that represent the state? Perhaps i'm over complicating the capability - but if i'm not then i don't really understand the purpose of state.

bethskurrie
2018-08-24 11:29
It's up to the provider team to set up the right data so that the actual response matches the expected response.

bethskurrie
2018-08-24 11:29
The simplest example is to set up an object so that you get a 200 instead of a 404.


richarddalziel
2018-08-24 13:34
Ah!!! The first post is what i've been looking for. That makes sense ! So in terms of team culture - the correct behaviours here will to be name states fairly explicitly such that the provider team can react to the failing test by reading the provider State and providing the necessary information

richarddalziel
2018-08-24 13:35
So for example State('the object with the id Guid.Default()' exists)

chaitralikulkarni84
2018-08-24 14:38
has joined #general

krosenbaum
2018-08-24 16:00
has joined #general

ayodaiken
2018-08-24 19:08
has joined #general

thirumal.net
2018-08-24 20:16
@matt.fellows - Thank you very much!

nmalinip
2018-08-24 23:17
Hey guys, is there a way to delete the pacts from pack broker? How do u handle the pacts that will be published with every PR?

matt.fellows
2018-08-24 23:18
Yes there is. Go and check out the pact broker wiki, your answers await..

nmalinip
2018-08-25 00:06
Thanks Matt. But I wanted to know if we delete the individual pacts? The delete api in the doc says that the all the pacts related to that participant will be deleted

matt.fellows
2018-08-25 00:12
You can, everything is a resource so just fire off a delete at it


bethskurrie
2018-08-25 02:42
I've updated to make it super clear.

nmalinip
2018-08-25 05:01
Thanks Beth

abubics
2018-08-27 01:41
This is totally a #pact-jvm question, but here you go :slightly_smiling_face:

abubics
2018-08-27 01:41
``` .willRespondWith().run { headers(contentTypeHeaders) status(200) body(newJsonBody { container -> with(container) { minArrayLike("accounts", 1) { with(it) { stringType("id", "S01-01") stringType("name", "Access Account TestOne") stringMatcher("type", "savings|investment|loan", "savings") numberType("availableBalance", BigDecimal("5.00")) numberType("currentBalance", BigDecimal("5.67")) } } } }.build()) } ```

abubics
2018-08-27 01:41
that's in Kotlin, I don't have a strategy for Java :stuck_out_tongue:

abubics
2018-08-27 01:42
You can go more abstract or more concrete for different levels of brittleness :stuck_out_tongue:

abubics
2018-08-27 01:43
But I try to keep mine pretty vague, and just describe the situation, so things can be added without changing expectations

jarpit
2018-08-27 06:53
has joined #general

minhdoan
2018-08-27 07:07
Hi @bethskurrie and team,

minhdoan
2018-08-27 07:12
I downloaded the Pact standalone executables 1.54.3 and extracted it on my local Windows 10 laptop

minhdoan
2018-08-27 07:14
And i put an directory of pact json files here as well

minhdoan
2018-08-27 07:17
Then i run the command to bring up the server and load the pact files to server

minhdoan
2018-08-27 07:17
```pact-stub-service.bat "D:\pact\bin\pacts"```

minhdoan
2018-08-27 07:17
But the error happens and am not familiar with Ruby to debug it

minhdoan
2018-08-27 07:19
Could you please help on it?

minhdoan
2018-08-27 07:19
Many thanks in advance!

minhdoan
2018-08-27 08:12
As i change the command line to: ```pact-stub-service.bat "D:\pact\pacts\*"```

minhdoan
2018-08-27 08:12
No error but i can not confirm that the Server is up

minhdoan
2018-08-27 08:25
And please help to provide some examples for pact-stub-service usage

matt.fellows
2018-08-27 10:00
It?s like it?s not reading the files from a directory, and is expecting a single file

matt.fellows
2018-08-27 10:01
OK so the stub service doesn?t expect a dir, it expects one or more files as space separated values

matt.fellows
2018-08-27 10:02
`pact-stub-service ~/development/public/pact-js/examples/e2e/pacts/*` works on linux shells, because `*` is automatically expanded into the right shape

matt.fellows
2018-08-27 10:02
so looks like you need to do something more like `pact-stub-service.bat "D:\pact\pacts\PACT_FILE1_HERE" D:\pact\pacts\PACT_FILE2_HERE" ...`

minhdoan
2018-08-27 10:16
@matt.fellows Many thanks! When i add each file's path the server is up

minhdoan
2018-08-27 10:17
But anyway to import all of files on Windows because that way quite weird and quite to handle

matt.fellows
2018-08-27 10:22
It?s probably quite easy in Powershell, I can?t recall the syntax off the top of my head though

matt.fellows
2018-08-27 10:23
If you like, raise a feature request at https://github.com/pact-foundation/pact-mock_service

minhdoan
2018-08-27 10:28
Highly appreciate @matt.fellows I will work on it

matt.fellows
2018-08-27 10:31
:thumbsup:

kimmig.alex
2018-08-27 13:23
has joined #general

rsaccoll
2018-08-27 13:26
has joined #general

richarddalziel
2018-08-27 15:31
It's just where things go round to accessing specific resources by their Id. Vagueness becomes a problem there although i'd very much appreciate it!

richarddalziel
2018-08-27 15:31
Managed to get up and running better with it - cheers for the help folks!

ashish.dubey91
2018-08-27 21:17
getting `/app/pact-stub-server: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory` on running pact stub server docker container https://github.com/pact-foundation/pact-stub-server

matt.fellows
2018-08-27 21:18
Are you running in an Alpine Docker container?

matt.fellows
2018-08-27 21:19
Have you looked at the existing published Docker container

ashish.dubey91
2018-08-27 21:20
I just pulled the latest as mentioned in the README

ashish.dubey91
2018-08-27 21:20
I didn't build my own container

matt.fellows
2018-08-27 21:21
Hmmm

matt.fellows
2018-08-27 21:22
Can you please raise a bug report? I should be able to look later today

ashish.dubey91
2018-08-27 21:22
sure @mr.matt.r.long


matt.fellows
2018-08-27 21:27
Are you also on a Mac? I wonder if something in the host runtime as changed.

matt.fellows
2018-08-27 21:40
Cc @uglyog looks like latest stub server missing static or runtime dep

uglyog
2018-08-27 22:36
@ashish.dubey91 I added TLS support in that release. Use the previous version until I fix the docker image.

uglyog
2018-08-27 22:36
Or you can create your own docker image and add openssl libraries

matt.fellows
2018-08-27 22:39
I can take a look today if you like @uglyog?

matt.fellows
2018-08-27 22:40
Assuming it just needs some ssl libs in the image itself? Or does it need to be compiled into the Rust code?

uglyog
2018-08-27 22:47
No, just add openssl to the image

pavan.tallapragada
2018-08-27 23:10
has joined #general

thirumal.net
2018-08-27 23:42
@thirumal.net - i have spring mvc rest application and it doesn't have any test cases. could you please help us how to write pact unit test cases for provider ? please point us to sample example

mpasumarthy
2018-08-28 00:24
has joined #general

matt.fellows
2018-08-28 01:21
OK just pushed the fix, let me know how you go @ashish.dubey91

bethskurrie
2018-08-28 02:13
What documentation have you looked at already? Where have you searched? What have you googled? Please demonstrate that you have tried to solve the problem yourself.

abubics
2018-08-28 04:27
Pretty sure `cmd` globs files with `*` too :thinking_face:

matt.fellows
2018-08-28 04:28
probably, but I?m not willing to stake my reputation on it :slightly_smiling_face: (or to admit i?ve used CMD before)

shreekanth.6
2018-08-28 09:09
has joined #general

chitl
2018-08-28 12:30
has joined #general

ashish.dubey91
2018-08-28 14:58
thanks man! I'll check

ashish.dubey91
2018-08-28 15:00
I'm noticing an issue in my CI setup with pact involving the hosted pact broker. here is how it is - with pact-jvm and gradle plugin I'm pushing my pacts with the branch name as the tag

ashish.dubey91
2018-08-28 15:00
when I fetch the pacts from this url `/pacts/provider/API/consumer/android/latest/dev` I get the latest pact published from *any* branch rather than specifically `dev` branch always

ashish.dubey91
2018-08-28 15:01
because of this my provider build fails because of unstable contracts pushed in feature branches of the consumer

matt.fellows
2018-08-28 21:05
:+1:

mpasumarthy
2018-08-28 22:17
Hi, I am looking for sample pact project built on spring mvc from provider side. could someone please provide link here

matt.fellows
2018-08-28 22:20
What have you tried so far? A cursory google turns up a bunch of links

mpasumarthy
2018-08-28 22:26
I am actually developing using the steps provided in the below link. https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-spring

tjones
2018-08-29 04:14
So I'm writing some consumer code for an API that I don't control (GitHub's OAuth2.0, for those playing at home). Is there value in writing pact tests for the consumer?

tjones
2018-08-29 04:15
My gut feel is yes - even if there's no provider verification, the tests provide some documentation and some regression protection

bethskurrie
2018-08-29 04:15
:shrug::skin-tone-3:

tjones
2018-08-29 04:15
And, possibly it's possible to use something like the pact/swagger thing to do some pretend verification?

tjones
2018-08-29 04:16
I don't remember seeing this question in the documentation, but it seems worth including

tjones
2018-08-29 04:16
I think there was a stackoverflow question on it a while back

bethskurrie
2018-08-29 04:16
sure, if there's a swagger

matt.fellows
2018-08-29 04:17
I still write pact tests as a consumer for the same reasons. I?ve also previously done some ~nasty~ not-so-nice things to validate them also


tjones
2018-08-29 04:19
What were your not-so-nice things? Validate responses against the live API?

bethskurrie
2018-08-29 04:46
Yeah. I don't like to do that.

bethskurrie
2018-08-29 04:46
Swagger would be better.

matt.fellows
2018-08-29 04:49
Pretty much, except when you start thinking about ?provider states? this gets very hard when you can?t control the endpoint. I?ll say ?proxy? and let your imagination do the rest :slightly_smiling_face:

mpasumarthy
2018-08-29 05:03
~Following the below steps and created a provider for validation. <https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-spring> when I try to test pact with state something like {id} does not scenario i.e. 404 error against get end point which accepts integer path variable like this somepath/{id}, seeing the below exception {"@timestamp":"2018-08-28T21:52:48.114-07:00","app_env":"no","app_name":"no","app_version":"no","thread_name":"main","level":"ERROR","logger_name":"com.aligntech.ids.services.patients.error.ApiResponseExceptionHandler","message":"Exception was handled for web request: ServletWebRequest: uri=/api/somepath/9643628244167;client=127.0.0.1","stack_trace":"org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.lang.Integer'; nested exception is java.lang.NumberFormatException: For input string: \"9643628244167\"\n\tat org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:131)\n\tat org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:124)~

mpasumarthy
2018-08-29 05:04
~not sure this is a valid question or not, but how this mock data id generated "9643628244167"~

mpasumarthy
2018-08-29 05:10
please never mind about my question..

abubics
2018-08-29 05:28
If you're only doing JVM stuff, I'd recommend starting in #pact-jvm, rather than adding noise in #general :slightly_smiling_face:

oliver.levett
2018-08-29 08:36
has joined #general

amit.koparkar
2018-08-29 13:23
has joined #general

shekharsp27
2018-08-29 14:22
Hi, is there any graphical representation for 'The steps to reaching Pact Nirvana' document which will help to understand ideal way to implement pact test in CI/CD

raido.letterbox
2018-08-29 14:45
Hi, I am trying to write consumer tests with pact for dotnet core. After enabling SSL for MockProviderService the test fails with "System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure". I've seen in the documentation that it is recommended to ignore certification validation errors globally due to a selfsigned certificate by adding ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; But unfortunately this didn't help. Can anyone please suggest what else can be done?

mpasumarthy
2018-08-29 16:08
@abubics thanks..I did not know about it..will join in that group. thanks..:)

ypeng1
2018-08-29 16:53
has joined #general

ypeng1
2018-08-29 16:56
Consumer test worked on windows but not on linux, can anyone help with this issue?

matt.fellows
2018-08-29 21:15
Might want to ask this in #pact-jvm

tjones
2018-08-30 01:43
Hi Shekhar - I thought there was one in the documentation at http://pact.io, but I can't see it. I'll look into making one.

shekharsp27
2018-08-30 04:53
Thanks, Tim :+1:

madhukar.mishra
2018-08-30 06:04
Hi, is it possible to represent non-heterogenous arrays in pacts ?

bethskurrie
2018-08-30 06:10
Currently, only if you have a set order

madhukar.mishra
2018-08-30 06:32
Thanks, any docs I could look up to understand what my options are ?

madhukar.mishra
2018-08-30 06:32
here's my problem in more detail if you have time to take a quick look


david.dyke
2018-08-30 06:44
This is a recent document I put together to explain interaction between consumer, provider, swagger hub and a pact broker, work in progress but it's helping people to understand

abubics
2018-08-30 08:22
Try in #pact-net :slightly_smiling_face:

uglyog
2018-08-30 08:32
`call site initialization exception` is probably a result of a serious mismatch with your setup. Can you provide the OS version, Java version, Pact-JVM version etc.

dev
2018-08-30 09:07
Hi, we are currently using pact a little bit to test contracts between services of different teams. The documentation notes that the tests should never break the build of other teams. How do you integrate the execution of the tests in the CI process? Running the consumer tests and publishing the contracts shouldn't be an issue to do it on every master build. But then should the provider test be run? And against which version of the contracts? We had the idea to run the provider tests every night against the current master contracts. If a test is failing the team of the provider should look into the issues and try to figure out how they can work together with the consumer team to fix the issue. What do you think, is this a good way, or do you have better ideas?

raido.letterbox
2018-08-30 09:58
Thank you :slightly_smiling_face:

richard.jones
2018-08-30 23:32
@dev I can?t speak for everyone but we have a separate test plan that just runs the verifier for each provider. The plan is maintained by the team owning the provider. It is triggered automatically by any pact being registered against the provider in the pact broker. The latest plan result is then listed against any PR for the provider (since it?s not the build for the PR it doesn?t prevent any specific PR from being merged, it?s just in your face when you review the PR). All the results are also visible in the pact broker per consumer/provider version pair. The latest verification result is also reflected in our grafana dashboard, which gives us a nice heads up that something needs attention.


abubics
2018-08-31 01:48
Ideally, you should make the provider verify every time a Pact changes

abubics
2018-08-31 01:48
but there are some strategies for how exactly you do that, depending on your architecture, app layout, and component lifecycles

abubics
2018-08-31 01:49
For example, one way is to have matching feature branch names on the consumer and provider, and only verify results for pacts tagged with the branch name.

bethskurrie
2018-08-31 01:55
@uglyog is there anything in v3 that can help with this?


bethskurrie
2018-08-31 02:00
@madhukar.mishra Pact really works best when you are able to control the data on the provider so that the responses look like you expect. If you're having trouble with this, Pact might not be the best tool for you.

l.vetter
2018-08-31 09:16
has joined #general

shekharsp27
2018-08-31 10:02
Thanks David for sharing the image will go through it

romuald.quantin
2018-08-31 10:33
has joined #general

shekharsp27
2018-08-31 14:07
@tjones I have a question, in case if Provider is changing the interface and before deployment observes there are breaking consumers, in this case ideally provider should do versioning for interface(and convey consumer about the interface version for backward compatibility and ask to update consumer as per new interface ) and move ahead with the deployment how this workflow should work could please help me to understand

brice.jaglin
2018-08-31 14:18
has joined #general

abhijitkane
2018-08-31 18:25
has joined #general

ashish.dubey91
2018-09-02 12:56
this is happening when I try to run pact-provider-verifier with `--publish-verification-results=1` ``` Error making request - Errno::EPIPE Broken pipe , attempt 3 of 3 /pact/lib/vendor/ruby/2.2.0/gems/pact-1.33.1/lib/pact/provider/verification_results/publish.rb:99:in `rescue in publish_verification_results': Failed to publish verification results due to: Errno::EPIPE Broken pipe /pact/lib/ruby/lib/ruby/2.2.0/openssl/buffering.rb:326:in `syswrite' (Pact::Provider::VerificationResults::PublicationError) ```

ashish.dubey91
2018-09-02 16:02
I think this was because my provider return a massive response and it was too much for the CLI to post the results to the broker..didn't know it actually sends the entire verification log

oswald.quek
2018-09-03 08:43
The way my project does it is by running the pact against a checked out provider master branch during the consumer CI build

pact-slack
2018-09-03 12:29
has joined #general

pact-slack
2018-09-03 12:43
Hi :wave: My elixir pact library (http://github.com/elitau/pact_elixir), which is wrapping the pact-reference Rust implementation works for simple cases. Now I want to extend it towards the generation of matchers like regexp, type, query params, etc. What is the best way to achieve this? I assume I have to "copy" the DSL of the Ruby implementation in Elixir?!

dev
2018-09-03 15:15
@abubics Thank you, that document really helped a bit.

andyharkinsqa
2018-09-03 15:34
has joined #general

dev
2018-09-03 16:24
We had lately a discussion going on belonging how much of the service should be tested when running pact tests. What do you mock on consumer/provider side? As much as possible or as few as possible?

tom.hombergs
2018-09-03 16:33
has joined #general

richard.jones
2018-09-03 21:55
@dev pact isn?t testing the provider or the consumer, it?s enforcing a contract between them. On the consumer side pact mocking *aids* testing of the consumer code at that interface. Pact verification tests exactly enough of the provider that is needed to verify all pacts are correct. Does that help?

mboudreau
2018-09-03 23:49
@dev As however many contracts makes your team happy and confident in the deployment. It could be only a few (more like a health check) or all of them if you're super keen on 100% coverage :slightly_smiling_face:

richard.jones
2018-09-04 00:20
We have 100% coverage in our consumer unit test suites, and use pact mocking for all external API points (as opposed to more generic mocking for other parts of the code). Using flexible pact mocks (having Like and Term in the requests) makes that a lot easier.

abubics
2018-09-04 00:29
It sounds to me like @dev's question is more about depth (of app layers) rather than breadth (of endpoint, features, error cases, etc) . . . I would argue that Pact tests should go only as deep as the minimum required to get to logic that provides enough branching for errors. It depends on your app architecture. On the *provider* side if you had a clean architecture, with a framework-based endpoint layer, and a domain interface beyond that, that should be deep enough to provide thorough value. On the *consumer* side, with a similar architecture, I'd expect a framework-based API client, and a domain interface before it. Definitely don't need to go higher up the protocol stack to test the contract :slightly_smiling_face:

abubics
2018-09-04 00:30
I've done shallower and deeper, and they felt like suboptimal trade-offs

uglyog
2018-09-04 00:31
That's awesome. I would start by creating a DSL that works best for the language, and then work out how to implement it.

uglyog
2018-09-04 00:32
If we need to change the Rust implementation, I can do that for you.

stephen.muss
2018-09-04 04:57
has joined #general

dev
2018-09-04 06:55
Thanks a lot!

dev
2018-09-04 07:00
And one more question. Does anyone have a reference or experience how I can implement a "many providers and one consumer" scenario? We have a single service that consumes an analytics message which can be send by every other service, how does that work?

ibenardetelevis
2018-09-04 07:05
has joined #general

mboudreau
2018-09-04 07:08
1 consumer can have multiple contracts with each provider, and 1 provider can have multiple contracts with each consumer :slightly_smiling_face:

pact-slack
2018-09-04 07:37
Ok. I'll come back here for feedback once I have something useable.

rhys
2018-09-04 10:30
has joined #general

pact-slack
2018-09-04 21:15
@uglyog Is there a Rust library that I can call to generate all the different matching rules? Or a codebase which I can use as a starting/learning point for generating pact files with matching rules?

joguespermana
2018-09-05 02:55
has joined #general

ashish.dubey91
2018-09-05 07:54
can pact-provider-verifier verify multiple consumer pacts for a given provider? If I supply a URL like - `/pacts/provider/authservice/tag/dev` to the verifier, the verifier doesn't traverse through the list of pacts and verifier

bethskurrie
2018-09-05 08:15
It should

bethskurrie
2018-09-05 08:16
Oh, do you mean, does it use the broker?

bethskurrie
2018-09-05 08:16
Yes, the latest version should

bethskurrie
2018-09-05 08:17
You can give it a broker address and a list of tags.

bethskurrie
2018-09-05 08:17
And the provider name.

ashish.dubey91
2018-09-05 09:14
@beth where can I find the docs for this? I can't see it here https://github.com/pact-foundation/pact-ruby-standalone/releases

bethskurrie
2018-09-05 09:20
Hm. Perhaps I haven't released it yet. I'll check for you tomorrow.

bethskurrie
2018-09-05 09:21
Ping me if I don't get back to you in 24 hours.

ashish.dubey91
2018-09-05 09:23
sure!


ashish.dubey91
2018-09-05 11:22
great. I just tried it got an error: `/Users/ashish/pact157/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.16.1/lib/pact/provider_verifier/aggregate_pact_configs.rb:42:in `wip_pact_uris': undefined method `fetch_wip_pact_uris' for Pact::PactBroker:Module (NoMethodError)`

bethskurrie
2018-09-05 11:23
Oh, bother. That's why I hadn't released it. I was in the middle of a refactor.

bethskurrie
2018-09-05 11:23
I renamed wip to pending.

bethskurrie
2018-09-05 11:23
I'll fix it in the morning for you.

bethskurrie
2018-09-05 11:24
Sorry about that

ashish.dubey91
2018-09-05 11:25
it's fine. fun to use this at the bleeding edge! :smile:

bethskurrie
2018-09-05 11:25
Walking on the wild side

ashish.dubey91
2018-09-05 13:42
I need some discussion around this. I'm guessing this might have happened already sometime - https://gist.github.com/bethesque/0ee446a9f93db4dd0697, but I need some help in this. I have a bunch of services (like API gateway and aggregation layer) which basically get responses from upstream services, and then either send the responses through to the front-end client or simply nest them under different keys I've written some contracts in the front-end client against the gateway, but I'd also like to verify the actual provider (upstream service) against these contracts

perrypercy
2018-09-05 14:15
has joined #general

uglyog
2018-09-05 22:10
Do you mean generate a pact file with all the matching rules, or are you asking about a Rust consumer test DSL?

uglyog
2018-09-05 22:11
Or do you need a function that just generates the JSON format for a particular matching rule?

matt.fellows
2018-09-05 22:27
Hi all, Are you interested in talking with the Pact maintainers at your place of work or getting involved in training events? I will be traveling to San Francisco the week of 19th - 23rd November 2018 to run a series of Pact workshops, brown bags and presentations at local meetup events. We are seeking early expressions of interest to help with planning and designing the most appropriate content, as well as for identifying future workshops in other locations. If this is of interest to you, please complete this short survey https://docs.google.com/forms/d/e/1FAIpQLSeHEq52irOfEr5W3sqMRcpIk9ZvybMqtDfEE3y11WYndcsnwA/viewform?usp=sf_link or DM directly. Thanks!

jake.shelley
2018-09-06 01:13
has joined #general

ashish.dubey91
2018-09-06 04:56
@mr.matt.r.long are you guys open for remote workshops/brown bags too?

matt.fellows
2018-09-06 04:56
yep!

matt.fellows
2018-09-06 04:57
It?s under ?online? in the survey if you were wondering

ashish.dubey91
2018-09-06 04:57
that's great! I'm interested in having one for my team

matt.fellows
2018-09-06 04:57
:thumbsup:

matt.fellows
2018-09-06 04:57
Thanks, I?ll chat with you offline about potential options - thanks for reaching out

ashish.dubey91
2018-09-06 05:06
thanks @mr.matt.r.long let me know when you want to do it. I also filled in the survey

matt.fellows
2018-09-06 05:21
fantastic, thanks!!

pact-slack
2018-09-06 08:02
I want to generate a pact file with all the matching rules. Until now the elixir library generates a really basic JSON which is then used to start the Rust mock server. To be able to use the existing Rust code is a great time and code saver. Now I was wondering if there is a Rust library which I can use to implement the missing functionalities like matching rules JSON generation?

pact-slack
2018-09-06 08:04
I need some kind of guideline which functionalities can be reused from the Rust reference implementation and which I need to implement myself.

dipakpawar231
2018-09-06 11:52
has joined #general

culbluswan123
2018-09-06 15:05
has joined #general

uglyog
2018-09-06 22:48
Ok, I'll put something together for you. Might only happen this weekend :wink:


potsawee
2018-09-07 06:16
has joined #general

pact-slack
2018-09-07 14:12
Super, thx. I'll have a look into it.

bethskurrie
2018-09-09 21:35
I've released the fix for this @ashish.dubey91

bethskurrie
2018-09-09 21:36
Sorry I forgot to mention it earlier

mattgilbert90
2018-09-10 12:45
has joined #general

mattgilbert90
2018-09-10 13:09
I am struggling to understand the basics of Pact and implementing my first test against a service. Our team has 20+ services and we'd like to use Pact to help with our contract testing. The tests all run locally? How does the Provider reach out to a specific environment where a service lives? How does the Consumer know what service to mock?

tom.hombergs
2018-09-10 20:08
@mattgilbert90 I struggled quite a bit, too. The tests run locally, that's the main advantage of contract tests. The consumer does not need access to a service and the service does not need to be called by the real consumer in order to be tested.

tom.hombergs
2018-09-10 20:10
I wrote down my thoughts on consumer driven contract tests in a blog post, maybe it helps :slightly_smiling_face: https://reflectoring.io/7-reasons-for-consumer-driven-contracts/

tom.hombergs
2018-09-10 20:11
there are some tutorials on pact with Java there, too.

mattgilbert90
2018-09-10 20:14
@tom.hombergs funny, i was reading your posts this morning. Does starting out with your first contract test require there to be a good bit of API documentation? We are switching to microservices from Monolith and there is not much documented, and what is documented cannot be trusted. Can I just use my knowledge of the system to get started or is there more?

mattgilbert90
2018-09-10 20:16
The main need for switching is the microservice tests that were developed previously used no framework and are super hard to maintain. Our UI tests also take 13 hours to run :face_vomiting:

matt.fellows
2018-09-10 22:16
I love your work @tom.hombergs, especially the summary table

bethskurrie
2018-09-11 01:29
@tom.hombergs what a stellar post. Recommend everyone read it!

tom.hombergs
2018-09-11 03:03
I'd say you can start with contract tests without an API documentation, because you're creating a contract and that IS a bit of documentation by itself.

glvargas
2018-09-11 14:03
has joined #general

tom.hombergs
2018-09-11 18:58
@bethskurrie thanks :slightly_smiling_face:

tom.hombergs
2018-09-11 19:01
Is it possible to test a consumer against an existing contract with pact-jvm? i.e. load the pact from a pact broker, start up a mock provider using that pact and then verify the consumer against the mock?

ypeng1
2018-09-11 20:22
Anyone know how to set provider version using pact-jvm-provider?

ypeng1
2018-09-11 20:22
Or how to publish test results back to pact broker when tests failed?


gaurav
2018-09-11 23:10
@tom.hombergs My opinion: if I understand correctly, what you want seems certainly doable.. however I personally would recommend against doing that.. A pact is only valid for the consumer that created the pact and that pact should not be used for any other consumer. Reason is that pact might reflect only a subset of response data from provider. If a provider P provides {a,b,c,d}, and a consumer C1 needs only {a,b} then pact(P-C1) will only have {a,b}.. and that pact can?t be used to create a mock server for a consumer C2 that needs {c,d} for example.

uglyog
2018-09-11 23:44
It is possible, you'll just have to use the pact-jvm libraries to do it

ypeng1
2018-09-12 04:57
anyone know how to detect pact contract change or not manually ?


bethskurrie
2018-09-12 07:09
The ruby impl does this too.


bethskurrie
2018-09-12 07:10
If you're using Pact JVM with version 3 rules, you'll need the JVM one though

daniel.kirmse
2018-09-12 09:17
~Das Repo git clone <ssh://d027470@git.wdf.sap.corp:29418/d027470/ase_sudoku_java>~

vishesh92
2018-09-12 09:49
has joined #general

vishesh92
2018-09-12 10:05
Hi I have a python project which uses https://github.com/getsentry/responses for mocking requests in unit tests. There are some parts where the requests are made to multiple providers. I wanted to know what is the best way to do this using pact.

matt.fellows
2018-09-13 00:14
I?m not quite sure what you?re asking @vishesh92. Are you asking if you should replace the responses library with Pact, or how they could be used together?

matt.fellows
2018-09-13 00:16
Looking at that library, if I understand correctly, I would be using them for separate purposes. Pact?s job is to capture the expectations of the request/response between the consumer and all of its providers. Responses would be better placed to do all of the standard unit tests you need to run, mocking out the interface so that you can test with all sorts of conditions - e.g. different data types and all of the local validation scenarios etc. you want to test. That?s not an ideal use case for Pact.

tom.hombergs
2018-09-13 18:19
thanks, I'll look into that!

tom.hombergs
2018-09-13 18:23
@gaurav yeah, you're right of course. But I have a special use case where I explicitly want to piggy-back onto an existing pact (while being concious of all the things you said)

matt.fellows
2018-09-13 22:21
Another gem from Tom on testing message consumer and producers with spring: https://reflectoring.io/cdc-pact-messages/

matt.fellows
2018-09-13 22:21
Relevent for all languages

micheal.ieti
2018-09-13 23:02
has joined #general

kanohen
2018-09-14 11:22
has joined #general

kanohen
2018-09-14 11:23
Hello world!

kanohen
2018-09-14 11:31
So, I have a response that looks like this: Books { "JD HUM": 20£, "ZAC ATEKS": 40£ }, ...... Other fields..e.t.c This book structure could have 1,2, more or no contents. At the moment, I am simply adding those two books e.g.book.object ("Books", book-> book.numberType ("JD HUM", "ZAC ATEKS")); How do I handle a generic case where I just define the structure e.g I need a map that has a key string and value number and I don't care if it has 1, 2 or no entry using pact?

matt.fellows
2018-09-14 11:34
I don't believe you can do this in the current version of pact with dynamic keys across languages (it might be available in pact jvm). it's slated for the next specification. If it was an array, it would be possible

matt.fellows
2018-09-14 11:35
It's hard to tell without context, but any reason it's not an array of books instead of a map?

kanohen
2018-09-14 12:32
Sorry, I was at lunch. An array won't work as we needed to get them by unique keys for quick referencing.

kanohen
2018-09-14 12:47
How would this be possible with an array if I may ask?

matt.fellows
2018-09-14 13:34
At the moment, Pact matches maps on exact keys only (see v4 for proposal to enhance this)

matt.fellows
2018-09-14 13:36
Array matching supports your use case: 1 or more objects with a generic shape. How big is this array, I can't imagine lookups being computationally slow (i.e. no worse than `O(n)`)


shekharsp27
2018-09-14 13:49
Hi, are there any guidelines to determine complexity associated with contract testing with respect to the implementation or which points needs to consider to derive complexity involved in implementing contract testing in general

kanohen
2018-09-14 15:09
The reason I ask is because if there isn't a generic way to define types, am afraid, it becomes complex working with complex request/response json structures on pact

daniel.straus
2018-09-14 19:28
has joined #general

daniel.straus
2018-09-14 19:36
Hi there.

daniel.straus
2018-09-14 19:39
Question about publishing pacts with SBT for Scala. We have our pact broker using basic auth as we have it in our ci build which uses a 3rd party service. But sbt seems to have an issue authing to the pact broken. Is anyone familiar with the pacts and sbt and had experience with this?

daniel.straus
2018-09-14 19:39
Thanks in advance

thirumal.net
2018-09-14 21:38
@matt.fellows can you please help me on below scenario? do we need to call real webservice call code in order to create pact files? if yes, how to create pact files for existing API code ? please let me know if you see any sample code with service call

thirumal.net
2018-09-14 21:40
def test_HappyPath (self): mockurl = 'http://localhost:1234' expected = {body:true} pact.given ( 'Given there is a valid form' ).upon_receiving ( 'fetch all the info ' ).with_request ( 'get', '/',headers={Authorization:'Bearer 58771381-333e-334f-9604-784'} ).will_respond_with(200, body=expected) with pact: result = callAPI ( mockurl ) self.assertEqual(result, expected )

thirumal.net
2018-09-14 21:42
'def callAPI (url): return requests.get ( url ).json()'

thirumal.net
2018-09-14 21:46
my understanding is callAPI is real production web service call ? am i correct ? if yes, do you have any sample code to return requested response from real service. i am kind of stuck in this specific part to complete my POC on pact

matthew.balvanz
2018-09-14 22:14
That side of the Python library shown there is the consumer (aka client) side of the contract. `callAPI` should be replaced with the code that would be making an HTTP request to the web service. Using the `mockurl` then connects with the Pact mock service that can record the interaction as a JSON file. After you have the JSON contract, then you can use the pact-verifier to verify the contract, potentially against a production/staging service.

abubics
2018-09-17 04:34
I would suggest that you could use different data structures for transport vs in-app.

abubics
2018-09-17 04:34
(Your sample payload uses business values for primary keys, which seems risky/brittle, but that's beside my point . . .)

abubics
2018-09-17 04:35
transporting them (over the wire) as an array is a good generic approach, with easy-to-implement data integrity

abubics
2018-09-17 04:36
If you want to translate that into a map for performance reasons, that feels more like an app responsibility (and you can do so after it's received)

abubics
2018-09-17 04:39
Also, can you keep platform-specific questions in their own channels? :innocent: :point_right: #pact-python

shekharsp27
2018-09-17 08:03
Hi, are there any guidelines to determine complexity associated with contract testing with respect to the implementation or which points needs to consider to derive complexity involved in implementing contract testing in general

assaf.katz
2018-09-17 10:50
has joined #general

bethskurrie
2018-09-17 10:51
That's a very broad question @shekharsp27. What do you mean by complexity? Are do you mean in the context of story points?

malheur
2018-09-17 13:12
has joined #general

malheur
2018-09-17 13:17
Hi all, I'm running CDC test on provider's side and facing the problem: https://stackoverflow.com/questions/52359563/pact-provider-tests-broken-pactverificationtesttemplate-preconditionviolation. I wonder whether it's the same issue as here: https://github.com/pact-foundation/pact_broker/issues/209 and what should I do to make the consumer-broker-provider bundle work together. Thanks in advance!

thirumal.net
2018-09-17 20:50
@abubics -Sure, Thanks


matt
2018-09-18 01:19
it looks like the swift bindings are inactive?

matt.fellows
2018-09-18 01:28
No changes doesn't necessarily mean bad things - it might mean they just work really well :ok_hand:

matt.fellows
2018-09-18 01:28
Do you have an issue?

abubics
2018-09-18 01:53
(relative to the complexities of other options is probably an important aspect, too)

bethskurrie
2018-09-18 01:57
Please ask in the #pact-jvm channel @malheur

bethskurrie
2018-09-18 01:59
Compared to standard integration tests, contract testing is more complex to get started, but maintains a similar level of complexity as time goes on and more features are added. Traditional integration tests start with a low level of complexity but become exponentially more complex as time/features increase.

shekharsp27
2018-09-18 08:07
@bethskurrie I mean to say for example in API functional testing to derive complexity, one can consider how many parameters does api need or the API composition, on the similar lines can we decide complexity for contract testing

malheur
2018-09-18 08:08
Thanks!

bethskurrie
2018-09-18 08:13
I'm sorry @shekharsp27, I still don't understand. Can you give me a concrete example?

janneck.wullschleger
2018-09-18 09:35
has joined #general

janneck.wullschleger
2018-09-18 09:41
Hey there! I've got a serious problem with the can-i-deploy command and need some explanation. If I do a can-i-deploy --pacticipant --version, I get the results of all pacts associated with that pacticipant-version. I want to use the stricter can-i-deploy --pacticipant --version --to TAG but this one is not looking for pacts associated with that pacticipant-version and other tagged pacticipants its also failing if there are pacts missing between my pacticipant and other pacticipnat versions with that tag if there are pacts between those services on other tags. If there are pacts on some branch/tag between two services why are they considered to must be existing on other branches/tags? I think I get something wrong here and would appreciate any hints.

bethskurrie
2018-09-18 10:35
Hey @janneck.wullschleger can you make a gist and show each command and its output, and list your questions about each scenario, and I will do my best to answer you.


shekharsp27
2018-09-18 10:53
@bethskurrie I am sorry for being unclear, I'll look for an example and will get back

bethskurrie
2018-09-18 11:15
Hi @janneck.wullschleger thanks for the example.

janneck.wullschleger
2018-09-18 11:17
If you need any further information, please send me a message.

bethskurrie
2018-09-18 11:17
The logic in the command is to make sure that you have a valid contract between all the services.

bethskurrie
2018-09-18 11:18
It knows that you have pacts between the services that are missing a contract, and it is saying that if you want to deploy safely, you need to have one.

bethskurrie
2018-09-18 11:18
That's just the way it works.

bethskurrie
2018-09-18 11:19
It wouldn't be very helpful if it didn't check that.

bethskurrie
2018-09-18 11:23
If you are adding pacts into an existing environment, and you have versions of services deployed that never used pact, you can explicitly list the ones you want to deploy.

bethskurrie
2018-09-18 11:24
I've been meaning to add an --ignore-missing but haven't yet gotten around to it

janneck.wullschleger
2018-09-18 11:24
I do not agree with this. If I introduce a pact between service-a and service-b on a feature-branch. Why shouldn't I be able to deploy a new version of service-b to prod when there is a version of service-a deployed that has no pact(dependency) with service-b?

janneck.wullschleger
2018-09-18 11:27
What would be the normal way to introduce such new pacts?

bethskurrie
2018-09-18 11:34
That is a use case I hadn't considered.

bethskurrie
2018-09-18 11:35
Until your pact is on the main branch, you'll need to explicitly list the pacticipants that you care about in your command.

bethskurrie
2018-09-18 11:36
When you only specifying the one pacticipant, the broker autodiscovers all the other dependences.

bethskurrie
2018-09-18 11:37
In this case, it has autodiscoverd a dependency you wish to ignore for now.

bethskurrie
2018-09-18 11:37
As I haven't implemted the ignore feature, you'll need to explicitly list the dependencies you wish it to consider.

bethskurrie
2018-09-18 11:42
It's late here, so I'm not ignoring you if I don't respond, I'm just sleeping! We can chat more tomorrow if you need to.

janneck.wullschleger
2018-09-18 12:21
Thank your for your explanation. While the ignore-flag isn't implemented I have to work around this. Which api endpoint is the pact-broker-client using to query the table?

janneck.wullschleger
2018-09-18 13:15
I think I've found the correct endpoint and my needed query params to query the pact broker myself. I am a bit confused about the thought process because I am into pact since the end of last year and was sure that I understood the functionality. I'd like to chat with you to check if my understanding is correct or not.

schalkt
2018-09-18 13:23
has joined #general

abubics
2018-09-19 01:48
@shekharsp27 I don't think combinatorial/cyclomatic complexity changes at the level you're describing. The interesting complexity that differs is in test implementation and maintainability.

slack1977
2018-09-19 10:57
has joined #general

svams
2018-09-19 11:26
has joined #general


adam
2018-09-19 12:32
has joined #general

adam
2018-09-19 12:38
Has anyone any secret knowledge on how can I configure both gradle and npm to publish contracts to s3?

adam
2018-09-19 12:39
The general workflow that I understand should be possible, is as follows: the microservices backends define their expectations, that get converted to contracts in a build pipeline, and published to s3. At the same time they too retrieve contracts that they have to fulfill from s3 and run pact verification against them. And any frontend compoments that we have, in JS, they too define their contracts and publish them to s3.

adam
2018-09-19 12:40
Did I get it right?

leon.gaban
2018-09-19 15:12
has joined #general

leon.gaban
2018-09-19 15:13
Hi guys, I?m having a problem with the Javascript implementation of Pact, can anyone help?

leon.gaban
2018-09-19 15:14
My error ``` ? Test suite failed to run /Users/leongaban/projects/trade.io/tradeio-front/src/services/api/liquidityPool/TotalPayout.test.pact.js:2 import { Pact } from '@pact-foundation/pact'; ^ SyntaxError: Unexpected token { ```

leon.gaban
2018-09-19 15:14
This is my pactSetup file: ``` // @ts-ignore import path from 'path'; import { Pact } from '@pact-foundation/pact'; // @ts-ignore global.provider = new Pact({ port: 1234, log: path.resolve(process.cwd(), 'logs', 'mockserver-integration.log'), dir: path.resolve(process.cwd(), 'pacts'), spec: 2, cors: true, pactfileWriteMode: 'update', consumer: 'Exchange', provider: 'LP Service' }); ```

christophe
2018-09-19 16:05
has joined #general

christophe
2018-09-19 16:17
Hello all

christophe
2018-09-19 16:17
Is there specific channel for each Pact implementation?


leon.gaban
2018-09-19 16:20
Yeah that would be a great channel :slightly_smiling_face:

christophe
2018-09-19 17:20
I am using Pact JS mais my question more generic, is it the right place ?

mattgilbert90
2018-09-19 17:25
@christophe use #pact-js

liran.tal
2018-09-19 17:35
@adam I think you got the basics right. what do you mean about npm to publish contracts to s3?

liran.tal
2018-09-19 17:36
@leon.gaban looks like your error is related to transpiling. better take it at #pact-js channel

matt.fellows
2018-09-19 21:31
You'd have to do your own work to publish and fetch from s3. Have you considered using a pact broker? E.g. http://pact.dius.com.au or running your own open source one?

ehughes
2018-09-20 01:43
has joined #general

shekharsp27
2018-09-20 07:19
Ok. makes sense, however still I am struggling to put across my point properly and still working on the example which helps to describe the scenario. :disappointed:

wilson.mahann
2018-09-20 13:53
has joined #general

michael.francoeur
2018-09-20 15:32
has joined #general

jacob.hebert
2018-09-20 16:24
has joined #general

zackary.mccolgan
2018-09-20 17:09
has joined #general

suparna.bhattacharjee
2018-09-21 04:26
has joined #general

esf101
2018-09-21 15:15
has joined #general

drsiino
2018-09-21 17:06
has joined #general

yudinagata
2018-09-24 23:08
has joined #general

tom397
2018-09-25 18:30
has joined #general

tom397
2018-09-25 18:38
Hello! Pact is super cool! Thanks for all the great work. I came here to see if I might be able to get some general opinions on the challenges & worth of trying to integrate pact with a legacy system. Specifically I can see how auth will be challenging (as discussed here https://docs.pact.io/faq#how-do-i-test-oauth-or-other-security-headers). Any general thoughts on the subject of legacy system integration? Or any open source examples of rails projects using a mock auth service?

leon.gaban
2018-09-25 21:38
Hi guys, I?m getting the following errors with Pact JS version ``` console.error node_modules/@pact-foundation/pact/pact.js:110 Pact verification failed! console.error node_modules/@pact-foundation/pact/pact.js:111 Actual interactions do not match expected interactions for mock MockService. Missing requests: GET /frontoffice/api/liquidity-pool/get-total-payout ```

leon.gaban
2018-09-25 21:39
On the missing requests, that API isn?t built yet, does PACT require that endpoint to be hit?

leon.gaban
2018-09-25 21:40
~My test.pact.ts file~

leon.gaban
2018-09-25 21:41
Posting my question in pact-js

uglyog
2018-09-25 22:42
A legacy system is just a system where the original authors are no longer around. If you can write tests for it, you can use Pact. I have used pact to test things like where we replace some function in the legacy system with a call out to a new microservice.

tom397
2018-09-26 03:31
Tremendous. Thanks @uglyog!

christophe
2018-09-26 06:45
Hello all Thanks for the great work. Pact is really cool. I have a question about to manage multiple consumers with one provider. Imagine we already have a pact, published on Pact Broker, betwee a consumer À and a provider. Here comes a new consumer, Consumer B. At the starting point the contract between Consumer B and the Provider is the same as between Consumer A and the Provider. What is the best way to manage this case? Consumers B publish the contract but on the server side we have to implement twice the test? Consumer B download the latest version of the contract between A and the Provider and generate the mock from the Pact file ? Is there a such functionality on the consumer ? I mean replaying the contract from another consumer?

abubics
2018-09-26 06:51
This kinda depends on what pact libraries you're using on the consumer, which is dictated by what language/platform it's written on

abubics
2018-09-26 06:52
For example, there's a unit test style of provider verification that I've never tried, but it seems like it might work how you've described (which sounds horrible).

abubics
2018-09-26 06:52
I usually just manage fixture data through states, and don't do any verification through explicit test code (on the provider side).

eduardo.iriarte-mende
2018-09-26 15:38
has joined #general

viktor.nyblom
2018-09-27 07:46
has joined #general

madu.alikor
2018-09-27 09:14
has joined #general

vikassd2012
2018-09-27 17:43
@bethskurrie I needed help with the seek.automation.stub library, I posted my issue on the git but didn't receive any responses https://github.com/seek-oss/seek.automation.stub/issues/11 so I was hoping you can direct me to the right person?

bethskurrie
2018-09-28 09:12
@vikassd2012 tag Neil Campbell in the #pact-net channel.

testmoodbit
2018-09-28 19:51
has joined #general

moodbit
2018-09-28 19:52
has joined #general

vikassd2012
2018-09-29 05:30
Thanks @bethskurrie for your prompt response

liran.tal
2018-09-30 12:15
I thought of using `http://pact.dius.com.au/register/` for a workshop on pact but due to the non-automatic sign-up and registration process I guess I?ll have to revert to a docker-based solution? ? would be happy to get input

matt.fellows
2018-09-30 21:33
@liran.tal did you register? Haven't seen anything in the past few days, I'm happy to create one for your workshop

shekharsp27
2018-10-01 07:49
Hi, In case of a scenario where there is a dependency in microservice as ( A-> B- > C ), so in case if A sends a request to B to get some data, in that case, B has to request C to fulfill data required by A. So in this scenario to check the contract between A->B I can use the following options 1) I can virtualize service 'C' which can be used while validating the contract 2) Can use contract generated by B -> C to create mock service (service C) 3) Can use Swagger mock Validator tool which will leverage the Swagger file of providers (B and C), so providers can validate consumers' expectations without spinning up themselves. So in addition to the above approach will it be advisable to have one of the following options as well 1) Write a contract test between A->B such that, B doesn't have to get any data from C (write the contract which will cover only response which B can provider on its own without depending on C) and have separate contract between B->C which will make sure C responding in a proper way. 2) Use of provider state, for example, if service B knows what data needs to get from service C which required to send to service A. In that case service B can insert that data directly in its own database or can provide endpoint which service A will use to setup data. Please let me know your thoughts

matt.fellows
2018-10-01 07:51
I would go for option 2, using provider states and stubbing out service C when contract testing A->B

matt.fellows
2018-10-01 07:52
Depending on language, tool etc that might be a stub server, an in memory fake dependency (e.g. spring ) or any number of things


liran.tal
2018-10-01 10:12
oh I didn't, I just noticed that it's not an instant thing from the website. I think for the workshop I'd plan to have many accounts open for each team that joins in. Its not a problem though, I'll just run the broker from the docker image. Thanks!

matt.fellows
2018-10-01 11:32
No worries. If you want a bunch created for the workshop, let me know and I?ll get them created in bulk (I can send you a template).

matt.fellows
2018-10-01 11:32
Also I think there was a conversation _somewhere_ - what?s the workshop details and do you want any help getting it together?

liran.tal
2018-10-01 11:39
I would love to, thanks! I'm still working on the details, story and plan but once I have something more coherent to share I definitely will.

liran.tal
2018-10-01 11:39
That's awesome of you to offer, thanks! :heart:

matt.fellows
2018-10-01 11:40
:thumbsup:

shekharsp27
2018-10-01 12:44
Thanks @matt.fellows

matt.fellows
2018-10-01 12:52
np

suvendu.panja1
2018-10-02 01:43
has joined #general

keynan21
2018-10-02 01:47
has joined #general

keynan21
2018-10-02 01:51
You rang?

nnoble
2018-10-02 02:21
has joined #general

keynan21
2018-10-02 04:47
@tjones you rang?


keynan21
2018-10-02 05:28
affermative

tjones
2018-10-02 05:28
I guess the first question is - is there a reason you're spinning up the mock server in the build script rather than letting the js library do it for you?

tjones
2018-10-02 05:28
that lifecycle is supposed to be abstracted a bit (and I'm hoping we can eventually abstract it more)

keynan21
2018-10-02 05:29
Yes, if I let the lib do it, it explodes looking for ruby

keynan21
2018-10-02 05:29
I strongly believe what you want is a session lifecycle, not a process lifecycle

tjones
2018-10-02 05:30
Could you elaborate a bit?

bethskurrie
2018-10-02 05:31
Huh? @keynan21 something is not right.

bethskurrie
2018-10-02 05:31
The fact that it is ruby under the hood shouldn't matter.

bethskurrie
2018-10-02 05:31
What is the error stack?

keynan21
2018-10-02 05:32
The service simply exists, somewhere, accessible at http://localhost:5236 , now how do you implement the library / service to behave the way you want

keynan21
2018-10-02 05:32
Dear service please give me a session cookie

keynan21
2018-10-02 05:32
.... do many test things

keynan21
2018-10-02 05:33
Thx service, close my session

keynan21
2018-10-02 05:33
whatever is happening on process start / stop is moved to the session create / close

tjones
2018-10-02 05:33
Perhaps. I think ideally all of that should be abstracted to the user

keynan21
2018-10-02 05:34
same lifecycle, with no dependence on where / when / how the process is created

keynan21
2018-10-02 05:34
ideally I don't need to know the internals of tcp to write an http server

keynan21
2018-10-02 05:34
however that is never and will be never the case

tjones
2018-10-02 05:35
Anyway, to fix your issue, this is happening because alpine has `uglibc`instead of `glibc`


keynan21
2018-10-02 05:35
What's important is that new users can get something working quickly and advanced users can customize their usage to their usecase

tjones
2018-10-02 05:36
You can either add the relevant parts to your dockerfile, or use a different base image


tjones
2018-10-02 05:38
So, that will get you able to get the tests working

tjones
2018-10-02 05:38
Beyond that, the suggestion of having a separate service for the mock server is interesting

keynan21
2018-10-02 05:39
Thank you, but I always knew installing the missing dependency would solve the immediate problem. I filed the ticket because I don't want a dependency on ruby or anything else creeping in.

tjones
2018-10-02 05:40
You don't have to depend on Ruby - `pact-node` contains everything it needs.

bethskurrie
2018-10-02 05:40
Eventually you'll have to depend on something @keynan21 - the service isn't built on air :stuck_out_tongue:

tjones
2018-10-02 05:40
It does expect `glibc` though

keynan21
2018-10-02 05:40
okay, I don't want to depend on glibc

bethskurrie
2018-10-02 05:40
What would you prefer to depend on?

keynan21
2018-10-02 05:40
I'm perfectly happy to depend on docker

tjones
2018-10-02 05:41
Why not run the test within docker, then?

keynan21
2018-10-02 05:42
I do

tjones
2018-10-02 05:42
The dockerfile can contain the dependencies

tjones
2018-10-02 05:43
glibc doesn't seem like an unreasonable dependency. Is there some reason you are unable to include it?

keynan21
2018-10-02 05:43
which means I'm now mixing in things to my test environment I'm not necessarily expecting in production

tjones
2018-10-02 05:44
That's standard practice with npm, though - `devDependencies` are available at test time and not available in production.

tjones
2018-10-02 05:46
An alternative if you don't want to have a different container definition in prod would be to have two containers - one for your Pact tests, and one for your other tests

keynan21
2018-10-02 05:46
Best practice is to replicate your prod environment as close as possible.

tjones
2018-10-02 05:46
(Or leave glibc there in production)

keynan21
2018-10-02 05:48
An per the link you gave, adding glibc adds 86MB to a container that currently weighs only 22MB

tjones
2018-10-02 05:48
So, your issue could be resolved by removing the dependency on glibc?

keynan21
2018-10-02 05:50
The specific problem of today? maybe.

bethskurrie
2018-10-02 05:50
@keynan21 I'm afraid that the current method of packaging is the only alternative we have at the moment. We know that it is not ideal, and we have a long term plan to fix it, however, this is an open source project that gets completed in people's free time, and the amount of work to change the current implementation to the new fancy version is significant, and has not yet been picked up.

bethskurrie
2018-10-02 05:50
If you are interested in contributing, we would be very happy to accept your assistance.

keynan21
2018-10-02 05:51
The general problem remains. I want control over what and how process get run, and there seems to be no reason why the library MUST start the process other than it's the status quo

bethskurrie
2018-10-02 05:51
There is a docker image of the mock service

bethskurrie
2018-10-02 05:52
There should be the ability to use an existing mock service in the js library.

keynan21
2018-10-02 05:52
@bethskurrie Yes, those are what I'm trying to use

bethskurrie
2018-10-02 05:52
If there isn't, we can add it.

bethskurrie
2018-10-02 05:52
Please go to the #pact-js channel, and discuss it with @matt.fellows and @mboudreau. Please keep your comments in a thread to avoid spamming people as we have currently been doing.

keynan21
2018-10-02 05:53
@bethskurrie And I appreciate that yall have limited bandwidth. I've no objection to doing the leg work once people are onboard.

keynan21
2018-10-02 05:53
soz, slack noob

bethskurrie
2018-10-02 05:57
In the Ruby implementation, there is a flag called `standalone` when you are setting up the mock service configuration, which tells the code "don't start a mock service, I've already got one running". This needs to be added to pact-js if it doesn't already exist @keynan21

keynan21
2018-10-02 05:59
Thx

matt.fellows
2018-10-02 07:27
As a related aside, multi stage builds https://docs.docker.com/develop/develop-images/multistage-build/#before-multi-stage-builds) and other similar patterns can assist with keeping runtime dependencies to a minimum, whilst allowing for flexibility during build stages

christophe
2018-10-03 14:22
Sorry. I did not see that you answered me.

christophe
2018-10-03 14:22
I am not sure to get you

christophe
2018-10-03 14:36
So imagine, that we have client A in Angular and client B in Java with a server in Java. So the 2 contracts are published on Pact Broker. The server should implement tests to validate the 2 contracts. So my question is how to manage the case where the 2 client contract have common part. Should the server side test every contracts, which could implies to duplicate tests or could we image some common contracts and the client download this part of this contracts to generate the mock ?

holden.mcginnis
2018-10-03 15:43
has joined #general

igalkop
2018-10-04 04:31
has joined #general

contactsai123
2018-10-04 05:33
has joined #general

kashikar.harsh
2018-10-04 07:56
has joined #general

daniel.oades
2018-10-04 13:31
has joined #general

joe.campedelli
2018-10-04 19:22
has joined #general

shawn
2018-10-04 20:15
has joined #general

fraser.crichton.devel
2018-10-04 22:56
has joined #general

chandas.pathre
2018-10-05 07:10
has joined #general

ashish.dubey91
2018-10-05 12:26
hey guys I have some questions around managing provider states across different services - are there best practices around making provider states discoverable in a setting which has multiple teams managing a dozen of micro-services? I have some ideas, I would like to know how others do it

jose.neto
2018-10-05 14:57
has joined #general

rakshit.shukla
2018-10-05 16:06
has joined #general

abubics
2018-10-08 00:56
I think that's definitely a "teams should talk to each other" kinda thing, but I haven't had a particularly complex use case yet.

abubics
2018-10-08 00:57
I'd be interested to see if anyone feels that it's a problem that needs a technical solution :thinking_face:

matt.fellows
2018-10-08 10:58
It?s something we?re looking to add to the broker roadmap - making those states more easily discoverable. If nothing else to avoid simple mistakes where two states exist and differ by spelling or something.

matt.fellows
2018-10-08 10:58
But yes, it?s always a ?talk to the provider? before adding a state they don?t know about

kashikar.harsh
2018-10-08 11:26
hi all

kashikar.harsh
2018-10-08 11:26
Facing an issue with pact verification, getting below error

kashikar.harsh
2018-10-08 11:26
Pact verification failed! Actual interactions do not match expected interactions for mock MockService.

kashikar.harsh
2018-10-08 11:27
I understand this is because the request is executed before the interactions were added

kashikar.harsh
2018-10-08 11:27
however I have added done to my interactions, still getting this error

mboudreau
2018-10-08 11:32
please keep it in the appropriate language channel :slightly_smiling_face:

jesus.medinilla
2018-10-08 12:29
has joined #general

robcossin
2018-10-08 16:14
has joined #general

abubics
2018-10-08 23:17
The "provider states" docs page gives a nice high-level description of how states work, but I think this could also be expanded to some descriptions of approaches to state structure/strategy :thinking_face: and that would lead nicely into state discoverability (or vice versa)

matt.fellows
2018-10-08 23:47
good point

ashish.dubey91
2018-10-09 03:31
yeah something like that would definitely be helpful. conversation between the consumer and provider would def be there for using a provider state while defining a contract but once a provider state has been negotiated it should also be easy for consumers to reference them (to make re-use easy) and also same for teams managing the provider

ashish.dubey91
2018-10-09 03:32
what we're thinking in our team is to have a way to document the provider states that the provider has fixtures for in the code repo of the provider. that's the most basic one. something on the pact-broker would have been great too

abubics
2018-10-09 03:59
Generally, the first pact tests I write are GETs that mostly show the bare state anyway . . . and without an abstract data visualisation, I don't see an easy, consistent way to display the state across multiple tables, or the many kinds of stores (including relational and nosql)

abubics
2018-10-09 04:00
I guess what I'd like to know is: what kinds of issues do you have already? Do your GETs not give enough info, and/or not show relationships between different levels of relational hierarchy? etc

abubics
2018-10-09 04:22
(and do you have any ideas for how to represent the state, since the structures may be very arbitrary?)

ashish.dubey91
2018-10-09 04:27
The GETs in my case give out information, mostly. but it could be contained in headers, query string, or url. There's no standard at the moment. I think there is scope for making provider state inference easier than looking at request specs of the consumers

brian.smith.keith
2018-10-09 18:56
has joined #general

marco.dellolio
2018-10-09 18:56
has joined #general

avi.pardu.nash3
2018-10-10 00:05
has joined #general

arne.zelasko
2018-10-10 08:58
Hi everyone, short question; Is it possible to use spring cloud contract on one service and on the other pact-jvm ?

bethskurrie
2018-10-10 08:59
Which end is which?

bethskurrie
2018-10-10 09:00
Ask in #pact-jvm, or better yet, on the SCC gitter channel. The maintainer is very responsive.

matt.fellows
2018-10-10 11:18
My understanding that yes, you can. On the consumer side, it can generate Pact files that can be sent to the broker, and on the provider side it can fetch from the broker. So if it can do those things, then in theory either side is possible

inbox
2018-10-10 15:40
has joined #general

colin.but
2018-10-10 21:13
has joined #general

liran.tal
2018-10-11 12:37
@matt.fellows follow-ing up on our thread here about query params in brackets support in a matching rule. short reminder: the API endpoint on the provider follows this signature: ``` GET /reviews?movieId[]=1 ``` on the consumer, I?ve set the interaction as follows: ``` withRequest: { method: 'GET', path: `/reviews`, query: { 'movieId[]': Matchers.like('1') } }, ``` when I run the provider testing I get this warning as part of the results of the verifier: ``` WARN: Ignoring unsupported matching rules {"match"=>"type"} for path $['query']['movieId'][][0] ``` My provider?s project dependencies are `"@pact-foundation/pact": "^6.0.1"`

liran.tal
2018-10-11 12:41
I updated the interaction on the consumer to be: ``` query: { 'movieId[]': Matchers.like('1') ``` just as in my PR for array brackets example and now the provider verification results shows these warnings: ``` WARN: Ignoring unsupported matching rules {"min"=>1} for path $['query']['movieId'][] WARN: Ignoring unsupported matching rules {"match"=>"type"} for path $['query']['movieId'][][*]* ```

louiseavelar
2018-10-11 13:30
has joined #general

louiseavelar
2018-10-11 16:48
Hello Everyone, I am new to pact and the whole concept of contract testing. I was wandering if contract testing replaces completly e2e tests or is just a complementary test. That wasn't clear for me! thanks in advance!

liran.tal
2018-10-11 21:45
@louiseavelar welcome! :wave: I would think of it as not replacing e2e tests but instead of enabling robust and short feedback loop of e2e tests in a rich SOA.

bethskurrie
2018-10-11 21:46
There's a FAQ dedicated to this on http://docs.pact.io @louiseavelar

mboudreau
2018-10-11 23:25
@louiseavelar they do different things. e2e tests is to test your front-end code and routes through your application, while contract testing is to make sure your consumer (front-end app) can consistently call your producer (API) without the contract breaking in production. My personal opinion is that they work really well in unison since in one run, you can do both your e2e and contract testing :slightly_smiling_face:

pact-slack
2018-10-12 12:23
I'm thinking about using Pact for a message/event driven architecture. Now the Pact tool is an implementation of consumer driven contracts (CDC). But in our event driven architecture every application/service (a Bounded Context in DDD) publishes its own events in its own language. Other applications consume these events and translate them into their own language (ACL in DDD) and then act upon them. So there is not really a _consumer driven_ style of development, but more kind of "let's have a look of what happens out there and try to make some sense out of it." I'm not sure on how to use the CDC methodology in this context (and if it is applicable at all) and which Pact based workflow you would suggest? Nonetheless Pact as a tool for decoupled, fast contract testing seems still very useful for event based architectures.

abubics
2018-10-12 13:02
These are a few orthogonal concerns. Contracts are important. If they're brokered messages instead of synchronous calls, that's one point. Both of those are separate from the concern of: which end drives the contract.

ibenardetelevis
2018-10-12 13:07
I?m a bit new to pact and contract testing might be a dummy question but; while writing a contract test for getting an entity `/resource/ID` when I use a random ID in my consumer and generate the pact file, now I need to make sure provider uses the same id to create this entity or is there a way to implement this without an actual value ?

kashikar.harsh
2018-10-12 13:27
@ibenardetelevis have a look at matcher https://github.com/pact-foundation/pact-js#matching

ibenardetelevis
2018-10-12 13:31
@kashikar.harsh thank you for the example, The only part I could not figure is ` path: "/animals/1" ` where I need to match that 1 in the provider side as well right ? because when the Pact File is generated 1 will be embedded in there ?

brian.smith.keith
2018-10-12 14:03
You can use a regex I believe

liran.tal
2018-10-12 15:20
Right. I?d further add that while there definitely is a contract there - there?s a DTO that one service publishes and another service catches - that?s essentially the contract. A provider in your case is definitely clear. A consumer on the other hand could be a bit more odd situation since sometimes the EDA is also about decoupling the ?know? of who your consumers are. I?d say that?s the interesting part of the problem and will also be happy to learn more on this.

pbanka
2018-10-12 17:26
has joined #general

matt.fellows
2018-10-12 21:24
Matchers are for the consumer to convey to the provider that the specific response value isn't important, just the type or structure. The request value has to be able to work on the provider (e.g. resource 1) which is where provider states are useful

liran.tal
2018-10-13 00:07
I take that back. Actually since the consumer is creating the contract then its the consumer that is creating the relationship so the provider doesn?t know of this to begin with, only after-the-fact. To summarize I don?t think working with a message bus adds anything new.

kashikar.harsh
2018-10-13 16:56
@ibenardetelevis I used matcher in expect lik this

kashikar.harsh
2018-10-13 16:56
expect(response).to.eventually.have.property('service_id') .and.match(contractTestConfig.regex.guid)

kashikar.harsh
2018-10-13 16:57
you can define regex and use it to match expected value

matt.fellows
2018-10-14 03:33
This is redundant - pact does this exact test for you anyway.

kashikar.harsh
2018-10-14 03:38
@matt.fellows, thanks can you please share a code snippet on how to do this?

kashikar.harsh
2018-10-14 03:39
somehow the code examples in the link are not enough for new beginners like me

matt.fellows
2018-10-14 21:44
Hi Harsh. What have you read on the subject so I know what level your education is at?

matt.fellows
2018-10-14 21:45
Start with the FAQs and best practices at http://docs.pact.io

abubics
2018-10-14 23:05
The important thing for contract testing is the expectations (i.e. the contract), not the transport (i.e. http, events, messages, function calls, whatever). Message protocols & transports (such as SQS, *MQ, etc) got some Pact implementation support in the last few years :slightly_smiling_face:

abubics
2018-10-14 23:09
One of the intents of consumer-driven (rather than provider-driven) contracts is waste reduction. - There's little value in building endpoints that no one uses. - DDD is obviously important, but that helps shape the data structures, and to a lesser extent their APIs. - To this point, just because it makes sense to CRUD everything, doesn't mean all the endpoint+verbs will be used :slightly_smiling_face: - (And the simple CRUD endpoints probably aren't the interesting ones for regression testing anyway, but I digress)

liran.tal
2018-10-14 23:36
I like the point about waste reduction, will add that to my article!

matt.fellows
2018-10-15 03:29
Sorry Liran, I missed this. Will follow up tonight !

liran.tal
2018-10-15 03:59
Thanks!

bethskurrie
2018-10-15 04:00
You can ignore that @liran.tal

bethskurrie
2018-10-15 04:01
It has no side effects, it's just annoying.

bethskurrie
2018-10-15 04:01
I've been trying to work out how to get rid of it, but it's a bit tricky.

liran.tal
2018-10-15 04:02
Gotcha. No worries. I thought I was landing on some wrong version or doing something wrong on my side. Maybe we should add it on the FAQ or somewhere as a known issue? Possibly even an open issue on GitHub so that if someone searches they no it?s a no-issue thing.

bethskurrie
2018-10-15 04:03
There were a few that were known issues, and I've fixed them like I was playing whack-a-mole, but the error for the query string specifically can be ignored.

bethskurrie
2018-10-15 04:03
I think there is an issue somewhere.

bethskurrie
2018-10-15 04:03
In fact, there are many

liran.tal
2018-10-15 04:05
:slightly_smiling_face:

kashikar.harsh
2018-10-15 06:02
Hi @matt.fellows, I have gone through the entire document and some blogs as well, but couldn't find any e2e example of matchers... Not sure if I have missed anything... Also it may be obvious for many to tweak the given examples to use matcher, but not for me

marco.dellolio
2018-10-15 20:16
hello everybody. I?m implementing `pact-node`. basic on the documentation look like after I spin up the server ``` const provider = pact.createServer({ ...opts }) ``` I can just proceed regularly with ``` return provider.start().then(() => { provider.addInteraction(interaction).then(() => done()) ``` but `Unhandled Promise Rejection: TypeError: provider.addInteraction is not a function` Am I missing something?

matt.fellows
2018-10-15 21:55
I think you want to be using pact js, not pact node directly.

matt.fellows
2018-10-15 21:56
addInteraction is not available on the object of pact node. It just is a library under the hood

matt.fellows
2018-10-15 21:56
Look at the examples in pact js repo

marco.dellolio
2018-10-15 23:07
Ok I wanted to confirm that, at the moment there isn?t a way to use pact is without installing Ruby on the service

matt.fellows
2018-10-15 23:11
You shouldn't have to install it manually or anything.

matt.fellows
2018-10-15 23:11
It should u install it all for you

matt.fellows
2018-10-15 23:12
But yes, Ruby under the hood

mboudreau
2018-10-15 23:12
portable ruby

mboudreau
2018-10-15 23:12
which we have plans to change to a OS specific binary written in rust eventually

matt.fellows
2018-10-15 23:14
As a consumer it is something you shouldn't even know exists. No need for installing Ruby runtime or anything

marco.dellolio
2018-10-15 23:51
Thank you guys! To be more specific, when I start a provider it?s still spawn a Ruby process, that?s what I wanted to avoid

abubics
2018-10-15 23:53
it will always have to spawn at least one process during consumer testing or provider verifying . . . which bit of "ruby process" are you trying to avoid?

marco.dellolio
2018-10-16 00:16
My goal on using pact-node was to spawn a node process for provider. Otherwise in `Pact.js` provider.setup() would start a ruby process

abubics
2018-10-16 01:01
I mean, why do you want to avoid that?

abubics
2018-10-16 01:02
(no judgement, I'm just trying to understand the problem before offering solutions)

heymega
2018-10-16 08:59
Do you think the design choice to use ruby under the hood or indeed rust binary is going to be a hinderance in the long run? It seems every language implementation is using it. I like the idea that the community can help create language specific implementations but it can be quite difficult, or in some cases off putting, if the library isn't 100% native. For instance, in the .NET repo they moved over to the ruby core for v2 and this meant we can no longer use an in-memory server and requires spawning a ruby process. Something that isn't always possible to do given that these might run on build agents in the cloud. I'm guessing there are other restrictions that people have seen in their implementations.

neil
2018-10-16 09:07
Speaking from my experience with moving from v1 to v2, trying to rally some support to build version 2 natively in the community was a real uphill battle. There were people who wanted to help, however nothing eventuated after quite some time of discussions.

neil
2018-10-16 09:11
In the end I made the decision to move to using the ruby core, as the .NET version was trailing so far behind and having matchers was a really nice feature. I also didn?t want to be trailing that far behind next time. The idea is that building some language specific facades is a lot easier, than building the feature multiple times in each supported language.

neil
2018-10-16 09:12
And hopefully it?s a more palatable chunk of work for someone in the community to break off as well

heymega
2018-10-16 09:15
Makes sense when you put it that way Neil. I guess its one of the downsides of OSS. I'm surprised more people aren't prepared to help out given how awesome and useful the library is.

neil
2018-10-16 09:15
Our goal is to keep using this model, however hopefully we can make it feel more native with less trade offs

neil
2018-10-16 09:19
There have been some really awesome contributions, don?t get me wrong. From what I have seen though, I?d guess that a lot of the OSS contributions come from peoples free time (including most of mine now days) and as a society we are just getting busier and busier.

neil
2018-10-16 09:22
Over in #pact-net it may be worth chatting about the issues you are running into with running the pact tests on cloud agents. There may be a solution, that someone knows?

heymega
2018-10-16 09:52
That's a great idea Neil. I'll drop a question on the issues section.

matt.fellows
2018-10-16 10:20
The more languages that we want to have Pact work with exponentially increases time to market for new features and ongoing maintenance. We identified a few years ago that a) more languages were in demand and b) that we couldn't scale to implement new features (and thus compatibility across languages)

matt.fellows
2018-10-16 10:21
We all use pact on our own projects and so dogfood them regularly. There are likely going to be some restrictions as you note, but outsourcing the core logic means we can start to focus efforts elsewhere (e.g. docs, better DX etc)

matt.fellows
2018-10-16 10:22
If there are issues though, we want to know!

pact-slack
2018-10-16 10:54
Thanks for making things clear. You're right, transport mechanism is of lesser importance. So, at the concept level, you still would start to write the contract on the consumer side even though the producer is upstream and technically (because of decoupling) not interested which consumers exist. To bring a DDD based example (assuming team A is upstream): Team A would define their Ubiquotous Language, then team B (which wants to use events from team A) would define a contract (event content) in that language and give it to team A. Thus there would be no waste on team A side and the team would still be able to use its own language for the events.

marco.dellolio
2018-10-16 23:04
~moved to pact.js channel~

abubics
2018-10-17 00:16
From an analysis perspective, you should probably work on your domain language well before starting development :stuck_out_tongue:

abubics
2018-10-17 00:17
but, more seriously, one of the early points highlighted in the docs is that Pact isn't intended to replace conversation

abubics
2018-10-17 00:18
So, it shouldn't matter who is upstream . . . usually the initial consumer/provider pair should work out a domain model that works for their intended use cases, and extension considerations

abubics
2018-10-17 00:18
You can design a model, and an API, and then only implement the bits as you need them :ok_hand:

mboudreau
2018-10-17 00:36
yeah, it all comes down to a single library to rule them all. Currently it's ruby, but we've been making efforts towards a Rust c library implementation that should work in process in most languages. Consistency is key for this because if the implementation is different for each language, it could break contracts making the product useless

alejandro.exequiel.ca
2018-10-17 19:44
has joined #general

pact-slack
2018-10-18 22:24
:grinning::+1:

igit.soeriasaputra
2018-10-19 04:44
has joined #general

privat.sebastian.muel
2018-10-21 09:56
has joined #general

rr.1.riou
2018-10-22 11:02
has joined #general

rr.1.riou
2018-10-22 11:04
Hey guys, nice to meet you! I am looking for an exemple of pact on top of native jest on a create-react-app? If there is some best practice, how is the best way to set it up! thanks in advance! Erwan

abubics
2018-10-22 11:38
Try in #pact-js, but this seems like a thing that's covered in the ToC on http://docs.pact.io :thinking_face:

rr.1.riou
2018-10-22 12:42
Yes i already found exemple, acutally a lot of differents ones. I apply this one (https://github.com/arkency/react-example-pact/blob/master/src/App.test.js) but its seems it creating errors. Probably due to the new architecture version of react release recently. So i was looking for a 'recommanded reference'

abubics
2018-10-22 23:00
Yeah, I wouldn't go with Enzyme for Pact testing. These network interface unit tests should avoid DOM & browser dependencies :slightly_smiling_face:


abubics
2018-10-22 23:24
Some bits of this example are outdated (e.g. `publish.js` is no longer required)

yunxing.wang
2018-10-23 07:44
has joined #general

rr.1.riou
2018-10-23 08:58
Yes i actually clone this test but i can't manage launch it, its very weird : ``` PS C:\Users\eadrien\Desktop\pact-js\examples\jest> cd __tests__ PS C:\Users\eadrien\Desktop\pact-js\examples\jest\__tests__> npm test > jest@1.0.0 test C:\Users\eadrien\Desktop\pact-js\examples\jest > jest __tests__/ --runInBand --setupFiles ./pactSetup.js --setupTestFrameworkScriptFile ./pactTestWrapper.js No tests found In C:\Users\eadrien\Desktop\pact-js\examples\jest 9 files checked. testMatch: **/__tests__/**/*.js?(x),**/?(*.)(spec|test).js?(x) - 3 matches testPathIgnorePatterns: \\node_modules\\ - 9 matches Pattern: __tests__/ - 0 matches PS C:\Users\eadrien\Desktop\pact-js\examples\jest\__tests__> ```

rr.1.riou
2018-10-23 09:32
i also created an issue on the pact-js since its really doesn't work to install properly


kanohen
2018-10-23 15:19
Hello guys, Please, I have a pact test on my producer. The producer is a Gradle spring project. I have added the pact test to a pact directory in my test folder. When I run ./gradlew test --info, every test in the test folder runs except the pact test. For some reason Gradle isn't aware of that test. However , when I run it locally, without using Gradle, it works fine. Is there some configuration I need to add to my build file to notify Gradle of the pact folder?

gopinathlangote11
2018-10-23 16:31
It depends upon how you gradle test script works.

gopinathlangote11
2018-10-23 16:32
Could you please share the `build.gradle` file along with you test package structure

tom.hombergs
2018-10-23 19:47
I have exactly the same issue

tom.hombergs
2018-10-23 19:48
and no clue how to debug it...any help is appreciated :slightly_smiling_face:

abubics
2018-10-23 21:45
Also, take this to #pact-jvm for more targeted help :)

tarcio.saraiva
2018-10-23 23:09
has joined #general

tarcio.saraiva
2018-10-23 23:10
hello :wave:

tarcio.saraiva
2018-10-23 23:11
unfortunately I come with a problem: seems like pact broker is down?

tarcio.saraiva
2018-10-23 23:11
we are getting a 404 here

bethskurrie
2018-10-23 23:12
@matt.fellows

bethskurrie
2018-10-23 23:13
@kong are you able to check? I'm afk.

tarcio.saraiva
2018-10-23 23:43
sorry disregard my message earlier guys

tarcio.saraiva
2018-10-23 23:49
false alarm - I was given the wrong information; it turns out a pact file was missing - all is well :tada:

kong
2018-10-23 23:50
thanks @tarcio.saraiva .. sorry , just saw this.

kanohen
2018-10-24 08:27
Sorry guys,I didn't get a notification that my message was replied. Hence, my late response. @gopinathlangote11 could you elaborate more on how the Gradle test script could have affected this?

kanohen
2018-10-24 08:28
My test package has the test folder with sun folders. Say sub folders A and B. In A is another subfolder C which contains my pact test. Every tests in folder A and B are hit but folder C is never hit.

kanohen
2018-10-24 08:29
Here is my test class ``` @RunWith(RestPactRunner.class) @Provider("hombrew") @PactBroker(host="pact-broker.europe-west6.prod.cloud", port="80") public class ProviderTest { @TestTarget // has to be public public final MockMvcTarget target = new MockMvcTarget(); private Controller controller = new Controller(someContainer); @Before public void setup() { target.setControllers(modelController); } } ```

nishantv12
2018-10-24 08:47
has joined #general

kanohen
2018-10-24 09:55
My Gradle build: ``` group = '{UNNECESSARY}' buildscript { ext.springVersion = '5.0.6.RELEASE' ext.springBootVersion = '2.0.2.RELEASE' ext.micrometerVersion = '1.0.4' ext.jUnitVersion = '5.1.0' ext.versionpath = 'src/main/resources/version' ext.restAssuredVersion = '3.1.0' repositories { mavenLocal() maven {url = "URL_TO_ARTIFACTORY"} } dependencies { classpath("io.franzbecker:gradle-lombok:1.11") classpath("org.springframework:spring-core:${springVersion}") classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") classpath("org.unbroken-dome.gradle-plugins:gradle-testsets-plugin:1.0.2") } } def getGitHash = { -> def stdout = new ByteArrayOutputStream() exec { commandLine 'git', 'rev-parse', '--short', 'HEAD' standardOutput = stdout } return stdout.toString().trim() } def getGitBranch = { -> def stdout = new ByteArrayOutputStream() exec { commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD' standardOutput = stdout } return stdout.toString().trim() } def versionString = "0.1.0" apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: "io.franzbecker.gradle-lombok" apply plugin: "application" sourceSets { main.java.srcDir "src/main/java" main.resources.srcDir "src/main/resources" test.java.srcDir "src/test/java" test.resources.srcDir "src/test/resources" integrationTest { java.srcDir file('src/integration-test/java') resources.srcDir file('src/integration-test/resources') } } repositories { mavenLocal() maven {url = "URL_TO_REPO"} } //ignore the class name.. mainClassName = '{application_className}' sourceCompatibility = 1.8 targetCompatibility = 1.8 gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" } } dependencies { // H2O compile files("libs/h2o-genmodel.jar") // Spring compile("org.springframework:spring-core:${springVersion}") compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") // uncomment the following to switch from tomcat to jetty as the server // { exclude(module: 'spring-boot-starter-tomcat') } // compile('org.springframework.boot:spring-boot-starter-jetty') compile("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}") testCompile("org.springframework.boot:spring-boot-starter-test:${springBootVersion}") // Metric instrumentation compile("io.micrometer:micrometer-core:${micrometerVersion}") compile("io.micrometer:micrometer-registry-prometheus:${micrometerVersion}") // Logging compile("org.slf4j:slf4j-log4j12:1.8.0-beta2") compile("org.slf4j:jcl-over-slf4j:1.7.12") //Annotation Processor annotationProcessor("org.projectlombok:lombok:1.18.0") // File IO compile("org.yaml:snakeyaml:1.21") // Testing testCompile("com.jayway.jsonpath:json-path:2.2.0") testImplementation("org.junit.jupiter:junit-jupiter-api:${jUnitVersion}") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${jUnitVersion}") // Contract testing testCompile("au.com.dius:pact-jvm-provider-spring_2.11:3.5.2") testCompile("au.com.dius:pact-jvm-model:3.5.2") integrationTestCompile("commons-collections:commons-collections:3.2.2") integrationTestCompile("io.rest-assured:rest-assured:${restAssuredVersion}") integrationTestCompile("io.rest-assured:json-schema-validator:${restAssuredVersion}") integrationTestCompile sourceSets.main.output integrationTestCompile configurations.testCompile integrationTestCompile sourceSets.test.output integrationTestRuntime configurations.testRuntime } configurations.all { exclude group: "commons-logging", module: 'commons-logging' } test {

kanohen
2018-10-24 09:55
useJUnitPlatform() dependsOn 'cleanTest' } task integrationTest(type: Test) { group = 'Verification' description = 'Integration tests against a running instance.' testClassesDirs = sourceSets.integrationTest.output.classesDirs classpath = sourceSets.integrationTest.runtimeClasspath systemProperties['jar.path'] = jar.archivePath systemProperties['server.host'] = System.properties['server.host'] } task wrapper(type: Wrapper) { gradleVersion = "4.5.1" } task('cleanVersionText') { group = 'Resource Processing' description = "Delete the files holding the version text" doLast { delete("$projectDir/$versionpath/VERSION") delete("$projectDir/$versionpath/GITHASH") delete("$projectDir/$versionpath/GITBRANCH") } } task('versionText') { group = 'Resource Processing' description = "Write the version string, git branch and git hash to three local files in the jar" doLast { mkdir("$projectDir/$versionpath") new File("$projectDir/$versionpath/VERSION").text = versionString new File("$projectDir/$versionpath/GITHASH").text = getGitHash() new File("$projectDir/$versionpath/GITBRANCH").text = getGitBranch() } } versionText.dependsOn(cleanVersionText) clean.dependsOn(cleanVersionText) // we want the build to depend on the version task so that the version/GITHASH file is always up to date processResources.dependsOn(versionText) //tasks.withType(Test) { // reports.html.destination = file("${reporting.baseDir}/${name}") //} task testReport(type: TestReport) { group = 'Verification' description = 'Moves the test reports to a location where they can be found by gocd.' destinationDir = file("$buildDir/reports") // Include the results from the `test` task in all subprojects reportOn subprojects*.test } tasks.withType(Jar) { task -> // Includes War and Ear manifest { attributes('Modelservice-Release-Version': versionString) attributes('Modelservice-Release-Githash': getGitHash()) attributes('Modelservice-Release-Gitbranch': getGitBranch()) } } ```

jeroen.claassens
2018-10-24 13:54
has joined #general

jeroen.claassens
2018-10-24 14:08
Hello, I'm looking for some help. I am tackling the task of upgrading the npm dependencies in my corporation and along with that i want to upgrade the old `pact` v3.0.1 (pact-consume-js-dsl) to the new `@patch-foundation/pact` (pact-js) v7.0.1. Since I cannot find any migration guide between these two packages I figured I'd join this server to get support. Right now I'm facing an issue with Pact Term. In our project we use `Pact Term` (`Patct.Matchers.Term`) however when following what is written here in the docs (https://docs.pact.io/getting_started/matching#regular-expressions) I get the error ``` 'Content-Type': _pact.Pact.term({ ^ TypeError: _pact.Pact.term is not a function ``` This happens in a `beforeEach` block at the `headers` property and we use Pact Terms many times after that too. Section of code:

dagarwal
2018-10-24 14:48
Hello all , do u push pact tests to pact broker only from master branch or from all the branches .Is their a way we can restrict our test only for master branch .I tried with few npm dependencies .It all works fine on my local but I am not able to get branch name on jenkins .Any suggestions ?

alex
2018-10-24 15:36
has joined #general

zhirschtritt
2018-10-24 17:42
has joined #general

matt.fellows
2018-10-24 20:18
@dagarwal the answers to all of your questions are at https://github.com/pact-foundation/pact_broker/wiki and specifcally probabaly https://github.com/pact-foundation/pact_broker/wiki/Using-tags.

matt.fellows
2018-10-24 20:19
Publish all of your pacts, and use tags to separate the important ones (e.g. your `master` code line generated pacts) from WIP ones. On the provider side, you should be able to configure the fetch to only grab the relevant tags.

dagarwal
2018-10-25 08:04
Ok thank you ,will give a look :slightly_smiling_face:

matt.fellows
2018-10-25 09:16
:+1:

michael.ohegarty
2018-10-25 13:50
has joined #general

zdprescott
2018-10-25 18:25
has joined #general

shidhore.ajinkya
2018-10-26 10:14
has joined #general

marco.dellolio
2018-10-28 02:58
Hello! Thank you for the support so far, you guys are amazing. Today question is about JWT. Testing the matching of a signed JWT token it is out of scope for PACT? Should I just the ?three parts? structure for a JWT. What?s your opinion/experience about it?

liran.tal
2018-10-28 08:04
@marco.dellolio heyas can you explain more specifically how is JWT related to your contract tests?

matt.fellows
2018-10-28 08:47
Are you looking to test JWT contract itself, or authenticated APIs that use them?

marco.dellolio
2018-10-28 11:44
Every API request must be authenticated using a signed JWT containing url and parameters in the signature.

matt.fellows
2018-10-28 11:49
ok cool. The problem will be that whatever you put into the consumer contract will (likely) be invalid when it is later verified by the provider (assuming it?s short-lived)

matt.fellows
2018-10-28 11:50
I would on the consumer side, generate the JWT and ensure it?s in the request (you can use matchers to ensure it matches the expected query string)

matt.fellows
2018-10-28 11:51
For the verification, assuming it?s JS, use the `customProviderHeaders` option of the verifier to dynamically overwrite it with a valid token for the test https://github.com/pact-foundation/pact-js/#verification-options

matt.fellows
2018-10-28 11:53
Alternatively, disable the JWT verification code in your Provider, as @tom.hombergs advocates in his recent article: https://reflectoring.io/pact-node-provider/

matt.fellows
2018-10-28 11:54
I personally prefer this option, on the assumption that a) it is easy enough to mock the JWT authorization implementation in the provider, and b) you have sufficient test coverage of that sub-system through other types of testing

matt.fellows
2018-10-28 11:54
@liran.tal you should add all of the articles from @tom.hombergs to your `awesome-contract-testing` repo :slightly_smiling_face:

tom.hombergs
2018-10-28 12:14
:slightly_smiling_face:

liran.tal
2018-10-28 17:02
@matt.fellows will definitely add! Thanks for the mention :slightly_smiling_face:

marco.dellolio
2018-10-28 20:14
Thank you guys, according to this, a testing case ?return 403 {error: ?..} if request if the jwt doesn?t contain the correct signature? can be considered out of scope.

matt.fellows
2018-10-28 20:16
I would still consider testing that case, and another with a slight modification - "no JWT present"

matt.fellows
2018-10-28 20:17
It should be possible to generate an invalid JWT but if not then test not supplying it at all

abubics
2018-10-28 22:08
"Invalid" sounds like too vague a use case. Even if that's the level of detail in the error, there are lots of reasons it could be invalid (e.g. expired, malformed, wrong signature, etc), which are more relevant to the testing context :slightly_smiling_face:

matt.fellows
2018-10-28 23:59
true. From a contract point of view, you probably want to capture the different responses from the system - e.g. `401`, `400` and `403` type errors. They can often be generated by different means, so worth thinking through what you need/want to test, vs what you can test via other means

abubics
2018-10-29 00:09
(and what isn't worth testing, because the library/protocol does it for you)

efoshager
2018-10-29 02:30
has joined #general

shidhore.ajinkya
2018-10-29 13:58
Hi everyone! I have implemented PACT on consumer side and I was able to publish *.json pact file to PactBrocker using following code in dotnet core. var pactPublisher = new PactPublisher("http://johnsoncontrolsinc.pact.dius.com.au", new PactUriOptions("***", "***")); pactPublisher.PublishToBroker($"..\pacts\userservice.api-event.api.json", "1.0.2"); On provider side, when I try to verify the same published Pact, using a unit test case (see below code): IPactVerifier pactVerifier = new PactVerifier(config); pactVerifier .ProviderState($"{_providerUri}/provider-states") .ServiceProvider("Event.API", _providerUri) .HonoursPactWith("UserService.API") .PactUri("http://johnsoncontrolsinc.pact.dius.com.au/pacts/provider/Event.API/consumer/UserService.API/version/1.0.2", new PactUriOptions("***", "***")).Verify(); I get below error when I run that unit test. Can someone please help? PactNet.PactFailureException : Pact verification failed. See output for details. If the output is empty please provide a custom config.Outputters (IOutput) for your test framework, as we couldn't write to the console. at PactNet.Core.PactCoreHost`1.Start() in C:\projects\pact-net\PactNet\Core\PactCoreHost.cs:line 139 at Event.Test.EventApiTests.EnsureEventApiHonoursPactWithConsumer() in C:\POC\pact2\Event.Api\Event.Test\EventAPITests.cs:line 55 Error reading file from http://johnsoncontrolsinc.pact.dius.com.au/pacts/provider/Event.API/consumer/UserService.API/version/1.0.2 No connection could be made because the target machine actively refused it. - connect(2) for "http://johnsoncontrolsinc.pact.dius.com.au" port 80 C:/POC/pact2/Event.Api/Event.Test/bin/Debug/netcoreapp2.0/pact-win32/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `initialize' C:/POC/pact2/Event.Api/Event.Test/bin/Debug/netcoreapp2.0/pact-win32/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `open' C:/POC/pact2/Event.Api/Event.Test/bin/Debug/netcoreapp2.0/pact-win32/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `block in connect' C:/POC/pact2/Event.Api/Event.Test/bin/Debug/netcoreapp2.0/pact-win32/lib/ruby/lib/ruby/2.2.0/timeout.rb:74:in `timeout' C:/POC/pact2/Event.Api/Event.Test/bin/Debug/netcoreapp2.0/pact-win32/lib/ruby/lib/ruby/2.2.0/net/http.rb:878:in `connect' C:/POC/pact2/Event.Api/Event.Test/bin/Debug/netcoreapp2.0/pact-win32/lib/ruby/lib/ruby/2.2.0/net/http.rb:863:in `do_start' C:/POC/pact2/Event.Api/Event.Test/bin/Debug/netcoreapp2.0/pact-win32/lib/ruby/lib/ruby/2.2.0/net/http.rb:852:in `start'

zhirschtritt
2018-10-29 15:09
Hi all, question regarding best practices: If I have a provider that does some external data-lookups when you hit an endpoint, what?s the best practices for mocking out those requests? For example, if I have a consumer that hit?s a provider endpoint `/gatherAllTheData` and the provider reaches out to a number of other services to synchronously aggregate data.

efoshager
2018-10-29 17:52
Hi All, is there a way to only test against specific elements? As opposed to the whole provider

anfalsiddiqui
2018-10-29 21:14
has joined #general

matt.fellows
2018-10-29 21:23
My guess is that You?re hitting it on `http` (port `80`) but it needs to be `https` (port `443`). My guess is either a) the publisher isn?t actually working or b) it is able to handle the redirect to https but the verifier isn?t

matt.fellows
2018-10-29 21:23
OR you?re inside a proxy environment and not allowed to connect to that host?

matt.fellows
2018-10-29 21:25
The answer is yes, depending on which language/library you use.

matt.fellows
2018-10-29 21:25
e.g. in pact js:



matt.fellows
2018-10-29 23:38
There are a couple of relevant sections there, andn a link to this gist: https://gist.github.com/bethesque/43eef1bf47afea4445c8b8bdebf28df0

hansrd_98
2018-10-30 05:08
has joined #general

romuald.quantin
2018-10-30 13:24
Sorry for the long block of text, I'm happy to take that somewhere else if that's not the right place. I got an issue, not caused by pact itself but more as a conceptual question caused by the way the pact mock service is used. This page does not cover everything: https://github.com/pact-foundation/pact-mock_service/wiki/Using-the-mock-service-with-CORS In case you make a request from a browser, the Origin header will be sent, the pact mock service can just return `Access-Control-Allow-Origin: *` for it to work. However, if you make request with `withCredentials`, chrome for example will not take a wildcard for answer (https://stackoverflow.com/questions/42803394/cors-credentials-mode-is-include). That's why most backend framework instead takes the Origin value and send it back as `Access-Control-Allow-Origin`, for example for it could look like: ``` withRequest: { headers: { 'Origin': 'http://mydomain.com', willRespondWith: { headers: { 'Access-Control-Allow-Origin': 'http://mydomain.com', ``` Unfortunately, doing this will prevent you making request against the pact mock service from let's say, a localhost. The solution could be to add a matcher and with a wildcard: ``` willRespondWith: { headers: { 'Access-Control-Allow-Origin': Pact.Matchers.somethingLike('*'), ``` This will make you able to request from a localhost domain, to the pact mock service, but the only thing you want to make sure is that `'Access-Control-Allow-Origin` contains `http://mydomain.com` so that your app can call your service, and this doesn't do the job. Any thoughts?

zhirschtritt
2018-10-30 14:06
thanks Matt!

shidhore.ajinkya
2018-10-30 18:02
Thanks a lot @matt.fellows you both guresses are accurate :blush: . I need to hit https and also I was in my office's proxy environment. It works great at my home. Do you have any idea how to fix proxy issue in Visual Studio 2017 when I work in my office? I have the proxy server IP with me.

efoshager
2018-10-30 18:15
I'm a bit confused on consumers and providers in pact testing when only one endpoint is being tested. So the consumer generates a pact file based on the provider data being passed. This pact file is then tested against the contract?

efoshager
2018-10-30 21:26
What if the provider endpoint has like 30k lines? Does the consumer expect all 30k lines to be there?

bethskurrie
2018-10-30 21:28
The pact file *is* the contract.

bethskurrie
2018-10-30 21:31
Does the consumer care about every one of those 30k lines?

bethskurrie
2018-10-30 21:32
Can you set up a failing executable example in a repository? It always takes me a while to wrap my head around cors each time I pick it up again!

efoshager
2018-10-30 21:39
Sorry, I meant the pact file is then tested against the provider.

bethskurrie
2018-10-30 21:42
Yes

efoshager
2018-10-30 21:42
It did when I tested it. I added the provider data I wanted passed in the consumer, published, and it failed when I verified because it expected all the info.

bethskurrie
2018-10-30 21:42
Why is it different with only one endpoint?

efoshager
2018-10-30 21:43
I think I'm just confusing myself that both the consumer and provider have two separate endpoints. Thank you for clarifying!

abubics
2018-10-31 01:30
@efoshager ? It might help to clarify some vocabulary (for ease & consistency of communication) . . . - The implementation of the provider endpoint should be irrelevant to the consumer. I assume you mean the response is 30k lines? - Any consumer endpoint is generally implicit in an API client, not usually referred to as a separate concept/entity.

abubics
2018-10-31 01:32
- The pact test doesn't change the interaction of the consumer/provider, it's just more explicit about the sequence of communication.

abubics
2018-10-31 01:33
- The Pact-facilitated part of a contract test cares more about the shape of data than the values in the data. If you're writing tests that care about huge amounts of content (rather than structure), you might be better served with a different kind of test (e.g. unit test, not contract test)..

sylvia.yap
2018-10-31 05:20
has joined #general

matt.fellows
2018-10-31 07:31
It shouldn?t, we follow Postel?s law and only look at the bits we care about. Can you share your tests so we can understand why it?s failing?

matt.fellows
2018-10-31 07:32
Hi @shidhore.ajinkya not sure I?m afraid. You might have to ask Dr. Google :slightly_smiling_face:

bethskurrie
2018-10-31 08:04
If it failed because it expected "all the info" it's because the consumer expected "all the info".

romuald.quantin
2018-10-31 09:16
Hi Beth, setup is hard so that it might take a while, I'll think to the simplest way of showing you that. I keep you posted.


romuald.quantin
2018-10-31 09:27
Thank you, I'll check that. I might still start from scratch as I "might need" the PactJS version to do an xhr request.

paulswilliams
2018-10-31 11:41
So, I've also got a question about best practices, this time in relation to contract vs functional provider tests or possibly microservice / ui responsibility as described at https://docs.pact.io/best_practices/consumer/contract_tests_not_functional_tests The documentation advises contract tests be declarative about password complexity rules thus allowing password complexity rules to change over time with redeployments of the upstream service, without requiring consumer change. This is a great aim; a significant argument for micro-services and embracing different release cadences etc. However, perhaps it's a bad example, or perhaps I'm missing something, but I see a problem over this ambiguity; in this example the consumer also needs to understand the complexity rules to state them to the user either initially, or later if the user attempts to use an unsafe password. The UI needs to describe to users that passwords must be x length, contain this, that, and the other. The only solutions I see are: 1. the client understands at least a specification of the rules and is informed of breakage by server using some kind of status code, so the UI renders appropriate messages back to the user. These status codes would thus need Pact coverage to ensure reliable interoperability. This would break the documentation's advise? 2. the client knows nothing of the rules and if a user attempts an insecure password, the server encapsulates all responsibility of validation including rendering an error message eg error message string back through to the user via the consumer. This follows the documentation's advise and has the advantage of looser coupling between the components, and the ability to add new rules without redeploying the consumer. However, in my view, this would be breaking SRP; the service would be responsible in some part with UI concerns like the formatting of the error message, perhaps i18n etc. I'm wondering, is this just the wrong example to demonstrate non implementation contract tests, or am I missing something?

matt.fellows
2018-10-31 12:02
So I think that?s a good enough example. The password complexity logic will be contained within the API and as you state, you want to avoid breaking the SRP where possible, and you need a way to convey errors to the user. All that the functional test vs contract docs is saying, is that you don?t need to break all of the permutations of the password rules as part of your Pact testing. You?re probably going to have a standard `400` type error for a bad input, and then there should be an error body e.g. ``` { "error": "invalid password", "reason": "doesn't match complexity rule: > 10 chars", "code": 1234 } ```

matt.fellows
2018-10-31 12:03
that is a very contract-testable document, that you can now test without having to do all of the behaviour tests.

matt.fellows
2018-10-31 12:05
The Providers? job is to make sure it enforces the complexity rules, the job of the consumer is to make sure it can render messages. You should be able to design the consumer to gracefully handle new error codes (aka Postel?s Law) so that the system itself isn?t brittle

sarala_01
2018-10-31 12:38
has joined #general

borsuk.artem034
2018-10-31 13:55
has joined #general


romuald.quantin
2018-10-31 14:42
let me know if you have any problem running it

romuald.quantin
2018-10-31 14:42
there are 3 folders that explain the different CORS behavior


romuald.quantin
2018-10-31 14:44
again, just to be clear, this is not a pact-mock-service issue, it behaves in the right manner, it is just not accessible because of CORS issues

romuald.quantin
2018-10-31 14:45
we are not sure how we should approach this

romuald.quantin
2018-10-31 14:45
thanks in advance for any time taken looking at this!

romuald.quantin
2018-10-31 14:45
cheers.

paulswilliams
2018-10-31 14:58
Hey @matt.fellows, I'm not wondered away.. I'm just parsing and thinking. I have a slow brain :wink:

kevin.cormier
2018-10-31 15:02
has joined #general

matt.fellows
2018-10-31 20:12
No worries - I was resting my eyes :zzz: (7am our time now)

efoshager
2018-10-31 21:37
Any idea why I'm getting a 500 error when trying to generate a contract with a POST method? GET methods work fine.

bethskurrie
2018-10-31 21:40
What do the mock service logs say?

bethskurrie
2018-10-31 21:57
Can you raise an issue in one of the repos so I don't loose track of this @romuald.quantin?

romuald.quantin
2018-10-31 22:00
Sure, it is not exactly an issue, but I can summarize this in the pact-node or pact-mock-service repo. Tomorrow, cause that's the end of my day ;) cheers


efoshager
2018-11-01 14:04
node ./node_modules/mocha/bin/mocha ./test/pact/generate_reports/api.js --timeout 10000 Creating Pact Server with options: consumer = ui, cors = false, dir = C:\Projects\ui\pacts, host = 127.0.0.1, log = C:\Projects\ui\logs\pact.log, pactFileWriteMode = overwrite, port = 8993, provider = RegisteredCoupons, spec = 2, ssl = false, sslcert = , sslkey =

efoshager
2018-11-01 14:06
Created 'standalone\win32-1.61.1\bin\pact-mock-service.bat service --consumer 'UI' --pact_dir 'C:\Projects\ui\pacts' --host '127.0.0.1' --log 'C:\Projects\ui\logs\pact.log' --pact-file-write-mode 'overwrite' --port '8993' --provider 'RegisteredCoupons' --pact_specification_version '2'' process with PID: 21988

efoshager
2018-11-01 14:22
I, [2018-11-01T09:07:38.262193 #23576] INFO -- : Registered expected interaction POST /ok/user D, [2018-11-01T09:07:38.262193 #23576] DEBUG -- : { "description": "a request", "providerState": "a ui", "request": { "method": "POST", "path": "/ok/user", "headers": { "Content-Type": "application/json" }, - "body": { - "page": "browse", - "id": "201203164639", - "xpl": [ - "00891038001", - ] - } }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "body": { "couponDetails": [ { "summary": "3.00$", "expDueDays": -1, } ] } } } I, [2018-11-01T09:07:38.293393 #23576] INFO -- : Received request POST /ok/user D, [2018-11-01T09:07:38.293393 #23576] DEBUG -- : { "path": "/ok/user", "query": "", "method": "post", "headers": { "Accept": "application/json", "User-Agent": "axios/0.15.3", "Host": "localhost:8993", "Connection": "close", "Version": "HTTP/1.1" } } E, [2018-11-01T09:07:38.293393 #23576] ERROR -- : No matching interaction found for POST /ok/user E, [2018-11-01T09:07:38.293393 #23576] ERROR -- : Interaction diffs for that route: E, [2018-11-01T09:07:38.293393 #23576] ERROR -- : Diff with interaction: "a request" given "a ui" Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown { "headers": { - "Content-Type": "application/json" }, - "body": { - "page": "browse", - "id": "201203164639", - "xpl": [ - "00891038001", - ] - } + "body": null } Description of differences -------------------------------------- * Could not find key "Content-Type" (keys present are: Accept, User-Agent, Host, Connection, Version) at $.headers * Expected a Hash but got nil at $.body

efoshager
2018-11-01 15:19
Okay, I figured it out. Had to change my header in my axios request and add charset=utf-8 to my withRequest.

r.chinn
2018-11-01 15:50
has joined #general

r.chinn
2018-11-01 15:53
Hi All, Can anyone point me in the right direction for raising a potential bug?


bethskurrie
2018-11-01 20:33
@r.chinn Find the appropriately repository in the pact-foundation org, and give the steps to reproduce it, the expected behaviour, and the actual behaviour. An executable code example to reproduce the issue is also polite and will help get your issue addressed more quickly.

efoshager
2018-11-01 21:04
I'm having a similar 500 issue from what I posted earlier. This time it is when adding a query to the url

efoshager
2018-11-01 21:05
E,[2018-11-01T14: 45: 29.245780 #30696] ERROR -- : No matching interaction found for GET /api/v2/products/1/(Price + Details)?upc=422504 E,[2018-11-01T14: 45: 29.245780 #30696] ERROR -- : Interaction diffs for that route: E,[2018-11-01T14: 45: 29.245780 #30696] ERROR -- :

bethskurrie
2018-11-01 21:07
Can you see the interaction being set up in the logs?

bethskurrie
2018-11-01 21:07
What is the path and query?

anothonyvong
2018-11-01 21:35
has joined #general

hansrd_98
2018-11-02 01:10
hi folks, I?m experimenting with pact-js (having previously used the ruby version of pact a fair bit), and anm having difficulty getting provider tests to work. So, after running the consumer tests, I can see the pact now in the pact broker, and it looks legit. When running the provider tests, based on the example here: https://github.com/DiUS/pact-workshop-js/blob/master/provider/test/providerPact.spec.js I get this error: ``` TypeError: verifier.verifyProvider is not a function ``` The provider test looks like this: ``` const verifier = require('@pact-foundation/pact').Verifier const chai = require('chai') const chaiAsPromised = require('chai-as-promised') const expect = chai.expect chai.use(chaiAsPromised) describe('Pact Verification', () => { it('should validate the expectations of the mock consumer', function () { this.timeout(10000) let opts = { provider: 'PaymentService', providerBaseUrl: <I have the provider endpoint here> pactBrokerUrl: <Broker url>, pactBrokerUsername: <Broker username>, pactBrokerPassword: <Broker password>, publishVerificationResult: true, providerVersion: '1', } return verifier.verifyProvider(opts) .then(output => { console.log('Pact Verification Complete!') }) }) }) ``` Any ideas what I?m doing wrong?

abubics
2018-11-02 01:19
Hi @hansrd_98 :slightly_smiling_face: you'll get better targeted support in #pact-js

abubics
2018-11-02 01:19
But I think `require('@pact-foundation/pact').Verifier` is a constructor

abubics
2018-11-02 01:20
so you probably want `new Verifier().verifyProvider(...)`

hansrd_98
2018-11-02 01:42
Thanks @abubics . Didn?t realise there?s a dedicated channel for js :slightly_smiling_face: Anyways, got it working fine with the below: `const { Verifier } = require('@pact-foundation/pact');` and inside the `it` block, `await new Verifier().verifyProvider(opts)`

abubics
2018-11-02 01:46
Nice one :ok_hand:

matt.fellows
2018-11-02 03:13
hehe thanks!

kobvel
2018-11-02 08:48
has joined #general

kobvel
2018-11-02 08:50
Guys. Quick question - should we host Pact tests as a separate repository?

jerwinecares
2018-11-02 09:18
has joined #general

bethskurrie
2018-11-02 10:09
I wouldn't. They belong as part of your normal test suite. They would go where the rest of your tests go.

bethskurrie
2018-11-02 10:10
The advantage of contract tests is that they give you immediate feedback. You don't want to slow that down by moving them further away from your code.

jesus.medinilla
2018-11-02 13:07
Hi everyone! Anyone knows how we can install Pact Broker on premise in HA (high availability)? Is there any documentation regarding this topic?

liran.tal
2018-11-02 13:55
@jesus.medinilla I don?t know about high availability but just getting it installed on premise is easy with the docker base image: https://github.com/DiUS/pact_broker-docker what kind of traffic are you expecting that qualifies as a requirement for high availability?

jesus.medinilla
2018-11-02 13:58
Having running two different instances (at least) sharing the load and the data. I don't know if only sharing the database would be enough (plus a load balancer) or more configuration is needed to achieve this

mats.lundkvist
2018-11-02 14:15
hi, I just downloaded the latest pact-ruby-standalone 1.62.2 but when I try to run ```bin/pact-mock-service version``` I get the following error ```bin/pact/lib/ruby/bin/ruby: line 6: bin/pact/lib/ruby/bin.real/ruby: No such file or directory``` but the file exists with read and execute permission for all users. What am I missing?

efoshager
2018-11-02 14:26
I tried adding a specific query parameter and adding it to the path directly, both throw the same error

efoshager
2018-11-02 17:09
Okay, I figured this one out. I used the query parameter and left out the ?. And then hardcoded the query in the expectation

efoshager
2018-11-02 21:21
I have some mock data similar to this. Is there a way to just reference "menu-coupons" and "categories" without specifying everything else in categories?

bethskurrie
2018-11-02 21:31
Are you on alpine linux @mats.lundkvist?

jeffm
2018-11-02 22:36
has joined #general

matt.fellows
2018-11-02 23:22
If not that, check correct architecture too

matt.fellows
2018-11-02 23:23
Why would you want to do that? Are you not interested in the shape of those fields?

bethskurrie
2018-11-03 00:25
Yes, you can just expect an empty hash.

jjlehva
2018-11-03 12:34
has joined #general

jjlehva
2018-11-03 12:55
Hi all! I am trying out Pact for the first time (with node and js). I?ve been testing this with a small microservice system and I ran in to a small problem when I started figuring out how to verify the provider side of things. I got the pact broker running and my consumer tests properly publishes the pacts there :ok_hand: The problem is simply that I?ve got the consumer pacts created for integrations between `Client A` and `Api 1`. Now when I try to verify the pacts for `Api 1` I am left wondering how should I tackle the requests from `Api 1` to `Api 2`, `Api 3` and `Api 4` which happens when the clients requests the endpoint from the `Api 1`. Should I mock those requests from `Api 1` to the other Apis during the provider verification or do I have to really run all the rest of the Apis as well? That would then again lead to running real integrations which is kind of the thing I would like to get rid of? I am just wondering if I?ve got the whole concept of Pact wrong or just missing some details from the documents. Any help would be great! :slightly_smiling_face:

liran.tal
2018-11-03 13:55
@jjlehva congrats on your progress so far! your intuition is correct - API 1 should stub the downstream dependencies. It makes sense that API1 has contracts with API 2, 3 and 4 so you can use the contracts with them as stubs, or just stub them out completely without the contracts.

matt.fellows
2018-11-03 14:28
Your doing great @jjlehva!

matt.fellows
2018-11-03 14:29
There's a section on the http://docs.pact.io I think under provider best practices that talks about exactly this +with a link out to a gist).

joscha.alisch
2018-11-03 16:18
has joined #general

vishesh92
2018-11-05 06:12
https://hub.docker.com/r/pactfoundation/pact-stub-server/tags/ tag v0.1.0 & v0.1.1 were removed recently from docker and our tests started failing because of that and we will have to update the image version at multiple places. Does latest version of the stub server image break or gets breaking changes frequently?

uglyog
2018-11-05 06:13
Versions 0.1.0 and 0.1.1 have a serious defect. Use 0.0.9 or 0.2.0 instead

uglyog
2018-11-05 06:15
Latest is pointing to 0.2.0 now

vishesh92
2018-11-05 06:38
ok. Thanks.

mats.lundkvist
2018-11-05 07:54
I run arch linux. I have an older version that works ```bin/pact-mock-service version 2.8.0``` but I wanted to upgrade for a new project

mats.lundkvist
2018-11-05 08:15
fixed it, I had some issues with my machine. Thanks for your help

dora.daniluc
2018-11-05 12:14
has joined #general

iryna.feuerst
2018-11-05 13:13
has joined #general

efoshager
2018-11-05 15:09
Because then my contract will be extremely long. Would it be best practice to pass all data?

efoshager
2018-11-05 16:27
like 5k lines

jbbarquero
2018-11-05 19:21
has joined #general

guilherme.santos6
2018-11-05 19:36
has joined #general

jbbarquero
2018-11-05 19:38
Hello, this is my first message here

jbbarquero
2018-11-05 19:39
I want to publish pacts to a broker with HTTPS and a certificate issued by a custom CA so I need to provide a truststore

jbbarquero
2018-11-05 19:40
But I don?t find this option in the maven plugin: https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-maven



jbbarquero
2018-11-05 19:47
Is it possible to specify a trustore for publishing pact files into a Pact Broker with HTTPS with certificates issued by a custom CA?

josh.mccure
2018-11-05 23:00
has joined #general

efoshager
2018-11-05 23:02
Actual array is too long and should not contain a Hash at $.items[1] -Why am I getting this error when my contract is specifying a specific array?

uglyog
2018-11-05 23:15
Wow, nobody has needed to do that before. You can publish the pact files with a PUT request to the broker using something like curl and be able to supply certificates.

xcq1.defy
2018-11-06 09:25
has joined #general

a.carpe
2018-11-06 13:16
has joined #general

a.carpe
2018-11-06 13:28
~Hello I?m using the pact-ruby to verify a pact produced by pact-jvm in V3 format~

a.carpe
2018-11-06 13:29
~it fails because the matching rules contain the `combine` key~

a.carpe
2018-11-06 13:30
~``` "$.assignedTimeSlot": { "matchers": [ { "match": "type" } ], "combine": "AND" } ```~

a.carpe
2018-11-06 13:31
and fails with this error: ``` pact-support-1.8.0/lib/pact/matching_rules/v3/merge.rb:124:in `block (2 levels) in log_ignored_rules': undefined method `any?' for "AND":String (NoMethodError) ```


a.carpe
2018-11-06 13:42
made a mess, wanted to post on pact-ruby channel? if anybody can delete these messages it would be great

nigel.hannam
2018-11-06 15:15
has joined #general

aaronmckaynz
2018-11-07 03:44
has joined #general

hima.sanagavarapu
2018-11-07 19:19
has joined #general

nish
2018-11-07 22:35
has joined #general

matt.fellows
2018-11-08 09:07
I think you're probably still interested in the shape of each object in the array, but not all the array items. If so, You could consider array matches to make your tests more succinct but still cover off the contract.

hstene
2018-11-08 11:03
Is the pact-broker down? My team reports that their managed pact-broker is not responding?

alexander.premer
2018-11-08 11:08
has joined #general

hcw99498
2018-11-08 14:33
has joined #general

rnv27647
2018-11-08 15:04
has joined #general

efoshager
2018-11-08 16:07
@hstene it's not down for me

efoshager
2018-11-08 17:30
I see, thank you

zhirschtritt
2018-11-08 17:35
Our team is currently evaluating Pact and we?re not sure it?s the right fit. One scenario: we have known consumers who are expecting our API to provide specified message via POST. First of all, are we the consumers in that case, or is our customer? And second, is this a reasonable use for contract testing? Any thoughts would be appreciated! Thank you :pray:

efoshager
2018-11-08 22:06
Is it possible to verify multiple providers to pact broker from a single file?

efoshager
2018-11-08 22:23
found out a way but not sure if its best practice. i'm adding multiple options and then passing those options through multiple verifiers and not exiting until the last verify

mboudreau
2018-11-08 23:14
I think you might have mistyped that, first consumers = customers?

mboudreau
2018-11-08 23:14
the consumers would be whatever uses the API

mboudreau
2018-11-08 23:14
now, if your company only provides the API for 3rd parties to use, they are the consumers

mboudreau
2018-11-08 23:16
however, this doesn't mean you can't still have pact tests to make sure your APIs follow a contract, the only thing is that you don't have a real life consumer to base it on, which is fine. Contracts don't have to be made from the consumer, you could, if you're keen, just create the contract file by hand, or use the consumer DSL to create one for you which you then use to test your API

mboudreau
2018-11-08 23:18
not really, the whole point is that your provider should be unique in a way, hence the contracts are a many to one, consumer to providers respectively

mboudreau
2018-11-08 23:18
if what you're trying to accomplish is to 'reuse' code or contracts between providers, I'd suggest you do that through code reuse, but not contract reuse

mboudreau
2018-11-08 23:18
does that make sense?

hstene
2018-11-09 07:11
Our broker was on an overloaded worker instance. They moved it and it came back online :slightly_smiling_face:

kevin.cormier
2018-11-09 15:29
Hi All. We are looking at evaluating Pact in the next few weeks. I'm trying to find some guidance on securely running a pact broker in AWS while testing in travis. Does anyone have any recommended reading?

efoshager
2018-11-09 15:55
i don't want to reuse any contracts, just simply verify multiple providers from a single file. i have a single script in my package.json that i want to be executed to verify all 10 providers i'm using from a single file.

zhirschtritt
2018-11-09 16:36
ok, that clears things up. I was having a hard time convincing my team that the customer is the consumer, even though we initiate that particular communication via a POST

efoshager
2018-11-09 18:33
other teams at my work are writing the consumer contracts, multiple teams use my providers, i want to verify all providers from a single file. each provider is unique with its given name.


matt.fellows
2018-11-09 19:46
A simple option is nginx (or another proxy) with auth attached to it, then use Travis secrets to manage creda

matt.fellows
2018-11-09 19:46
Alternatively, you could add rack middleware to the app with your own custom auth

kevin.cormier
2018-11-09 20:41
@mr.matt.r.long Thanks for the info!

jani.jegoroff
2018-11-10 19:50
has joined #general

nihei.dev
2018-11-11 06:56
has joined #general

kamilmarkow
2018-11-11 15:05
has joined #general

liran.tal
2018-11-11 18:04
:wave: I created `awesome-contract-testing` as a repository to help consolidate all kinds of resources for this topic. would be great if you want to contribute: https://github.com/lirantal/awesome-contract-testing I?ll also gladly add you to the repo collaborators to help organize and curate content

silvia.pusterla
2018-11-12 09:14
has joined #general

silvia.pusterla
2018-11-12 09:14
Hi all, My name is Silvia and I?m from Data Natives. Glad to be part of your community! I wanted to let you know about our Data Natives conference that will take place on November 22-23. It focuses on key areas of Artificial Intelligence, Machine Learning, Internet of Things, FinTech, HealthTech and more. Our event aims to bridge the gap between technical innovation and business interests. We?d like to offer your community a 50% discount on tickets using this promo code: DN18LOVESCOMMUNITY. You can also enter the raffle for a free ticket here: https://datanatives.typeform.com/to/aKSIlv Please, find more info about the conference here: http://datanatives.io/ Hope to see you there!

nikolajs.cmihuns
2018-11-13 09:57
has joined #general

jesus.medinilla
2018-11-13 11:39
Hi, I'm trying to execute a provider validation using pact-provider-verifier (pact-1.61.2 , linux 64 version) but I've been unable so far: This is what I'm retrieving: pact-provider-verifier --pact-broker-base-url $PACT_BROKER_URL --provider-base-url http://**** --provider users_http_provider --provider-app-version=0.0.1-SNAPSHOT --publish-verification-results=false INFO: Fetching pacts for users_http_provider from http://***** INFO: Reading pact at http://*****/pacts/provider/users_http_provider/consumer/organizations_http_consumer/version/0.0.6-SNAPSHOT /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.8.0/lib/pact/matching_rules/v3/merge.rb:119:in `block (2 levels) in log_ignored_rules': undefined method `any?' for "AND":String (NoMethodError). Anyone can help me out with this, please? EDIT: The problem is this line: $stderr.puts "WARN: Ignoring unsupported #{key} #{value} for path #{path}" if value.any? from /ruby/2.2.0/gems/pact-support-1.8.0/lib/pact/matching_rules/v3/merge.rb file. "any?" method on strings is not supported is this ruby version

sandy
2018-11-13 13:02
has joined #general

dimas.kotvan
2018-11-13 18:13
has joined #general

efoshager
2018-11-13 19:22
is something like this possible? i want to very many providers in one file. the above code only executes the first opts1 then finishes. even with proccess.exit taken out, it still executes the first opts1 and finishes

matt.fellows
2018-11-13 19:52
Looks like maybe a bug, are you able to pleae submit a ticket with your pact file so we can repro?

matt.fellows
2018-11-13 19:53
Ideally, a gist or something to reproduce would be great

matt.fellows
2018-11-13 19:55
This is not currently possible but could be easily added. If you could please raise an enhancement request to pact js we can discuss there

matt.fellows
2018-11-13 19:56
You'll have to Manually loop for now.

matt.fellows
2018-11-13 19:56
May I ask more about your use case? It would seem unusual to be doing multiple providers at once

marco.dellolio
2018-11-13 20:41
Hey guys good evening/morning I have 2 question, confirmations really: 1 - There is not system in place to push a pact file when a Provider changes because is not of Pact was designed? 2 - We are not supposed to test consumers against in dev providers (using a specific `sha`)

efoshager
2018-11-13 21:04
its mainly because we're running our provider verification through a pipeline and has been requested to be in one file

tjones
2018-11-14 00:21
@marco.dellolio When the provider changes, you only need to do a new verification. Pact is driven by the consumer. You can think of a pact file as a consumer saying "hey, this is the behaviour I rely on". It's not a full API definition. This is a nice feature, as it means that provider changes that don't affect consumers (eg on API endpoints or data objects that aren't being used yet) don't break any tests

tjones
2018-11-14 00:23
If you have the scenario where a provider changes the API in a way that breaks consumers, verification will fail. This needs to be communicated to the consumers who can then update their api calls and tests (which will generate a new Pact file, which can then pass verification)

tjones
2018-11-14 00:24
If you're developing the API at the same time as using Pact, it's easiest to drive changes from the consumer. However, it is still possible to drive them from the provider.

tjones
2018-11-14 00:24
For your second question, I'm not sure I understand. Could you elaborate a bit?


tjones
2018-11-14 00:28
Hi all - I've had a couple of cases where I've written consumer tests in cases where provider verification is extremely impractical (eg third party providers). I think this is still valuable, as it ensures that you're using whatever client library correctly (it picked up a javascript case where `http://axios.post({options, url})` should have been `http://axios.post(url, options)`, whereas mocking `axios` might have missed it). Are there other advantages? What do people think?

ryan
2018-11-14 22:22
has joined #general

matt.fellows
2018-11-15 06:24
Why does it need to be in one file? How does that affect the pipeline? There's no reason you couldn't loop thru all providers in a single just file and run the verification per provider. Still I'd like to know more about why that's necessary. I can't think if many situations where you want to know all providers need to be verified at once. That seems like you're creating too much coupling. @bethskurrie @uglyog thoughts?

bethskurrie
2018-11-15 06:34
My thoughts are "why does it have to be one file? " too. Can you explain that constraint @efoshager?

matt.fellows
2018-11-15 07:40
I still do it

matt.fellows
2018-11-15 07:42
You still get the following benefits: 1. You still verify your collaborator?s behaviour (as you stated) 2. You get documentation 3. There can still be some ways to verify (but they are scary/hacky/dangerous/all of the above)

jonas.natten
2018-11-15 08:02
has joined #general

liran.tal
2018-11-15 12:30
4. if you use the broker to store the pact then you can also see which 3rd parties are used through-out your services very quickly

liran.tal
2018-11-15 12:30
also, will add all of this insight to my upcoming doc on the subject. great points!

ashwin.bakker_nl
2018-11-15 14:54
has joined #general

acooper106
2018-11-15 20:23
When using tags, our pact provider verification is verify against latest and pervious pacts. For example, we added a dev tag to the pact, then removed the dev tag and added a prod tag, then ran provider verification against the consumer pact with the dev tag and the test still found and ran against the previous pact with the dev tag. Is this the expected behavior? If so is there a way to run the provider verification against the latest pact on the broker?

tjones
2018-11-16 02:58
That'd be awesome @liran.tal!

kanwaldeepbhangu117
2018-11-16 07:37
has joined #general

mats.lundkvist
2018-11-16 08:26
Hi, I'm currently writing a provider test in golang with the pact standalone. But it looks like the pact is tested against values and not the correct matchers (regex and type) that is specified in the pact json. Is there some configuration needed to get regex and type matching to work? Edit: From what I can tell pact go cannot handle pact v3

matt.fellows
2018-11-16 09:33
@mats.lundkvist yes, only Pact JVM supports full pact v3 spec. Go/JS support the message pact portion of v3 and everything else is v2

bethskurrie
2018-11-16 09:33
But v2 supports type matching and regex

matt.fellows
2018-11-16 09:41
If it has the `combine` matcher in it then that won?t work, standard regex/type matching should work as per examples (I think you?ve indicated use of this in the past)

mats.lundkvist
2018-11-16 11:10
Thanks for helping!

nikolajs.cmihuns
2018-11-16 11:21
Question to some ... :slightly_smiling_face: If I want to create pact v3 tests for provider in Scala (but don't want to use Junit libs which we have e.g. pact-jvm-provider-junit) what core modules/libs I can rely on ? As I see I can use something from here - https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider

nikolajs.cmihuns
2018-11-16 11:22
but not sure if V3 is supported here

acooper106
2018-11-16 15:28
@bethskurrie Has anyone experienced this? Or know how to fix this?

ashwin.bakker_nl
2018-11-16 16:29
Anyone have experience with Pact in combination with Spring Cloud Contract? I've made a post on stackoverflow, maybe someone in here knows the answer https://stackoverflow.com/questions/53340847/spring-cloud-contract-pact-broker-json-string-can-not-be-null-or-empty

gregigcool
2018-11-16 19:57
has joined #general

ravbaker
2018-11-17 10:24
has joined #general

uglyog
2018-11-18 21:26
Yes you can, all the libraries support the V3 format but you'll have to write the test support code yourself. There is also a pure scala implementation https://github.com/ITV/scala-pact

uglyog
2018-11-18 21:27
But the pact-jvm-provider library contains the verifier used by the other test support modules.

sandy
2018-11-19 01:28
Hello, you were kind enough to provide us with a hosted pact broker, however I am unsure as to wether seeing a 404 on the base URL is normal. We have tried publishing our javascript pact via the binary, and have not been able to get a successful message. Any thoughts?

mboudreau
2018-11-19 01:37
what's the URL you're using?

sandy
2018-11-19 02:13
Its the one we were sent in the email. `https://liftango.pact.dius.com.au`

bethskurrie
2018-11-19 02:14
Hi Sandy. We recently did a cull of brokers that had no pacts and hadn't been used for over a month.

bethskurrie
2018-11-19 02:15
Is this your first pact?

sandy
2018-11-19 02:17
Ah, yes, we started evaluating a couple of months ago, and got sidetracked, but now were moving forward :slightly_smiling_face:

matt.fellows
2018-11-19 05:01
Your account may be disabled, we'll reenable for you

acooper106
2018-11-19 13:59
Or is there any material that would answer this question?

ashwin.bakker_nl
2018-11-19 14:41
Fixed it. My base class wasn't setup properly. See SO thread for working base class if curious.

ben7091
2018-11-19 16:29
has joined #general

sandy
2018-11-19 21:24
thanks, that would be awesome

matt.fellows
2018-11-20 05:51
Your account should be reactivated, apologies for the delay

nikolajs.cmihuns
2018-11-20 07:02
@uglyog thank you for answering:thumbsup:

nikolajs.cmihuns
2018-11-20 08:11
find it strange that we have AmqpTarget, BaseTarget etc. in pact-jvm-provider-junit lib, not in pact-jvm-provider

nikolajs.cmihuns
2018-11-20 08:12
so comes out that we don't have some general V3 support, only something which is coupled to framework specific things like junit

uglyog
2018-11-20 08:14
That is just historical. The Target classes were written for the JUnit implementation, which is why they are there.

uglyog
2018-11-20 08:17
The V3 support is implemented in the core libraries (matching, models, etc). The verifier in pact-jvm-provider uses the core libraries to do the actual matching. The specific framework libraries use the verifier.

sandy
2018-11-20 11:20
No problem, thanks Matt. I have been able to publish our first consumer pacts! really appreciate it.

sasa.milovic
2018-11-20 15:05
has joined #general

sasa.milovic
2018-11-20 15:19
Hi, I'm not sure if this is the right place to ask for support for a hosted pact broker?

sasa.milovic
2018-11-20 15:20
We've got one at https://asos.pact.dius.com.au, but it's been having issues last week and today again, we seem to be getting "Service Unavailable"

sasa.milovic
2018-11-20 15:22
Also, might be worth mentioning that the join slack link at https://pact.dius.com.au/ takes you to a "there's nothing here yet" heroku landing page :smile:

rjmcguinness
2018-11-20 15:58
has joined #general

uglyog
2018-11-20 21:34
@sasa.milovic we'll look into that for you. The previous slack was decommissioned in favour of the #pact-broker channel

abubics
2018-11-21 03:04
Hey y'all :slightly_smiling_face: We're trying to do some CDC testing for a legacy system (the consumer) written in C++, and not coming up with any good technology fits. Any recommendations?

abubics
2018-11-21 04:09
Looks like we're going to try making a Python test harness, treating the C++ system as a black box. Wish us luck xD

matt.fellows
2018-11-21 05:08
OK, that?s one option

matt.fellows
2018-11-21 05:09
another is to simply use the Pact CLI tools. On the provider side, it?s a cinch. On the consumer side, you might need to orchestrate a few calls to the mock service. Details/breadcrumbs: * How to write a consumer test, without a consumer language / DSL support * https://github.com/pact-foundation/pact-mock_service/blob/master/script/example.sh * how to write a provider test, without provider language / DSL support * https://github.com/pact-foundation/pact-ruby-standalone/releases

matt.fellows
2018-11-21 05:16
You?re welcome!

abubics
2018-11-21 06:20
The reason for attempting in python is there's a set of company-wide existing test harness codebases (in python), so it might've reduced the learning curve

lloydchang
2018-11-21 08:21
has joined #general

sasa.milovic
2018-11-21 12:58
Thanks!

ian.fessey
2018-11-21 16:22
has joined #general

sandy
2018-11-22 02:24
Hey folks, I have read what I could find about matching, and I have a question. We are using javascript, and I have a case where I want to be able to verify a pact where the value of the key in the object is treated the same way `like()` treats the values. i.e. ```pickingUpRides: { 9: { rideId: 9, passengerSeats: { standard: 1, wheelchair: 0, }, }, }``` so I am asking, can I create a pact response, where I want the key `pickingUpRides` to have a nested object with a key of type 'number' where I don't care about the value, but it must contain at least one nested object? And then to be able to verify the structure under `9` as per normal?

tjones
2018-11-22 02:34
I think JSON requires that keys are strings, so this might be challenging - the default pact matchers work on types

tjones
2018-11-22 02:35
I had a similar situation that we solved using states - the state was something like `a rides record with ID 9 exists`

sandy
2018-11-22 03:05
Yeah, the JSON spec requires a string, this was pulled from the JS... ill take a look at states, as we have decided to just couple the IDs in the interim between consumer/provider

sandy
2018-11-22 03:07
so the key type is not important as far as treating it as any allowed value

tjones
2018-11-22 03:14
for HTTP pacts, pact will verify what was on the wire

tjones
2018-11-22 03:14
(which is probably a string)

tjones
2018-11-22 03:17
As to whether you can use matchers to specify allowed formats for object keys, I'm not sure. Might be a @bethskurrie question

tjones
2018-11-22 03:17
> we have decided to just couple the IDs in the interim between consumer/provider States will let you describe the coupling in a nice way, so that any future provider implementations don't get surprised.

bethskurrie
2018-11-22 03:19
If you're using a non pact-jvm impl, I don't think it will even allow you to use a number as a key.

bethskurrie
2018-11-22 03:19
Let me do a quick experiment with ruby.

bethskurrie
2018-11-22 03:20
``` {9 => 'foo'}.to_json => "{\"9\":\"foo\"}" ```

bethskurrie
2018-11-22 03:20
Numbers are not allowed as keys.

bethskurrie
2018-11-22 03:20
By default, anyway

bethskurrie
2018-11-22 03:20
I really wouldn't recommend it.

sandy
2018-11-22 03:21
Thanks Beth, yes, I mistakenly thought typescripts ability to do this translated to the JSON spec. It doesn't.

sandy
2018-11-22 03:23
So we are planning to just have these tests be aware of the given ids until we can move to a new approach

bethskurrie
2018-11-22 03:23
:thumbsup::skin-tone-3:

acooper106
2018-11-22 04:26
When using tags, our pact provider verification is verify against latest and pervious pacts. For example, we added a dev tag to the pact, then removed the dev tag and added a prod tag, then ran provider verification against the consumer pact with the dev tag and the test still found and ran against the previous pact with the dev tag. Is this the expected behavior? If so is there a way to run the provider verification against the latest pact on the broker?

bethskurrie
2018-11-22 04:26
Don't remove the dev tag.

bethskurrie
2018-11-22 04:27
You say /latest/dev or /latest/prod

bethskurrie
2018-11-22 04:27
You don't typically remove tags

bethskurrie
2018-11-22 04:27
The overall latest is /latest


acooper106
2018-11-22 04:28
Not sure what you mean. I would expect that if the latest pact doesn't have a tag then the verification shouldn't run against it

bethskurrie
2018-11-22 04:29
@acooper106 please read these docs and tell me if you have any further questions

acooper106
2018-11-22 04:30
I would think a pact should have either dev or prod not both. Sure I'll check it out

bethskurrie
2018-11-22 04:30
Think of the tags as a history of its progress

bethskurrie
2018-11-22 04:31
It was at one stage dev, then it became prod

acooper106
2018-11-22 04:31
yes I'm not asking about urls

bethskurrie
2018-11-22 04:32
When you retrieve a pact by tag, you are always retrieving the latest pact with that tag.

acooper106
2018-11-22 04:32
I was talking about the provider verification running against a pact in history

bethskurrie
2018-11-22 04:33
The provider verification retrieves pacts by URL.

bethskurrie
2018-11-22 04:33
If you want to understand how the provider verification selects the pacts to verify, you should understand the URLs.

acooper106
2018-11-22 04:33
I don't have a url in my junit test. I guess that's what I'm looking for a doc on


bethskurrie
2018-11-22 04:34
The junit test will retrieve the latest pact for the tag you give it.

acooper106
2018-11-22 04:37
ok the latest pact on my broker only has prod tag. but the previous version pact has dev. When I run the provider verification it runs against the pact version with the dev tag.

acooper106
2018-11-22 04:38
I would expect it not to run against the previous version because the latest pact on the broker says prod

acooper106
2018-11-22 04:41
I wish there was a way to put the exact url in the test

bethskurrie
2018-11-22 04:41
What is your configuration?

acooper106
2018-11-22 04:41
when doing pact swagger validation the test needs the url of the pact your running against

acooper106
2018-11-22 04:50
I sent you the email with details on exactly what happened. What exact configurations do you need from me

acooper106
2018-11-22 04:56
I just checked the broker again. Currently this provider have 2 pacts with dev tags no prod tags. When I run the provider verification locally 2 pacts come up. and the broker updates the laste verified status. I would expect the test to say there were no pacts with "Prod" tag

bethskurrie
2018-11-22 04:57
That seems reasonable

bethskurrie
2018-11-22 04:58
I haven't used this plugin, but can you look at the documentation and see if there is a verbose option you can put on?

bethskurrie
2018-11-22 04:58
To get a better idea of the tags, can you have a look at the matrix view for this pact?

acooper106
2018-11-22 05:02
I did. the prod tag existed on version 1.0.0

bethskurrie
2018-11-22 05:03
So, there is a prod tag...

acooper106
2018-11-22 05:03
but the latest is only dev

bethskurrie
2018-11-22 05:03
And if you're configuring your test to verify the latest prod, then it will verify that one.

bethskurrie
2018-11-22 05:03
It finds the latest pact with the prod tag.

acooper106
2018-11-22 05:04
~run again latest prod~

bethskurrie
2018-11-22 05:04
It does not find the latest pact, and then see if it has a prod tag on it.

acooper106
2018-11-22 05:05
my latest pact is 1.0.1

bethskurrie
2018-11-22 05:06
If you have configured your test to verify the latest prod, then it should verify 1.0.0

bethskurrie
2018-11-22 05:06
If you have configured your test to verify the latest dev, then it should verify 1.0.1

bethskurrie
2018-11-22 05:07
If you have configured your test to verify the latest (with no tags specified, not recommended) then it will verify 1.0.1

acooper106
2018-11-22 05:07
can this be changed

acooper106
2018-11-22 05:08
the test only has tags no way to specify version

acooper106
2018-11-22 05:08
latest or otherwise

acooper106
2018-11-22 05:08
I would think latest would just be the one showing on the broker

bethskurrie
2018-11-22 05:09
When you specify the tag name, it will verify the latest pact with that tag.

bethskurrie
2018-11-22 05:09
> the test only has tags no way to specify version This is the normal behaviour.

acooper106
2018-11-22 05:09
I wasn't expecting it to go back in history to find prod tag over the latest version published

acooper106
2018-11-22 05:09
o

bethskurrie
2018-11-22 05:09
According to the images you sent me, it was configured with the "prod" tag.

bethskurrie
2018-11-22 05:10
I can see in the screenshot, `tags="PROD"`

bethskurrie
2018-11-22 05:10
That means it will verify the latest pact that has the prod tag.

acooper106
2018-11-22 05:10
yes but the current version on the broker is 1.0.1 DEV

acooper106
2018-11-22 05:11
I was expecting it to only look at that one and say there are no pacts with that tag

bethskurrie
2018-11-22 05:11
So, configure it to verify `tags="DEV"`

bethskurrie
2018-11-22 05:11
But there is a pact with dev and a pact with prod.

bethskurrie
2018-11-22 05:11
Which ever tag name you put in, it will find a pact.

bethskurrie
2018-11-22 05:13
If you put in "foobar" it should raise an error - there are no pacts with tag "foobar".

acooper106
2018-11-22 05:15
I see. I just thought it would check only check the latest version. But I see you've clarified that its expected to look at pervious versions for the tag

acooper106
2018-11-22 05:23
hmm now I think it makes sense because we don't want the provide build to fail when a consumer uploads a new pact with 1.0.1 dev. but I think the broker last veried is a little misleading since it just looks like 1.0.1 dev was varied, when actually it was 1.0.0 PROD that was varied. Maybe last verified should still be yellow.

acooper106
2018-11-22 05:25
why should this update when my tag is prod

fewstera
2018-11-22 09:55
has joined #general

roger.vieira
2018-11-22 12:51
has joined #general

roger.vieira
2018-11-22 13:03
Hi guys I have some doubts trying to use Pact in my projects: ? why I need to call a PactVerificationResult in order to generate the Pact's contract file (the one that is used to publish in Pact Broker)? ? is mandatory to use @Test annotation to call for a method that will generate Pact contract? Is there another way to call for contract generation? Maybe I've misunderstood about Pact application scenarios, but actually is not so clear for me the reason why I need to call a mock server using the contract in order to generate Pact file, imo this seems to be against Pact's purpose, because the main objective of Pact is to not "touch" in third parties' APIs, just test contract between consumers and providers.

roger.vieira
2018-11-22 13:04
(I'm not sure whether this is the right place for my questions)

romuald.quantin
2018-11-22 13:38
General question, we updated our nodejs version which support http2. Is there a correlation between pact and http2? If yes, where can I find more information?

uglyog
2018-11-22 21:02
Pact is a contract *testing* framework. It is designed for writing and executing contract tests. The actual pact file is just an artefact of the test execution on the consumer side.

tadeusz.rychter
2018-11-22 21:17
has joined #general

hans.hofkens
2018-11-22 21:32
has joined #general

paul.mckeown
2018-11-22 21:43
has joined #general

fraser.crichton.devel
2018-11-22 22:05
Hi there, I?m working at an organisation where we are at the early stages of investigating Consumer-Driven Contract Testing and looking at how to achieve this. Many of our API Services are Java Spring Boot applications and our clients are a mixture of React, Ember, mobile applications and service-to-service. Something that we are looking at currently is: https://cloud.spring.io/spring-cloud-contract/single/spring-cloud-contract.html Am just wondering if anyone else using Spring Cloud Contract? Is it mature? Are there any problems people have experienced implementing it? Thanks.

mboudreau
2018-11-22 22:40
What do you mean correlation?

lovesh.jain
2018-11-22 23:01
has joined #general

matt.fellows
2018-11-23 05:46
I haven?t used it personally, but I can say that it is mature and the community around it is very good. Marcin (project Lead) has also made aspects of it compatible with Pact, so there is some interoperability also

matt.fellows
2018-11-23 05:47
Any reason why you?re looking at it instead of Pact?

ots.indrek
2018-11-23 09:41
has joined #general

ots.indrek
2018-11-23 10:24
Hey, I have a question regarding preventing missing verifications https://docs.pact.io/best_practices/pact_nirvana#8-prevent-missing-verifications I have set up tagging when a deployment is made, also webhooks are in place that trigger provider CI jobs. > To reach Pact Nirvana, the final step is to have a CI build that checks out the code for the production version of your provider, and have it verify the same pacts that the head version does. Should the final step be part of the deployment? For example, if `can-i-deploy` reports that a verification is missing, the deployment script will do the verification? Or could this be done when a webhook triggers a provider CI job?

bethskurrie
2018-11-23 10:31
Is the content of the prod and dev pact the same?

bethskurrie
2018-11-23 10:31
The verification belongs to the content, so if they have the same content, they will both be verified

bethskurrie
2018-11-23 10:32
There is a good document on versioning in the broker on http://docs.pact.io

bethskurrie
2018-11-23 10:34
I'm not 100% sure this final step is necessary (and I wrote this document) so I would wait and see if you need it.

bethskurrie
2018-11-23 10:35
One way to do it would be to have a separate job that ran the verifications with the prod codebase that was triggered by a webhook.

ots.indrek
2018-11-23 10:49
Thanks, I'll first start without the final step then and see if I run into a situation where it might be needed

bethskurrie
2018-11-23 11:00
Yes, good plan. If you're deploying your provider regularly, I don't think you'll need it. I think it's mostly relevant if you have long gaps between deployments.

fewstera
2018-11-23 12:13
Any idea why pact-go isn?t working from inside a docker container? ``` 2018/11/23 12:10:38 [DEBUG] pact setup logging 2018/11/23 12:10:38 [DEBUG] pact setup 2018/11/23 12:10:38 [DEBUG] checking CLI compatability 2018/11/23 12:10:38 [INFO] checking pact-provider-verifier within range >= 1.15.0, < 3.0.0 2018/11/23 12:10:38 [DEBUG] running binary pact-provider-verifier 2018/11/23 12:10:40 [DEBUG] checking version for binary pact-provider-verifier version 1.21.0 2018/11/23 12:10:40 [DEBUG] checking if version 1.21.0 within semver range >= 1.15.0, < 3.0.0 2018/11/23 12:10:40 [DEBUG] 1.21.0 satisfies constraints 1.21.0 >= 1.15.0, < 3.0.0 2018/11/23 12:10:40 [INFO] checking pact-broker within range >= 1.16.0, < 2.0.0 2018/11/23 12:10:40 [DEBUG] running binary pact-broker 2018/11/23 12:10:41 [DEBUG] checking version for binary pact-broker version 1.17.0 2018/11/23 12:10:41 [DEBUG] checking if version 1.17.0 within semver range >= 1.16.0, < 2.0.0 2018/11/23 12:10:41 [DEBUG] 1.17.0 satisfies constraints 1.17.0 >= 1.16.0, < 2.0.0 2018/11/23 12:10:41 [INFO] checking pact-mock-service within range >= 2.9.8, < 3.0.0 2018/11/23 12:10:41 [DEBUG] running binary pact-mock-service 2018/11/23 12:10:42 [DEBUG] checking version for binary pact-mock-service version 2.12.0 2018/11/23 12:10:42 [DEBUG] checking if version 2.12.0 within semver range >= 2.9.8, < 3.0.0 2018/11/23 12:10:42 [DEBUG] 2.12.0 satisfies constraints 2.12.0 >= 2.9.8, < 3.0.0 2018/11/23 12:10:42 [DEBUG] setting up a service manager 2018/11/23 12:10:42 [DEBUG] setting up a service manager 2018/11/23 12:10:42 [DEBUG] setting up a service manager 2018/11/23 12:10:42 [DEBUG] pact provider verification 2018/11/23 12:10:42 [DEBUG] client: verifying a provider 2018/11/23 12:10:42 [DEBUG] waiting for port 8000 to become available 2018/11/23 12:10:42 [DEBUG] starting service creation monitor 2018/11/23 12:10:42 [DEBUG] starting service removal monitor 2018/11/23 12:10:42 [DEBUG] starting service creation monitor 2018/11/23 12:10:42 [DEBUG] starting service removal monitor 2018/11/23 12:10:42 [DEBUG] starting service creation monitor 2018/11/23 12:10:42 [DEBUG] starting service removal monitor 2018/11/23 12:10:52 [ERROR] Expected server to start < 10s. Timed out waiting for Provider API to start on port 8000 - are you sure it's running? 2018/11/23 12:10:52 [DEBUG] starting verification service with args: [./replaced-id-pact.json --custom-provider-header X-is-test: true --custom-provider-header X-user-details: {"name": "CDC User", "email":"", "groups": ["journalist", "content-editor"]} --format json --provider-base-url http://app:8000] ``` If I change the provider base url to localhost and run the tests outside of docker with the provider inside of docker it works fine.

fewstera
2018-11-23 12:14
``` func TestProvider(t *testing.T) { c := getConfig() pact := &dsl.Pact{ Consumer: "intel-cms-admin", Provider: "intel-cms-srvice", LogLevel: "DEBUG", } pact.VerifyProvider(t, types.VerifyRequest{ ProviderBaseURL: "http://app:8000", PactURLs: []string{replacedPactJSONFile}, CustomProviderHeaders: []string{ "X-is-test: true", fmt.Sprintf("X-user-details: %s", c.userDetailsJSON), }, }) } ```

fewstera
2018-11-23 12:15
I can curl http://app:8000 from inside the container, so it can see the provider

bernardo.guerreiro
2018-11-23 15:27
You shouldn't be using Pact to test third party API's. You use it to test services you control end to end, consumer/provider pairs. The mock server is replacing your provider API on the consumer side . You need it in order to generate the contract, because when you run your tests, as part of them, your mock server will be called (instead of your real provider), and return the interaction you defined for it. That moment when you've successfully called and received back the interaction you established is when the contract is generated. That contract is the whole point of pact. That then can be used by the real provider to test against the real endpoint.

fewstera
2018-11-23 16:30
^^ seems like a bug with this https://github.com/pact-foundation/pact-go/blob/c2dcd782ab0bb3ee4a6a689ba0c4083f31258628/dsl/client.go#L125 It appears to always assume your address is localhost, I guess it needs a similar function to getPort where it gets the host from the provider base url.

stevejbartholomew
2018-11-23 17:15
has joined #general

kristine.jetzke
2018-11-23 21:04
Hi, just in case someone is interested: I wrote a blog post on writing pact tests in spring boot and one one integrating the tests into Jenkins build pipelines using the pact broker: https://link.medium.com/q3cC0j8w5R and https://link.medium.com/4o0ZIqhx5R

matt.fellows
2018-11-23 23:34
In most cases, the contract doesn't change all that often, so in most cases what's already in prod can be checked with can I deploy.

matt.fellows
2018-11-23 23:35
This is for those edge cases Beth alludes to

matt.fellows
2018-11-23 23:36
Thanks for looking. I'll try to get to these next week. If you haven't already, raise a bug and a PR if you're interested - and we can get it sorted

matt.fellows
2018-11-23 23:39
Thanks, will take a read tonight! So many more strikes coming out now :pray:

jornhansen
2018-11-24 08:14
has joined #general

fewstera
2018-11-24 15:58
I will try raise a PR Monday :slightly_smiling_face: Spent most of Friday afternoon trying to solve a different issue that turned out to be a simple fix in the end :man-facepalming:

fraser.crichton.devel
2018-11-26 04:58
I?m not, but one of the teams I?m working with is and they are interested in exploring Spring Cloud as an alternative as they use Spring for all their services. Many of our other teams may choose plain Pact, so we just want to be sure the Pact Broker and Spring Cloud will play together. Yes, I have to say it seems to over complicate things but we want our teams to feel empowered to choose which tools they use hence trying to find out a bit more so we can help them along. Hope Melbourne is treating you well btw.

matt.fellows
2018-11-26 05:50
Oh - hello!

matt.fellows
2018-11-26 05:50
I replied via mobile but didn?t click - how?s it going?

matt.fellows
2018-11-26 05:51
And yes, totally get the ?pick the right tool for the situation/context/team? - always looking to see if there is something missing / broken that we need to address

matt.fellows
2018-11-26 05:51
How?s it all going? I?m (temporarily) in the states, but will be home in Melbourne next week. Where are you?

matt.fellows
2018-11-26 05:54
:slightly_smiling_face:

matt.fellows
2018-11-26 05:54
no worries, thanks

matt.fellows
2018-11-26 06:36
@kristine.jetzke nice work on the Jenkins example! It?s _pretty_ detailed - and we like that!

kristine.jetzke
2018-11-26 07:46
Thanks :blush:


syed.haq
2018-11-26 12:53
has joined #general

uma.shanker
2018-11-26 16:25
has joined #general

inbox
2018-11-26 16:39
Does the free pact broker expire?

matt.fellows
2018-11-26 16:53
Not for any active accounts, but if you haven't used it for several months and never pushed Tobit, we've probably disabled it

inbox
2018-11-26 20:15
I see. Would it be possible to reenable https://aramark.pact.dius.com.au/ ? or reapply for it? We've been busy with other work and haven't had an opportunity to push to it.

bethskurrie
2018-11-26 21:16
Send us an email to to remind me, and I'll do it at work today @inbox

inbox
2018-11-26 21:16
Thank you!

bethskurrie
2018-11-26 22:09
Done.

fraser.crichton.devel
2018-11-27 03:53
Am back in NZ. Hope you are enjoying the States - might try and get you a trip over this side of the Tasman :wink:

matt.fellows
2018-11-27 06:36
I?m keen! NZ is beautiful

matt.fellows
2018-11-27 06:36
Can we go in winter? :slightly_smiling_face:

shkutov.max
2018-11-27 16:39
has joined #general

fraser.crichton.devel
2018-11-27 20:10
We might be able to get you back in winter :wink:

christian.draeger1
2018-11-27 20:50
has joined #general

rahul.neotech
2018-11-27 21:01
has joined #general

zach.the.hammer
2018-11-27 21:14
has joined #general

zach.the.hammer
2018-11-27 21:24
are python pact people using pact-python or pactman? i'm just starting to play around with pact testing and since pactman supports the v3 spec i'd prefer to use that!

bethskurrie
2018-11-27 21:39
Pactman has v3 support, but pact-python has better broker integration. Depends which is more important to you.

zach.the.hammer
2018-11-27 21:53
anywhere i can read about the better broker integration?

zach.the.hammer
2018-11-27 22:06
to be more clear: is there a breakdown of differences between pactman and pact-python written anywhere?

james.carman
2018-11-27 22:27
Working on automation around pacts and CI/CD. In particular, we are writing Java services. I?m trying to figure out how folks typically rerun pact verification for an already released version of a service?

james.carman
2018-11-27 22:29
I would have previously verified the pacts that existed at release time. Now, suppose a new consumer comes along.

james.carman
2018-11-27 22:29
The pact verification is part of the ?normal build? or do we have a special job that we run dedicated solely to pact verification?

kristine.jetzke
2018-11-27 22:33
We usually have a dedicated job that is triggered by pact webhooks. I actually wrote a blog post about this a couple of weeks ago: https://link.medium.com/T9fZ1bhhcS

james.carman
2018-11-27 22:39
Fantastic! Right now we are using the hosted version, so the web hook won?t be able to reach our Jenkins box. But this is great info

bethskurrie
2018-11-27 22:41
Just make sure the separate job is also triggered by a commit to the provider, as part of your normal pipeline too.

james.carman
2018-11-27 22:43
Do folks typically run verification against an in-process, stubbed-out (the downstream dependencies) instance of the service?

james.carman
2018-11-27 22:43
Or a deployed version?

james.carman
2018-11-27 22:44
I like the idea of the isolation

rahul.neotech
2018-11-28 00:16
Hi :wave: I?m new to using pact and encountering a problem at the moment. Has anyone here used protobufs with pact ruby?

kristine.jetzke
2018-11-28 06:59
We mostly run verification against stubbed-out instances. But for some legacy applications we use the real ones.

stevejbartholomew
2018-11-28 12:22
Hi, I'm new to PACT and Javascript and am trying to run the https://github.com/DiUS/pact-workshop-js (successfully) but trying to switch out certain parameters to test for simple String equivalence (unsuccessfully) and I'm not clear where I'm going wrong

james.carman
2018-11-28 12:34
Are there any good examples of this pattern of running the verify test in isolation?

stevejbartholomew
2018-11-28 12:35
this maybe more to do with novice skills at using Mocha

james.carman
2018-11-28 12:35
By itself I mean

stevejbartholomew
2018-11-28 12:35
but....if anyone's willing to help, I can share code, would be most appreciated

stevejbartholomew
2018-11-28 12:41
specifically, my issue is in issuing the npm run test:pact:consumer command

stevejbartholomew
2018-11-28 12:41
and receiving the error:

stevejbartholomew
2018-11-28 13:09
pls ignore above - i'd overlooked a stack overflow question to which matt has kindly responded

kristine.jetzke
2018-11-28 14:23
I think it depends on your stack. We mostly use spring boot so it?s pretty straightforward with spring boot integration tests.

james.carman
2018-11-28 14:37
That?s what we use. Just trying to see how you set the test up to run by itself. Is it a separate project or is it ?in tree? with the rest of your code.

james.carman
2018-11-28 14:37
I know how to write the test itself

james.carman
2018-11-28 14:38
Just interested in strategies used to isolate it to be run by itself from a git tag

james.carman
2018-11-28 14:38
I hope I?m making sense here.

kristine.jetzke
2018-11-28 15:01
We have it in the same tree as all other code. They are named *ContractIT and we have added a maven profile to run only those

james.carman
2018-11-28 15:01
ok, that?s what I figured. Didn?t know if there was some other maven magic you were using :slightly_smiling_face:

james.carman
2018-11-28 15:02
Thank you so much for your insights, @kristine.jetzke

james.carman
2018-11-28 15:02
are you specifically running that exact test or just running only the failsafe plugin in the other profile?

kristine.jetzke
2018-11-28 15:10
We only run tests that match the *ContractIT pattern (using failsafe). We try to skip as many other steps as possible e.g. we exclude unit tests.

james.carman
2018-11-28 15:12
fantastic. I like it. Care to share your profile configs? :slightly_smiling_face:

james.carman
2018-11-28 15:12
I?m sure I can figure it out, but if you have it handy and it?s something you can share

kristine.jetzke
2018-11-28 15:15
I left the client where I implemented this last Friday so I don?t have access to the production code anymore. I have a small example with the profile: https://github.com/tinexw/cdc-with-pact/blob/master/user-service/pom.xml#L48

kristine.jetzke
2018-11-28 15:15
However, it does not include the surefire exclusion but that should be easily found.


james.carman
2018-11-28 15:16
so, exclude *all* from surefire and include only ContractTestIT in failsafe

james.carman
2018-11-28 15:16
this one looks like you?re only including ContractTest.java in surefire

kristine.jetzke
2018-11-28 15:16
Yes, that?s how we implemented it.

james.carman
2018-11-28 15:17
running them as unit tests, which is fine also

james.carman
2018-11-28 15:17
I don?t really need failsafe

kristine.jetzke
2018-11-28 15:17
Yes, that works too

james.carman
2018-11-28 15:17
Totally fine. I like it

james.carman
2018-11-28 15:17
Thank you again!

james.carman
2018-11-28 15:17
this is pretty slick!

kristine.jetzke
2018-11-28 15:17
good luck :slightly_smiling_face:

james.carman
2018-11-28 15:18
Yeah, now the trick is figuring out how to populate ?the matrix? properly with the right environment tags and what not, but this blog post seems to have that nailed down

james.carman
2018-11-28 15:18
I will soon achieve ?pact nirvana? :slightly_smiling_face:

james.carman
2018-11-28 15:18
I want to beef up my presentation to include this part.

kristine.jetzke
2018-11-28 15:18
Ah sorry. So yes, the example is only using surefire. In the production code we implemented it using failsafe and in the contract tests excluded all unit tests and all integration tests *except* the ContractIT ones.

james.carman
2018-11-28 15:19
I gave a talk going over the general stuff, but this is a really cool extension to that talk

james.carman
2018-11-28 15:19
I think Surefire is just fine.

kristine.jetzke
2018-11-28 15:19
Yeah, and the interesting part :wink:

james.carman
2018-11-28 15:19
exactly!

james.carman
2018-11-28 15:28
I don?t see any reference to it anywhere, but I figured I?d ask. Is the pact broker CLI available via homebrew?

james.carman
2018-11-28 15:28
I did a ```brew search pact``` and only found ?impactor?

matt.fellows
2018-11-28 17:33
@james.carman It?s not, but it?s something we?ve talked about

matt.fellows
2018-11-28 17:33
It would be an obvious thing to do :slightly_smiling_face:

matt.fellows
2018-11-28 17:33
Also Chocolatey/Nuget/whatever it is these days for Windows :slightly_smiling_face:

shirley.ong1
2018-11-28 18:30
has joined #general

bethskurrie
2018-11-28 21:34
When I looked at homebrew, one of the criteria was that the tool wasn't available via another means of installation, so I thought we might be excluded. Also, it had to be submitted by someone who wasn't the maintainer.

bethskurrie
2018-11-28 21:35
This was years ago though.

james.carman
2018-11-28 21:46
oh wow. I guess with the stuff happening with npm it might make sense to have rules like that

richard.jones
2018-11-28 22:08
I would dispute the ?better broker integration? since pactman verifier can be just pointed at a broker with a provider name to pull in all the metadata from the broker for that provider :slightly_smiling_face:

richard.jones
2018-11-28 22:08
Or rather, I?d like to know where pactman is seen to fall short in broker integration :slightly_smiling_face:

bethskurrie
2018-11-28 22:09
Oh, my bad. I didn't think it did this yet.

bethskurrie
2018-11-28 22:09
Does it also publish verifications?

richard.jones
2018-11-28 22:10
Yep!

bethskurrie
2018-11-28 22:10
And verification results from the tests?

richard.jones
2018-11-28 22:11
I?m not sure what that means. Which tests?

bethskurrie
2018-11-28 22:11
The result of each individual test.

bethskurrie
2018-11-28 22:12
That's relatively new to the ruby impl, so you may not have realised it was there.

richard.jones
2018-11-28 22:12
Sorry, which tests? The tests using the mocks?

bethskurrie
2018-11-28 22:12
Sounds like you can ignore my analysis though, zhammer.

richard.jones
2018-11-28 22:12
Ahh. I?ll look up that ruby feature?s documentation.

bethskurrie
2018-11-28 22:13
We're still trying to work out a format for it.

bethskurrie
2018-11-28 22:13
There's an issue somewhere.

bethskurrie
2018-11-28 22:13
At the moment, it can be any arbitrary JSON in the testResults key.

richard.jones
2018-11-28 22:14
I?m still confused about which tests are generating these results. It?s the tests using the pact mocks? So the results of those tests are sent to the pact broker to register against the consumer?

bethskurrie
2018-11-28 22:16
The results of each interaction verification.

bethskurrie
2018-11-28 22:16
They get included in the verification results going back to the broker.

bethskurrie
2018-11-28 22:16
Whether it passed or failed, and the diff.

richard.jones
2018-11-28 22:17
ahhh! righto. that sounds useful, yes! When the format is nailed down more I?ll definitely want to support it :slightly_smiling_face:

bethskurrie
2018-11-28 22:18
I'll find you the issue with the current format, but it doesn't support v2.

bethskurrie
2018-11-28 22:18
If you're interested in coming up with a format that supports v3, even better!

richard.jones
2018-11-28 22:19
\o/

zach.the.hammer
2018-11-28 22:20
@richard.jones are you a / the maintainer of pactman? i'm really interested in experimenting w/ pact testing on some personal projects and will probably use pactman

richard.jones
2018-11-28 22:20
I?m a maintainer, yes. Primary author, but we have a few folks helping maintain it now.

zach.the.hammer
2018-11-28 22:21
would be happy to contribute also if things go well! right now i'm mostly concerned about not having an in-python pact provider verifier like in the ruby package: https://github.com/pact-foundation/pact-ruby/wiki/Provider-states#provider-codebase

richard.jones
2018-11-28 22:23
@zach.the.hammer pactman is the tool we (ReeceTech) use for pact verification, yes. I?m migrating us over to using the mocking in pactman also (no more firing off a separate process to do test mocking!), though the pact-python to pactman migration for our large-ish codebase is tricky due to API conflicts which I?m sorting through.

zach.the.hammer
2018-11-28 22:23
i'm used to testing in `pytest` or `behave` where i can setup fixtures in python within the testing framework. doing this via an additional endpoint seems like a major headache / perhaps not even possible (in a reasonbly non time-consuming way) for things like mocking calls to external services

richard.jones
2018-11-28 22:24
@zach.the.hammer yep, that?s our toolset also

richard.jones
2018-11-28 22:24
and also the same reasoning why I started the pactman project

richard.jones
2018-11-28 22:25
let?s take this convo over to the #pact-python channel tho rather than gum up #general :slightly_smiling_face:

bethskurrie
2018-11-28 22:26
:+1:

zach.the.hammer
2018-11-28 22:27
haha sounds good! at least we were just gumming up this thread

matt.fellows
2018-11-28 22:50
We should create own tap, which doesn?t have these requirements/restrictions

matt.fellows
2018-11-28 22:51
It?s basically a git repository that you run `brew tap ...` on and then can run the install

christian.hope
2018-11-28 23:05
has joined #general

cosmin.mogos
2018-11-29 10:52
has joined #general

cosmin.mogos
2018-11-29 11:49
Hi, I have a question regarding initial PACT sharing. If my understanding is correct the PACT file is generated after the consumer tests successfully run. What mechanism can be used to share PACT files before the consumer tests can be implemented. i.e share the contract before the consumer implements requred functionality, so the discussion can be started with the producer team? more detailed JVM related question https://pact-foundation.slack.com/archives/C9UN99H24/p1543329108034800

ruben.perezg
2018-11-29 14:53
has joined #general

james.carman
2018-11-29 16:55
It seems that the general approach to supporting ?environments? in the pactbroker is to use tags to do so, applying tags like ?prod? to a particular pact file. Am I understanding that correctly?

matt.fellows
2018-11-29 17:04
Yep, that?s the defacto approch!

james.carman
2018-11-29 17:08
Okay, cool. So, we tag it as ?prod? only after a successful deployment to the production environment?

james.carman
2018-11-29 17:08
and perhaps tag it as ?provisional? or something as we?re running it through its paces?

james.carman
2018-11-29 17:09
asking for the production version of the provider verify itself against our ?provisional? tag?

james.carman
2018-11-29 17:09
I really hope this makes sense :slightly_smiling_face:

matt.fellows
2018-11-29 17:31
yep

matt.fellows
2018-11-29 17:33
I normally go with `dev` for what?s currently pushed to master, and `prod` once it is released to prod

matt.fellows
2018-11-29 17:34
and then for branches, you could do a few different things. There are a few posts on the wiki e.g. https://github.com/pact-foundation/pact_broker/wiki/Using-tags

james.carman
2018-11-29 17:37
as far as keeping track of ?what version is in prod? for providers, that would be up to the specific organization to determine how to best do that?

james.carman
2018-11-29 17:38
I suppose that part is really supported (no matter how it?s done) using the webhooks out of the pactbroker.

james.carman
2018-11-29 17:39
meaning, you would tie a webhook to the ?go verify the prod version of service ?foo? against this new consumer pact that just got published?

matt.fellows
2018-11-29 17:40
Probably, yes

matt.fellows
2018-11-29 17:40
But the broker does have a mechanism to query what version of what is where (assuming you tag etc.)

matt.fellows
2018-11-29 17:40
This article might be worth reading too - the effective pact setup guide: https://docs.pact.io/best_practices/pact_nirvana

james.carman
2018-11-29 17:40
if the provider doesn?t have any pacts, then it can?t really be ?tagged?, right?

matt.fellows
2018-11-29 17:40
You can query the broker like this `pact-broker describe-version --pacticipant PACTICIPANT --latest prod` to retrieve the version of the broker tagged `prod`

james.carman
2018-11-29 17:40
or, can we tag a verification also?

james.carman
2018-11-29 17:41
I mean a provider that doesn?t call anyone else

james.carman
2018-11-29 17:41
it wouldn?t be able to be tagged because it didn?t publish any pacts to the broker

matt.fellows
2018-11-29 17:41
exactly

matt.fellows
2018-11-29 17:41
BUT

matt.fellows
2018-11-29 17:42
When a provider performs a verification against a pact, it publishes its version. So when you query a pact by tag, you can retrieve the _latest_ provider that verified it

matt.fellows
2018-11-29 17:42
the command above does this

james.carman
2018-11-29 17:43
yep, but if the production version of the provider has not yet verified this pact (it?s a brand new consumer maybe), then we have no data

james.carman
2018-11-29 17:43
I really hate to be such a bother with all these ?what ifs? questions, man

james.carman
2018-11-29 17:43
I?m just trying to wrap my head around how to fully instrument this stuff

james.carman
2018-11-29 17:44
I am trying to ?RTFM? as much as I can :slightly_smiling_face:

matt.fellows
2018-11-29 17:44
no don?t be sorry, if the manual has it I?ll point to it, if not it maybe needs to be addressed

matt.fellows
2018-11-29 17:45
I don?t think I?m up with the latest on how to deal with the chicken-and-egg problem of new contracts, I?m currently in the states for work. @bethskurrie is on the bleeding edge for that one

james.carman
2018-11-29 17:45
I think we have a gap (at least at my org) where we need to somehow maintain this state of ?what version is deployed in which environment?

james.carman
2018-11-29 17:46
luckily, spring boot provides a nice handy ```/actuator/info``` endpoint which includes our versions, so we can go get it without having to maintain the state in a database I suppose

james.carman
2018-11-29 17:47
loves Spring Boot actuator


zach.the.hammer
2018-11-29 18:12

rahul.neotech
2018-11-29 18:51
Hi :wave: I?m using pact-ruby to write a contract test for our consumer and provider service. Our services communicate via protos and the protos are encoded when sent over the wire. When the protos are encoded, they contain certain characters that are not JSON serializable (pact throws; an error I received looks like this - "\xC8" from ASCII-8BIT to UTF-8). I was able to overcome this by Base64 encoding the request and response - in the pact gem - before it is JSON serialized in the consumer - and then Base64 decoding it in the provider before it is used for verification. I?m wondering if there?s a better solution for what I?m doing. Can someone help?

rahul.neotech
2018-11-29 19:25
cc @beth


rahul.neotech
2018-11-29 23:12
@bethskurrie

bethskurrie
2018-11-29 23:14
Hm. I don't think there is a way to transfer non UTF-8 characters on JSON is there?

bethskurrie
2018-11-29 23:15
Sounds like you're trying to do something that is not possible in JSON, and the pact problem is just a side effect.

bethskurrie
2018-11-29 23:18
Perhaps JSON is not the best transfer format for your situation.

rahul.neotech
2018-11-29 23:49
There might be a way

rahul.neotech
2018-11-29 23:50
Suppose my example string is this `test_string = "\x05\x10\x00\x18\xC8\x068\x04@\x00J\x0ETestAccount"`

rahul.neotech
2018-11-29 23:50
If I try to call `.to_json` on it, it throws with the error message "malformed UTF-8"

bethskurrie
2018-11-29 23:51
You can use other content types than JSON, however, you will lose the ability to use matchers.

rahul.neotech
2018-11-29 23:51
I looked up the following: https://stackoverflow.com/questions/4867883/convert-non-ascii-chars-from-ascii-8bit-to-utf-8 and tried `test_string.force_encoding('UTF-8').to_json` and even that threw an error

bethskurrie
2018-11-29 23:52
I feel that you have a Ruby/API problem first, before you have a pact problem.

rahul.neotech
2018-11-29 23:52
But then I found this: https://stackoverflow.com/questions/18067203/ruby-to-json-issue-with-error-illegal-malformed-utf-8 and tried `test_string.force_encoding("ISO-8859-1").encode("UTF-8").to_json` and it worked

bethskurrie
2018-11-29 23:52
I think you're going to lose information by force encoding the string.

bethskurrie
2018-11-29 23:52
I don't think that's what you want.

rahul.neotech
2018-11-29 23:53
I see... actually its not just the encoding that worked

rahul.neotech
2018-11-29 23:54
I took the encoded protobuf as the `test_string`, ran that above command `force_encoding("ISO-8859-1").encode("UTF-8")` to get an `output_string`, and used the `output_string` to reconstruct the proto

rahul.neotech
2018-11-29 23:54
And it worked as well

rahul.neotech
2018-11-29 23:54
So maybe it works no? :neutral_face:

bethskurrie
2018-11-29 23:55
I don't understand enough about encoding to be able to give you a reliable answer, I'm sorry.

rahul.neotech
2018-11-29 23:56
Okay, no worries, thanks a lot for taking time out to reply to my questions :slightly_smiling_face:

rahul.neotech
2018-11-29 23:59
Oh BTW, what are the other formats I can use instead of JSON even if I lose the ability to use matchers? Is there a link I can look at to learn this?

bethskurrie
2018-11-30 00:12
XML is almost finished, but we lost momentum. Any other format just does plain text matching, but it may not handle non-utf8 chars.

bethskurrie
2018-11-30 00:12
I have a feeling there's a force encode somewhere

bethskurrie
2018-11-30 00:15
If you're comfortable in ruby, you can implement your own matcher for your own format quite easily.


rahul.neotech
2018-11-30 00:22
I was thinking along the same lines :slightly_smiling_face: ... on implementing a custom matcher for the protobufs. I'll take it from here. Thanks a lot for replying to my messages. You were super helpful :100::+1:

bethskurrie
2018-11-30 00:40
no problem

zach.the.hammer
2018-11-30 01:46
@bethskurrie is this the endpoint for publishing pact verification results?

matt.fellows
2018-11-30 01:49
That would be super cool

matt.fellows
2018-11-30 01:49
The question about gRPC and protobufs comes up a lot

matt.fellows
2018-11-30 01:49
I?d love for you to tell us why you think Pact does (or does not) solve a problem for you. We?ll then update our docs accordingly

zach.the.hammer
2018-11-30 02:05
i don?t see how to tag the provider verification

bethskurrie
2018-11-30 02:11
Yes.

bethskurrie
2018-11-30 02:11
You tag a pacticipant version, not a result.

zach.the.hammer
2018-11-30 02:12
> To reach Pact Nirvana, the final step is to have a CI build that checks out the code for the production version of your provider, and have it verify the same pacts that the head version does. If you have followed the recommended strategy of tagging provider versions in the broker on deployment to production, you can use the broker to determine which version of the provider is currently in production. Make sure that the provider application version used when publishing your verification can be reverse engineered to a git reference.

zach.the.hammer
2018-11-30 02:12
>>> To reach Pact Nirvana, the final step is to have a CI build that checks out the code for the production version of your provider, and have it verify the same pacts that the head version does. If you have followed the recommended strategy of tagging provider versions in the broker on deployment to production, you can use the broker to determine which version of the provider is currently in production. Make sure that the provider application version used when publishing your verification can be reverse engineered to a git reference.

zach.the.hammer
2018-11-30 02:12
this confuses me a bit

zach.the.hammer
2018-11-30 02:13
is this ?provider prod? tag done separately via > create-version-tag

zach.the.hammer
2018-11-30 03:42
Agh okay so I have been reading the pact nirvana and pact versioning docs over and over and there is still one thing I can?t understand: https://docs.pact.io/best_practices/pact_nirvana#5-allow-contracts-to-change-without-breaking-your-builds As far as I can tell the recommended workflow is: 1) We have a Consumer and a Provider with some existing pact. 2) Consumer and Provider teams talk. They decide they want a feature for Consumer to be able to get the information about an Alligator from Provider team if the Alligator exists. 3) Consumer service makes a feature branch: `feature-fetch-alligator` 4) Consumer writes a pact in their consumer tests to ?mock? out the desired interaction with the Provider. The pact, in pseudo, looks something like: ``` provider: Provider consumer: Consumer given an alligator named mary exists GET /alligator?name=Mary will respond with status 200 body like { id: 1, name: ?Mary? } ``` 5) Pushing `feature-fetch-alligator` branch to origin triggers the CI feature branch build, which publishes the pact file to the broker with the consumer version {git sha} and the tag feature-fetch-alligator. **Here?s where I?m confused** Assuming an identical pact hasn?t been published and verified by the provider previously, the consumer build fails, as the pact isn?t verified. The provider CI build **doesnt** verify this pact since it?s not tagged `master`. Instead, the provider team locally tests against the `feature-fetch-alligator` pact in their own `feature-provide-alligator` branch in the Provider repo. The feature is built out, and the pact passed locally! `feature-provide-alligator` is merged to master. *what happens now?!?!?!* the tag for the new consumer contract still isn?t `master`! So the Provider still won?t verify the `feature-fetch-alligator`-tagged pact. The Pact *is* supported by the Provider, but it is not verified. Consumer CI never passes, and the branch is never merged. Essentially: provider won?t verify until pact is tagged as master. Consumer can?t merge to / tag as master until provider verifies. What am i missing?

bethskurrie
2018-11-30 03:43
> **Here?s where I?m confused**

bethskurrie
2018-11-30 03:43
You are very observant.

bethskurrie
2018-11-30 03:43
What you're missing is that I have a feature that I have been working on that I haven't fully released and documented.

zach.the.hammer
2018-11-30 03:43
Ah!!!!!!

zach.the.hammer
2018-11-30 03:43
Wow my brain feels a lot better now

bethskurrie
2018-11-30 03:44
I got blocked because I couldn't decide what to call it, and then I started renovations on my house.

bethskurrie
2018-11-30 03:44
Normally, the provider team would just do a manual verification of that new tag - again, because they've talked.

bethskurrie
2018-11-30 03:45
With the new feature, (which may be called WIP pacts or may be called pending pacts) the new pact would be pulled in at the next verification, but *it would not fail the build*.

bethskurrie
2018-11-30 03:45
That way the consumer gets the feedback they need, and the provider doesn't have to change any code.

bethskurrie
2018-11-30 03:45
And their build doesn't break.

zach.the.hammer
2018-11-30 03:45
^ thats what i was thinking!!


bethskurrie
2018-11-30 03:46
Here's my work in progress post about work in progress pacts.

zach.the.hammer
2018-11-30 03:47
Awesome

zach.the.hammer
2018-11-30 03:48
I will let my brain relax a bit and then read this

bethskurrie
2018-11-30 03:49
yeah, it does your head in after a while

bethskurrie
2018-11-30 03:49
even me, and I came up with it!

zach.the.hammer
2018-11-30 03:49
Wait that page is 404ing

bethskurrie
2018-11-30 03:49
Hm, probably beacuse I haven't published it. Let me see if there's a pre-publish link

zach.the.hammer
2018-11-30 03:50
Hah i thought perhaps it was a very meta joke


zach.the.hammer
2018-11-30 03:51
Alright I will read this in a bit. I?ll let you know if any names come to mind for wipacts

bethskurrie
2018-11-30 03:51
Also, if you have a preference for wip/pending, then please let me know! I'm leaning towards "pending" at the moment. Naming things == hard.

zach.the.hammer
2018-11-30 03:51
^ lol i think we?re on the same page

matt.fellows
2018-11-30 05:34
This is what I was referring to this morning :slightly_smiling_face:

dan
2018-11-30 15:51
has joined #general

dan
2018-11-30 16:14
Hello everyone! I'm running the Pact broker with custom authentication. Can `pact-provider-verifier` be configured to use custom headers? I could only find basic http auth in the docs.

matt.fellows
2018-11-30 16:42
It does, run the `help` flag

matt.fellows
2018-11-30 16:42
Or if you could elaborate on what you need in code

popo63301
2018-12-01 16:47
has joined #general

popo63301
2018-12-01 16:58
Hi! Does it work well with GraphQL?


bing.sun
2018-12-02 09:24
has joined #general

zach.the.hammer
2018-12-02 14:52
Is there a tool to check the syntax of a pact file? Specifically for support while working on a pact implementation. Something like `pact-json-validator --spec 3.0.0 --file my_pact_files/Test.pact.json`

bethskurrie
2018-12-02 20:32
There's a JSON schema Somewhere.

bethskurrie
2018-12-02 20:33
Personally, I don't recommend reimplementing the pact matching logic.

bethskurrie
2018-12-02 20:33
Ron has a rust implementation that should allow other languages to call via ffi bindings.

bethskurrie
2018-12-02 20:34
The plan is to move all the languages that are currently using the ruby standalone to use that

bethskurrie
2018-12-02 20:34
Trying to keep multiple implementations in line with each other is quite hard, and slow to roll out new features.

zach.the.hammer
2018-12-02 21:36
Some of this is just building out the implementation to explore pact mechanics

zach.the.hammer
2018-12-02 21:38
I think i saw that rust implementation when looking for v3 implementations

ashish.dubey91
2018-12-03 10:25
hey guys, the public free pact broker has been returning many 5XXs lately. anything wrong there?

bethskurrie
2018-12-03 10:28
We've just moved to some new infrastructure, and we're still ironing out the no downtime deployments.

bethskurrie
2018-12-03 10:28
We hope to have it sorted soon.

ashish.dubey91
2018-12-03 10:28
okay. thanks

gabe
2018-12-03 13:34
has joined #general

gabe
2018-12-03 14:06
Hi there, I'm using the Python Pact library. When sending binary files in the a request payload, I seem to always get back a `"Error ocurred in mock service: Encoding::UndefinedConversionError - \"\\xFF\" from ASCII-8BIT to UTF-8"` error. This does not happen if the payload is a dictionary. Has anyone else ran into this?

gabe
2018-12-03 14:11
Is perhaps the library trying to coerce payloads to strings?

sai.krishna
2018-12-03 14:33
has joined #general

mcon
2018-12-03 17:43
has joined #general

mcon
2018-12-03 22:22
Hi pact folks, I've written a short RFC on the idea of adding protobuf support for pact - it would be great to get people's thoughts on it: in terms of whether such a feature is likely to be accepted, and whether the approach seems reasonable. Thanks, Matt https://github.com/pact-foundation/pact-specification/issues/62

madhukar.mishra
2018-12-04 05:46
ignore if this if of no value: Implementation wise you just use pact to generate stubbed responses which you test your app against, it doesn't add too much complexity in code besides having to define your contract in the dsl of your platform

madhukar.mishra
2018-12-04 05:56
we have the same scenario, we have gone with the 2nd option. So yeah, we've sort of chained contracts.

madhukar.mishra
2018-12-04 06:04
Hi, we're quite close to figuring out how pact will work end to end for all our services. We're now hooking up CIs together with webhooks as prescribed in the docs. I'm having trouble looking at webhook status, they aren't showing up in the webhook status column on the broker homepage, even when they've been triggered. Using the latest image for the broker. *Note*: I'm using global webhooks, (provider, consumer not specified).

madhukar.mishra
2018-12-04 06:05
~I have checked if the webhook actually got triggered.~

bethskurrie
2018-12-04 07:38
Can you raise an issue in the pact broker github repo with the exact steps to reproduce.

bethskurrie
2018-12-04 07:38
Have a look at the logs. It may be a display issue.

madhukar.mishra
2018-12-04 07:43
Will do Beth, thanks. I have a suspicion it's got something to do with global hooks. I'll open the issue as when I have more details.


madhukar.mishra
2018-12-04 07:49
I have enabled `DEBUG` logging but can't seem to get anything useful out of ``` docker-compose logs | grep -i webhook ```

madhukar.mishra
2018-12-04 07:52
This is what broker's section looks like in the compose config ``` broker_app: image: dius/pact-broker links: - postgres # If you remove nginx, enable the following #ports: # - "80:80" environment: PACT_BROKER_DATABASE_USERNAME: postgres PACT_BROKER_DATABASE_PASSWORD: password PACT_BROKER_DATABASE_HOST: postgres PACT_BROKER_DATABASE_NAME: postgres PACT_BROKER_WEBHOOK_SCHEME_WHITELIST: http https PACT_BROKER_WEBHOOK_HOST_WHITELIST: /.*/ PACT_BROKER_LOG_LEVEL: DEBUG ```

madhukar.mishra
2018-12-04 07:53
Not sure if I'm looking in the wrong places.. is there a way to get execution statuses from the API without knowing the execution ID?

madhukar.mishra
2018-12-04 07:59
app logs are in `/var/log/nginx/error.log` in the `broker_app` container only :grinning:

bethskurrie
2018-12-04 08:06
Yes.

bethskurrie
2018-12-04 08:06
Go to the HAL browser

bethskurrie
2018-12-04 08:06
There's a relation that shows you the web hook statues.

madhukar.mishra
2018-12-04 08:08
oh, embarrassing, I must have missed it.

bethskurrie
2018-12-04 08:11
Hm. I beg your pardon.

bethskurrie
2018-12-04 08:12
So, there is a known bug where the global webhooks dont show up in the UI status page.

bethskurrie
2018-12-04 08:12
It would give you a link if it did.

bethskurrie
2018-12-04 08:13
/pacts/provider/PROVIDER/consumer/CONSUMER/webhooks/status

bethskurrie
2018-12-04 08:13
Go to the API browser, and create the link as per that template.

bethskurrie
2018-12-04 08:13
You'll see a list of triggered webhooks, or error logs.

madhukar.mishra
2018-12-04 08:14
^ having touble navigating to this in the browser*

madhukar.mishra
2018-12-04 08:14
sure, thanks

bethskurrie
2018-12-04 08:14
Click on the API browser link

bethskurrie
2018-12-04 08:14
Top right

madhukar.mishra
2018-12-04 08:14
sure, I got it

madhukar.mishra
2018-12-04 08:14
I've been using the HAL browser a lot

madhukar.mishra
2018-12-04 08:16
Thanks again Beth

bethskurrie
2018-12-04 08:16
I'll try and fix that display bug.

bethskurrie
2018-12-04 08:16
That would have made it easier to find the logs.

madhukar.mishra
2018-12-04 08:23
We could help fix the docker setup to log properly if you like. Looking for low hanging fruit to contribute :smile:

bethskurrie
2018-12-04 08:25
I didn't realise it was broken!

bethskurrie
2018-12-04 08:25
But please, do!

bethskurrie
2018-12-04 08:26
App logs should come out in the stout of the docker container. Do they not?

madhukar.mishra
2018-12-04 08:28
Nope


bethskurrie
2018-12-04 08:29
That's... Unusual.

madhukar.mishra
2018-12-04 08:33
getting them out with `docker-compose exec broker_app tail -f /var/log/nginx/error.log`

bethskurrie
2018-12-04 08:34
Please do submit a PR! I'm wondering how it hasn't been picked up yet.

bethskurrie
2018-12-04 08:34
Does it happen when running the docker container without docker compose?

bethskurrie
2018-12-04 08:37
Typically, people just run the docker image in prod. Docker compose is just for messing around with locally.

madhukar.mishra
2018-12-04 08:40
Will try it out and let you know.

bethskurrie
2018-12-04 08:40
Many thanks :-)

james.carman
2018-12-04 15:12
When I run pact_broker locally (using the pact_broker-docker) I get the warning: ``` A security update is available for your version (5.1.11) of Passenger, we strongly recommend upgrading to version 5.3.5. ```

james.carman
2018-12-04 15:35
There seems to be a rather long pause in my verify test after the Spring Boot application is started: ``` 2018-12-04 10:34:14.315 INFO [-,,,] 55404 --- [ main] com.myco.VerifyPactTest : Started VerifyPactTest in 10.281 seconds (JVM running for 11.861) Verifying a pact between sample-hello-client and hello Say Hello 2018-12-04 10:34:25.429 INFO [-,825962565f72090b,825962565f72090b,true] 55404 --- [o-auto-1-exec-1] c.m.provider.RequestLogFilter : BEGIN POST /api/hello ````

james.carman
2018-12-04 15:36
11 seconds pause

james.carman
2018-12-04 15:36
here?s what my test looks like: ``` @RunWith(SpringRestPactRunner.class) @Provider("hello") @IgnoreNoPactsToVerify @PactBroker @EnableAutoConfiguration @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = HelloConfig.class) public class VerifyPactTest { @TestTarget public final Target target = new SpringBootHttpTarget(); } ```

james.carman
2018-12-04 15:56
I think the pause is us downloading the pacts from the broker.

james.carman
2018-12-04 16:01
When I run against the local, Dockerised pact_broker the pause is much shorter

james.carman
2018-12-04 16:02
When I run against the one set up at http://dius.com.au it?s taking much longer. I don?t know that it needs to be terribly fast, but is there any option to speed that up?

james.carman
2018-12-04 16:03
This may not be the proper forum for questions like that. Sorry

andrew.nicholson
2018-12-04 16:24
Does the pact-spec support rules about nested arrays? I.e. if I want to express in my contract that a field is an array of arrays, where both the inner & outer arrays have at least 1 element?

james.carman
2018-12-04 16:37
if you?re using the Java DSL: ``` newJsonBody(o -> o.array("myarray", array-> { array.array(nested-> { }) }) ```

james.carman
2018-12-04 16:37
you can do stuff like that

james.carman
2018-12-04 16:37
so, I would assume it?s allowed

andrew.nicholson
2018-12-04 16:44
hmm...maybe I should try the java8 dsl - I'm using the junit4 dsl, and while I can declare bodies that have nested arrays, I don't seem to be able to declare an outer array minlength 1 combined with declaring that the inner arrays are also minimum length one...

andrew.nicholson
2018-12-04 16:45
also from https://github.com/pact-foundation/pact-specification/tree/version-3#matcher-path-expressions-in-bodies, item 5 is `A star (*) can be used to match all keys of a map or all items of an array (one level only).` -- which makes me think that maybe a matcher matching items in all nested arrays isn't supported by the spec?

james.carman
2018-12-04 16:46
There are some methods like minArrayLike and minMaxArrayLike that makes me think there has to be some sort of ?at least one? or whatever you?re looking for.

james.carman
2018-12-04 16:46
I have not used them, but it?d be interesting to see what they spit out in a pact file when run

james.carman
2018-12-04 16:52
when I added this: ``` .array("array", array -> { array.minArrayLike(1, nested -> { nested.stringType("foo", "bar"); }); })) ```

james.carman
2018-12-04 16:52
I see this in the pact file: ``` "$.array[0]": { "matchers": [ { "match": "type", "min": 1 } ], "combine": "AND" }, "$.array[0][*].foo": { "matchers": [ { "match": "type" } ], "combine": "AND" } ```

james.carman
2018-12-04 16:54
odd syntax, but I suppose it works :slightly_smiling_face: I?ve not tried to upload it to the broker

andrew.nicholson
2018-12-04 16:55
Yeah - I can generate that with the junit one - and that works. What I'm then trying to do is also say that the nested array(s) are an array of strings, minimum length one

james.carman
2018-12-04 16:56
so, instead of it thinking you?re creating an ?object? for each value in the array, you want it to be an array of strings

andrew.nicholson
2018-12-04 16:58
That's a hurdle, as is declaring minimum length rules on both the inner and outer arrays

james.carman
2018-12-04 16:58
gotcha

james.carman
2018-12-04 16:58
I think you?ve already outrun my n00b status :slightly_smiling_face:

james.carman
2018-12-04 16:58
sorry I couldn?t be of more help

andrew.nicholson
2018-12-04 16:58
it could be that I'm veering too far away from 'example-based contracts', and trying to describe a too-generic shape of data

andrew.nicholson
2018-12-04 16:58
nah, it's useful to talk through it -- appreciated the suggestions!

andrew.nicholson
2018-12-04 16:59
plus I'm now trying out the java8 dsl and it's awesome

james.carman
2018-12-04 16:59
I don?t think it?s unreasonable to be able to describe the shape like this, though

james.carman
2018-12-04 16:59
Yeah, I like the java8 dsl

james.carman
2018-12-04 16:59
much more straightforward

yousafn
2018-12-04 19:00
has joined #general

hagglundized
2018-12-04 23:13
has joined #general

borsuk.artem034
2018-12-05 08:30
Hi all, someone know progress about that issue https://github.com/pact-foundation/pact-mock_service/issues/82, or possible workaround how I can get pact file from pact broker to pact-mock_service?

madhukar.mishra
2018-12-05 08:38
for now you can just download the pacts yourself and run pact_stub_server to consume them and provide stubs to dev/test against

madhukar.mishra
2018-12-05 08:40
we do that for running some API tests, and other stuff as well. Let me know if you need details.

matt.fellows
2018-12-05 10:53
You can use the API in the broker to query the pact and easily download them. Should take all of 15 minutes to write a bash script that gets the pact file and starts the stub service with it

borsuk.artem034
2018-12-05 13:45
thanks for answers, you are really help me

matt.fellows
2018-12-05 19:06
:+1:

tim
2018-12-05 20:20
has joined #general

uma.shanker
2018-12-06 07:33
Hey Guys, Facing an issues while implementing pact contract testing using springboot and kotlin , Here is code example I have written but it's not wokring. please help. @Rule var provider: PactProviderRuleMk2 = PactProviderRuleMk2("test_provider", PactDemoApplicationTests()) @RunWith(SpringRunner::class) @SpringBootTest class PactDemoApplicationTests { @Pact(consumer = "test_consumer") fun createFragment(builder: PactDslWithProvider): RequestResponsePact { val headers = HashMap<String, String>() headers["Content-Type"] = "application/json" return builder .given("test state") .uponReceiving("ExampleJavaConsumerPactRuleTest test interaction") .path("/dummies") .method("GET") .willRespondWith() .status(200) .headers(headers) .body("[{" + "\"id\": \"39b2374e-863e-449c-9d7d-b130d5cde957\"," + "\"value\" : \"this is the judge that kept the cat that milked the rooster that tossed the rooster all forlorn that lay in the house that Jack built and this is the house that Jack built\"," + "\"id\": \"dc95d89a-8452-4958-9b84-c20e9108db00\"," + "\"value\" : \"this is the rooster that kept the man that crowed in the morn that married the house that Jack built and this is the cheese all forlorn that waked the farmer that married the judge that married the house that Jack built\"," + "\"id\": \"9a18b039-7408-4c6b-a1f7-7dfffdb5ca98\"," + "\"value\" : \"this is the cat that milked the house that Jack built and this is the maiden all forlorn that kept the house that Jack built\"," + "\"id\": \"e556c8b9-4063-4913-88e2-019ee184aca6\"," + "\"value\" : \"this is the farmer that married the cat that lay in the judge all forlorn that married the house that Jack built and this is the judge with the crumpled horn that chased the house that Jack built\"," + "}]") .toPact() } @Test @PactVerification() fun doTest() { System.setProperty("pact.rootDir","../pacts") val productRestFetcher = DummyEventRestFetcher() productRestFetcher.setBackEndUrl(provider.url) val dummies = productRestFetcher.fetchDummyEvents() Assert.assertNotNull(dummies) print("All dummies: $dummies") }

uma.shanker
2018-12-06 07:34
Saying provider.url not be nill

uma.shanker
2018-12-06 07:34
java.lang.IllegalStateException: provider.url must not be null

matt.fellows
2018-12-06 07:36
Is it nil?

uma.shanker
2018-12-06 07:37
Yes Matt.

uma.shanker
2018-12-06 07:39
Actually I have placed @Rule at the top of the class(outside class definition), When I was placed it inside the PactDemoApplicationTests class it was complaining "Rule must be public"

kristine.jetzke
2018-12-06 08:02
place it inside and make it public.

uma.shanker
2018-12-06 08:41
Thanks Tine. After placing inside class saying org.junit.internal.runners.rules.ValidationError: The @Rule 'provider' must be public.

uma.shanker
2018-12-06 08:42
I think I have to code in Java only Any suggestions?

kristine.jetzke
2018-12-06 08:49
Can?t you make it public? (sorry, I don?t know kotlin, just Java)

uma.shanker
2018-12-06 08:54
Thanks Tine, I was able to run successfully tests are passing now but pact file is not generated

kristine.jetzke
2018-12-06 09:18
Can you remove the `System.setProperty("pact.rootDir","../pacts")` line and check in the default location?

kristine.jetzke
2018-12-06 09:19
target/pacts (or build/pacts if you use Gradle)

uma.shanker
2018-12-06 09:37
yeah got it. thanks after path change it is working. thanks Tine for the help.

kristine.jetzke
2018-12-06 09:38
:slightly_smiling_face:

bethskurrie
2018-12-06 09:39
Just give it the URL @madhukar.mishra

matt.fellows
2018-12-06 09:40
It works now?

bethskurrie
2018-12-06 09:40
Try putting the credentials in the URL.

matt.fellows
2018-12-06 09:40
Ah yeah.

dagarwal
2018-12-06 10:29
Hi All , My api path is : api/test/{id1}/content/{id2}/content . I have added the matchers like this : path: term({ generate: ?/api/test/8061159/content/115578/content?, matcher: ?/api/test/[0-9]+/content/[0-9]+/content? }) When i run the provider verification , it fails with an error as {Id2} does not exist . any idea , how to achieve the same ?

matt.fellows
2018-12-06 19:50
What have you tried so far? Provider states?

sthan
2018-12-06 21:06
has joined #general

sk8390
2018-12-07 09:23
has joined #general

sk8390
2018-12-07 09:25
Hi All,

sk8390
2018-12-07 09:33
I want to verify only few objects inside a Json object and ignore few... for example in a big json structure... {"name":"Senthil", "Details":[{ "address":"{ <IGNORE Details> }",}, {"Salary" : "<Some Integer>"}, "{"Job_Details":["{"JobCode":"<Integer>"},{"Job Desc":"<IGNORE>"},{<IGNORE>}"}]"}"],"{<IGNORE>}"}.... during pact:verify its excatly matching all elements in json and my verfication fails... hence I need to verify only Salary and Job_code and can ignore rest in the JSON... Could you please help me in this?

matt.fellows
2018-12-07 11:17
Simple - don?t include the fields you don?t care about in the consumer test, and they won?t be checked in Provider verification. Also, you probably want to use ?matchers? so that the specific values don?t matter

zach.the.hammer
2018-12-07 22:09
Are pact descriptions between a consumer and provider unique? For example can I have the pacts: ?consumerService?, ?providerService? given ?there are no alligators? upon receiving `'a request for an alligator'` should return a 404 ?consumerService?, ?providerService? given ?there are alligators? upon receiving `'a request for an alligator'` <-- same description string should return a 200

zach.the.hammer
2018-12-07 22:09
?upon receiving? being the description

mboudreau
2018-12-08 00:34
If I remember correctly, every test is unique, so the two requests can be the same or different. It depends on how you coded it. If you're using the same code for that request, they'll be the same

nirpet111
2018-12-08 14:59
has joined #general

ittennull
2018-12-08 16:04
has joined #general

ittennull
2018-12-08 17:32
Hi so, what's your thoughts, plans and timeline on creating new .net core implementation of pact free of ruby stuff? I'm currently working on such a thing and wondering if I should continue

mboudreau
2018-12-09 00:20
it's a valid question. I don't have much visibility on the .net implementation as it's not my area of work, maybe ask in the #pact-net channel.

abubics
2018-12-10 00:48
I guess this would be somewhat assisted/subsumed by the Rust migration, too

mboudreau
2018-12-10 01:08
definitely

s.umair.riaz
2018-12-10 04:37
has joined #general

samuel.verstraete
2018-12-10 08:32
has joined #general

athalytra
2018-12-10 10:59
has joined #general

athalytra
2018-12-10 11:09
Hello to all, just a simple general question: I know that PACT is best to be executed during CI phase and 'can-i-deploy' feature can give the green light to CD phase. But, what is your opinion about exercising PACT tests on an already deployed environment?

ashish.dubey91
2018-12-10 11:30
for some reason from my ubuntu machine I can `dig http://foo.pact.dius.com.au` just fine but when I do `curl http://foo.pact.dius.com.au` I get `Could not resolve host: http://foo.pact.dius.com.au`

ashish.dubey91
2018-12-10 11:30
any DNS changes happened recently?

abubics
2018-12-10 12:49
The second-best time to add tests is now? :upside_down_face:

athalytra
2018-12-10 13:39
Let me provide some details: I'm referring to a test env that is deployed daily. I was thinking to use Contract testing in this stage. Then we can use 'can-i-deploy' feature to give green light to deploy our Staging env...

pcohen
2018-12-10 21:32
has joined #general

abubics
2018-12-10 22:43
That kinda depends on your deploy workflow, but there's nothing stopping you at each promotion.

abubics
2018-12-10 22:44
I wouldn't even deploy to test if contract tests fail, though.

matt.fellows
2018-12-11 04:25
Just created #protobufs if anyone is keen to see how we might make Pact + Protobufs play nicely together. Thanks to @rahul.neotech who has been thinking / spiking on this recently!

madhukar.mishra
2018-12-11 05:41
the issue is just with compose. Haven't had time to see what's wrong yet.

anushree.shenoy
2018-12-11 05:52
has joined #general

saso.madaric
2018-12-11 08:40
has joined #general

joaquin.delgado
2018-12-11 11:52
has joined #general

james.carman
2018-12-11 14:16
So, if one were to want to create a new ```@TestTarget``` implementation, how would one go about that? Are there any docs anywhere?

victor.akinyemi
2018-12-11 15:40
has joined #general

james.carman
2018-12-11 17:29
What is the best practice with respect to running pact tests in Java with Maven? Should we make them integration tests or unit tests?

james.carman
2018-12-11 17:29
Surefire or Failsafe?

james.carman
2018-12-11 17:29
They?ll run fine either way, but is one way considered more ?proper? than the other?

matt.fellows
2018-12-11 19:21
It?s hard to say exactly where they always fit on the pyramid, but generally speaking I group them logically with the ?integration tests? code, even if they are more of a unit test in nature.

matt.fellows
2018-12-11 19:28
There is some commentary on the docs site e.g. https://docs.pact.io/best_practices/consumer#use-pact-for-isolated-unit-tests, but that might not be exactly what you were wanting

james.carman
2018-12-11 20:05
Also, with the hosted pact broker provided by the pact foundation, we get a read-only set of credentials and a read-write set. Within our organization, is there really any reason to ?protect? the read-only creds?

james.carman
2018-12-11 20:05
Meaning, would it be unreasonable to hard-code the configuration in our parent pom.xml file to contain these credentials?

james.carman
2018-12-11 20:08
obviously we wouldn?t want even the read-only stuff to leak out into the world, but if we keep it internal-only it might be okay

uglyog
2018-12-11 21:23
Have a look at the implementation for the HttpTestTarget.

matt.fellows
2018-12-12 01:27
In most organisations, I don?t see why all developers shouldn?t be able to have access to read-only creds. Whether you hard code them in config files is a separate thing :slightly_smiling_face:

felix.dai
2018-12-12 09:48
has joined #general

tghcastro
2018-12-12 12:41
has joined #general

dagarwal
2018-12-12 12:49
@matt.fellows: i have added data by post api call at provider level but it generates with different id everytime .So I am not sure how to get the id?s( of consumer level and provider level) to match

alessio.paciello
2018-12-12 15:25
has joined #general

matt.fellows
2018-12-12 20:49
Use matchers instead of hard coded values

sthan
2018-12-12 22:13
Hi. I?m pretty new to this group. Can someone tell me the best place to post questions about using PACT?

bethskurrie
2018-12-12 22:13
Here. But if your question is technology specific, it's best to ask in the appropriate channel.

sthan
2018-12-12 22:13
I posted a question on stackoverflow, but was wondering if there was a better place.


zach.the.hammer
2018-12-12 22:45
@sthan i would spend some time reading through the documentation on https://docs.pact.io/

bethskurrie
2018-12-12 22:46
Yes, you can use regular expressions. Look at the matchers documentation for pact-jvm.

zach.the.hammer
2018-12-12 22:51
@bethskurrie when i get the chance i'm going to share a little tool i've been using to handle 'wip' pacts

zach.the.hammer
2018-12-12 22:52
basically i have a script with a `--failon` arg where i can pass a set of pact tags to failon

zach.the.hammer
2018-12-12 22:52
and then in CI read from my PR. if there's a line `feature-pacts: zh-feature-a zh-feature-b` those will be added to failon

zach.the.hammer
2018-12-12 22:53
works pretty nicely to specify in a PR what feature tags a provider PR is implementing

bethskurrie
2018-12-12 22:53
sounds good!

raghavendra.chamarthy
2018-12-13 01:09
has joined #general

abubics
2018-12-13 05:43
SO is good, especially for external discoverability :slightly_smiling_face:

abubics
2018-12-13 05:44
In here might be better for more specific questions and help.

abubics
2018-12-13 05:44
And thanks for being very respectful, not just spamming all the channels on join :joy::ok_hand:

dagarwal
2018-12-13 09:57
is it possible to send matchers in api path ?

matt.fellows
2018-12-13 09:57
Yes

dagarwal
2018-12-13 09:59
i tried like this path: term({ generate: ?/api/test/8061159/?, matcher: ?/api/test/[0-9]+/? }),

dagarwal
2018-12-13 10:00
but when i run verification , it fails with error as 8061159 id does not exist .Their is no way i can generate the same id at provider level

matt.fellows
2018-12-13 10:21
The verification process on the provider side still needs a way of knowing how to make the call to the provider, and it uses the value of generate to do so. That id (or another of your choosing) must be present when this test happens. The way to indicate this to the provider is via provider states

dagarwal
2018-12-13 10:24
but that id will never be present

dagarwal
2018-12-13 10:25
as it is generated automatically in db :disappointed:

matt.fellows
2018-12-13 10:25
Can you reset/clear your DB during tests?

matt.fellows
2018-12-13 10:25
Eg. with docker

matt.fellows
2018-12-13 10:25
Or an in memory db

dagarwal
2018-12-13 10:25
yes i will run on jenkins and db will always start fresh

dagarwal
2018-12-13 10:26
but still the id?s are random . if it starts with 1 or so , i can implement easily

matt.fellows
2018-12-13 10:26
So then you should be able to seed the data in a deterministic way, and use a known id in that test

dagarwal
2018-12-13 10:27
thats the thing , id is not known :disappointed:

matt.fellows
2018-12-13 10:27
You can't seed the database with fake data and known IDs?

matt.fellows
2018-12-13 10:28
What kind of database are you using?

dagarwal
2018-12-13 10:28
provider devs are not agreeing to that

dagarwal
2018-12-13 10:28
arango db

dagarwal
2018-12-13 10:29
i will try to fake the data if possible .looks like thats the only solution

matt.fellows
2018-12-13 10:29
So I'm not sure I can help you, apart from to say that the only proper way is via provider states and known IDs

matt.fellows
2018-12-13 10:29
Fake the data?

dagarwal
2018-12-13 10:29
i mean inserting into db

matt.fellows
2018-12-13 10:29
Ah

matt.fellows
2018-12-13 10:30
I don't see why for an automated unit test this is a problem for you provide team. But fundamentally the issue is collaboration and getting them on board

dagarwal
2018-12-13 10:31
Agreed

dagarwal
2018-12-13 10:31
Thanks , i will try the same

matt.fellows
2018-12-13 11:17
:thumbsup:

matt.fellows
2018-12-13 11:17
the hardest part isn?t software - it?s people :0

dagarwal
2018-12-13 11:18
ha ha true, cant agree more .thats what I am facing these days :stuck_out_tongue:

matt.fellows
2018-12-13 11:23
:smile:

rworcest
2018-12-14 01:04
has joined #general

zach.the.hammer
2018-12-16 15:41
i?ve moved my (small personal) project fully to microservices with pact testing! https://github.com/zhammer/morning-cd @bethskurrie: can you share a public repo that uses pact broker badges? i tried to add badges to my readmes but all the badge titles were `pact: `. i couldn?t get custom titles like `front/users pact:`, etc.

andrew.leith
2018-12-16 21:22
has joined #general

coredump
2018-12-17 01:25
has joined #general

ola.jankowska
2018-12-17 10:49
has joined #general

erik.moller
2018-12-17 15:19
has joined #general

davegallant
2018-12-17 17:03
has joined #general

japedersen
2018-12-17 19:03
has joined #general

japedersen
2018-12-17 19:08
Hi, (apologies if this questions has already been answered.) can a service have both consumer and provider tests?

zach.the.hammer
2018-12-17 19:36
yep

yousafn
2018-12-17 19:47
Have looked for a specific channel for the pact-stub-server but haven?t found one. Have raised an issue https://github.com/pact-foundation/pact-stub-server/issues/11 and also added an example repo for my predicament. Hope someone can help!

matt.fellows
2018-12-17 19:51
Absolutely!

kevin.cormier
2018-12-17 20:18
Hi All. I'm wondering if anyone here is using https://pact.dius.com.au/

kevin.cormier
2018-12-17 20:19
We're debating between running our own and using this service and would love to know if people have had any positive or negative experiences with them.

abubics
2018-12-18 00:10
(they have completely isolated lifecycles, however :P)

abubics
2018-12-18 00:11
many people are, and several people aren't

abubics
2018-12-18 00:12
it depends how much you want to look after your own infrastructure & deployment . . . and how that balances against data privacy & SaaS simplicity

ola.jankowska
2018-12-18 11:27
hi i have question, I am using pact broker in the cloud http://pact.dius.com.au where I succesfuly can publish new consumer tests, I also can verify them using java spring boot provider test, and my resutls are generated to json format in target/pact folder, but I still do not know how can I send the results back to broker.

richard.hulm
2018-12-18 11:45
@kevin.cormier We use it quite a lot - we have a few hosted brokers. We do experience occasional errors (lately they've been doing a migration; so had some oddities that should be fixed as a result of moving to more stable infrastructure) But on the whole it's great not having to maintain it ourselves, and the team are always quick to respond which is very useful!

matt.fellows
2018-12-18 12:20
@ola.jankowska there should be a gradle/other property to set that enables publishing the results. What have you tried so far?

godsey.chris
2018-12-18 15:48
has joined #general

zach.the.hammer
2018-12-18 15:50
hey @bethskurrie just bumping on a public repo with several pact badges!

godsey.chris
2018-12-18 16:03
Are there any solutions in place for using my pacts to generate a mock server that i could, say, run a frontend service against in order to do functional testing of my frontend


godsey.chris
2018-12-18 16:20
oh, neat, awesome

godsey.chris
2018-12-18 16:20
thanks

kevin.cormier
2018-12-18 20:32
Thanks a ton for the feedback! We'll consider it!

iamjillsanluis
2018-12-19 04:08
has joined #general

kevin.cormier
2018-12-19 17:09
Hi Boris. Thanks for the info! I was hoping from the responses to get a sense of just how big dius was to help inform those decisions. It sounds like a promising solution for our proof of concept.

abubics
2018-12-20 00:03
For a PoC, I'd just use the SaaS one :slightly_smiling_face: it's not hard to set up a private one (there are docker images, etc), but that's waste if you choose not to continue with Pact :slightly_smiling_face:

abubics
2018-12-20 00:03
I'd also go and ask in #pact-broker for more targeted help

elliot.sel
2018-12-20 22:37
has joined #general

marek.rybakiewicz
2018-12-27 16:16
has joined #general

yousafn
2018-12-28 16:29
Hey, Has there been any more thought on below :- https://docs.pact.io/getting_started/stubs ``` Description: Start a stub service with the given pact file(s). Where multiple matching interactions are found, the interactions will be sorted by response status, and the first one will be returned. This may lead to some non-deterministic behaviour. If you are having problems with this, please raise it on the pact-dev google group, and we can discuss some potential enhancements. Note that only versions 1 and 2 of the pact specification are currently supported. ``` Non-deterministic behaviour is really not good is consumers are using these api stubs to develop against. Pact stub server will just yolo the first response back to the client,, client may assume their request is good, but actually it is garbage (may have no request body, or no headers) This is a real blocker to use being able to implement pact alongside swagger with validation tooling. Currently we are 1) Defining our services in swagger 2) Using swagger-cli to validate that the swagger spec 3) Building pact tests and generating the contracts 4) Using swagger-mock-validator to validate the contracts against the swagger spec 5) Using the pact stub server to run our component integration tests in lieu of a provider In order to avoid deterministic matching, we have put a fall-through route to provide a bad request response if the user enters garbage, however this fails swagger mock validation, and will have further implications at provider verification time

yousafn
2018-12-28 16:31
Also where is the pact-dev google group to get my question raised on there, if that has better traction

guidopio.mariotti10_d
2018-12-29 23:43
has joined #general

uglyog
2018-12-30 22:36
@yousafn this is the best channel for pact discussions. As to the warning about non-determinism it is to make sure that people who are using stubs are aware for the cons of using this strategy. If it is a problem for you, don't use them. Some people will be ok with this if it allows them to get up and running quickly.

uglyog
2018-12-30 22:39
The problem with using validating mock servers is that the requests generally have to be correct, even in the smallest detail, otherwise you get an error response.

bitsapien
2018-12-31 06:08
has joined #general

bitsapien
2018-12-31 06:12
Hey folks! New to PACT, quick question. I'm using `pact-jvm-consumer-junit5` to generate a bunch of pact files. The `pactSpecification` version defaults to `3.0.0`. Is there a way I can set it to v2 ?

tjones
2018-12-31 06:15
I believe it's a parameter to `@PactTestFor`

tjones
2018-12-31 06:17
Try `@PactTestFor( pactVersion = PactSpecVersion.V2 /*...etc */)`

tjones
2018-12-31 06:23
Unless I'm missing something, this workflow seems like it's not consumer driven

tjones
2018-12-31 06:25
As Pact is a consumer-driven testing tool, I think you'll be in for a bad time if you're trying to use mock services to drive consumer development - but I might have radically misunderstood what you're trying to do.

tjones
2018-12-31 06:26
Do your pact files describe your whole API, or just the bits that a particular consumer is expecting?

bitsapien
2018-12-31 06:37
Thanks, that worked.

tjones
2018-12-31 06:37
You're welcome! Happy new year!

bitsapien
2018-12-31 06:37
Happy New Year to you too !!

aruna.muthyala
2018-12-31 06:48
has joined #general

aruna.muthyala
2018-12-31 06:55
Aruna [12:23 PM] HI, I created a clientPactTest class with a mock server with some interactions to my webservice component through stubs, created json file, published it, but got stuck at the Verfication part in the ProciderService. Please answer my queries, regarding the ProviderService for verification: 1) Right now iam running my webservice at command line at localhost port 8080. Then I created a ProviderService with a Pact mentioning the provider url and hostname as localhost and port 8080. So that all my tests hit the webservice which I started at command line. Is this the right approach? 2) Iam a bit confused as at many websites its mentioned that we dont run the actual service for pacts verification and we should create a mock server. So if I create a mock server, do i have re write all the endpoints in my providerservice file, the way it is mentioned in the actual webservice ?

matt.fellows
2018-12-31 10:10
Hi Arun, apologies for the delay. I've answered your SO question

serikch
2018-12-31 14:20
has joined #general

jim.frantzen
2018-12-31 16:15
has joined #general

shekharsp27
2019-01-02 06:10
Hi Aruna, I had a look at your comment on SO question. However, I think you are clubbing more than two services in one pact test. In your case, you have a scenario like (A -> B -> C), so service A will call service B and service B has to make a call to service C to fulfill a request from service A. So in this case you need to stub service C and need to call this service while verifying contract.

shekharsp27
2019-01-02 06:11
Also as you said you are planning to start provider and web service on same port 8080 which is not possible on the same machine. And while verifying contract pact framework will not start provider service automatically

yousafn
2019-01-02 10:42
Hi gents, thanks for the replies. I am not trying to test the whole of the API as a consumer (the provider will take care of functionally testing their API), we have a limited set of consumer expectation tests, and we are running a pact stub server off the back of the generated pact contracts. We noted that with the pact stub server, if we served it specific invalid requests, it would return decide on a match to return, rather than serving a 404. Therefore if in component integration testing, our consumer sends a POST request without a body or without a header, we get served a valid provider response, which gives us a false positive, as the consumer wont fail in component integration but will as we perform e2e. I am on the consumer side, our provider isn?t ready yet and wont be for a while. We have agreed swagger definitions, so have been able to draft up pact contracts to describe our use of the API, and using swagger mock validator tool to ensure that our pact aligns with swagger

yousafn
2019-01-02 10:42
Thanks again for all the work :thumbsup:

yousafn
2019-01-02 23:25
Had some more time to look into this today, I noted there is a pact ruby standalone gem called `pact-mock_service` which contains the bin `pact-stub-service`. I switched over to this implementation and it appears to behave in a more predictable manner as per wiremock, where unmapped routes / requests return a 500 error and a message which shows clearly that this is not a pact contract error response. The issue is was having with `pact-stub-server` (which is the rust implementation) is when sending requests without a json body, or with no content-type header set, it would return the closest match on the end point. The above behaviour may be intended, but wasn't suitable for my needs, it was going to fork it but the ruby `pact-stub-service` solves that issue, and also addresses my other issue raised on your repo @uglyog regarding logging. I am happy to close both if required.


uglyog
2019-01-03 02:54
Great that you found a solution, as the behaviour of the `pact-stub-server` is by design. The pact mock servers are generally strict, so the stub server was created to be more lenient.

aruna.muthyala
2019-01-03 06:34
Hi Shekhar, Let me explain my scenario again. Iam having only one service, which is a Webservice. a) In the ConsumerPact.spec.ts, I created a Pact mock server with some interactions for the above Webservice. And created the pact.json file. b) In PublishPact.ts I published the pact.json file. c) In ProviderPact.ts, I created a Pact object with the location of my pact.json file(broker url) and base_url and port. Its localhost and 8080. And then I verify the pact object with the above options. d) Before I run ProviderPact.ts, I start my webservice manually at commandline at localhost & port 8080. Then I run ProviderPact.ts so it points to my webservice at localhost 8080. My intension is to run the actual websservice so my tests are always in sink with the changes in the webservice. Is this approach right?

surajit.mandal
2019-01-03 07:00
has joined #general

mehdizonjy
2019-01-03 08:40
has joined #general

dagarwal
2019-01-03 12:40
Hello guys , how do you fail the consumer jenkins build when ?can-i-deploy? gives the result as verification failed ? I am adding can i deploy command in the consumer codebase as js file and executing it when build is run

hacosta
2019-01-03 12:58
has joined #general

jdesouza
2019-01-03 12:58
has joined #general

dglaubman
2019-01-03 22:21
has joined #general

mboudreau
2019-01-03 22:26
How is it run? Normally the build would fail if anything but error code 0 is returned

shekharsp27
2019-01-04 05:27
:+1:

dagarwal
2019-01-04 10:19
I am adding can i deploy as a shell command in deploy.js file .When jenkins build is run , that file is executed as node deploy.js

dira.thea
2019-01-05 06:22
has joined #general

thomas.scheuchzer
2019-01-05 10:06
has joined #general

ilya.markevich1991
2019-01-05 16:54
has joined #general

ilya.markevich1991
2019-01-05 17:06
Hi guys. Is there any way to pass some additional info to providerStatesSetupUrl? For now I get only state (which is a string), but I want to pass an object that will be used as provider initial state.

mboudreau
2019-01-05 23:20
Not at this current moment. The idea is that the state string is like a unique identifier between the consumer and the provider. As such, the provider should have its own data for that unique string to setup state.

mboudreau
2019-01-05 23:22
I will agree that this isn't the best experience at the moment and we have talked about potential fixes in the product to be able to attach data to the contract or simply have a better way to manage it on the provider side

ilya.markevich1991
2019-01-06 07:19
Thank you! Yep, I think that would be great to have the feature. It simplifies tests setup a lot

ilya.markevich1991
2019-01-06 07:24
By the way, could you please share available links (maybe github issues or smth else) with discussions about the feature?

mboudreau
2019-01-06 22:23
it was mostly done in person or within the maintainers channel. There's nothing concrete, more of an acknowledgment of the issue

matt.fellows
2019-01-07 00:04
Not sure if this would help your specific situation, but we?re exploring ways to make this a bit richer. See https://github.com/pact-foundation/pact-js/blob/spike/proxy-system/examples/e2e/test/provider.spec.js


lmoore
2019-01-07 04:09
has joined #general

ilya.markevich1991
2019-01-07 10:02
Thank you guys for all your help. Matt, the improvements are really good but doesn?t help me share pre-setup info between consumer and provider. It?s not a big problem for me at the moment, just wanted to know maybe there are some ways to do it. But thank you anyway :slightly_smiling_face:

ilya.markevich1991
2019-01-07 10:06
What I think about is to add field to interaction on consumer side (?providerSetupInfo? for example) and pass the field in ?state? on provider setup.

martin.green
2019-01-07 13:42
has joined #general

ola.jankowska
2019-01-07 14:13
hi, i figured it out, works perfect thanks

charles.prynn
2019-01-07 15:47
has joined #general

cdaly
2019-01-07 18:55
has joined #general

matt.fellows
2019-01-07 20:00
Yes, this is part if the v3 spec but it's not yet supported. We're still working on making that available across the board

matt.fellows
2019-01-07 20:00
:+1:

simon.nizov
2019-01-09 10:14
Hey guys, quick question, should I push the automatically created pact json file to the git repository?

ravbaker
2019-01-09 11:11
no. You shouldn?t. Rather to your pact broker storage.

ravbaker
2019-01-09 11:11
to share it with the provider.

simon.nizov
2019-01-09 16:37
Great, thanks!

mtauraso
2019-01-09 18:26
has joined #general

pravera
2019-01-09 18:30
has joined #general

lauzongrenier.jeremy
2019-01-09 20:26
has joined #general

lauzongrenier.jeremy
2019-01-09 20:44
Hello, I am new to pact and I am very happy I found this gem ! Is it still good practice to set the consumer version to be the commit ID, considering my team is not currently in a continuous deployment cycle, but rather a continuous delivery cycle, and there can be hundreds of commits before tagging the right one to deploy in production environment, say every three weeks or so ? Wouldn't that pollute the pact broker history with useless versioning ? Many thanks ! :smile:

matt.fellows
2019-01-09 21:45
Yep, the broker will handle this just fine. You'll find that over time, most commits aren't changing the actual contract and the broker is smart enough to detect this and manage it effectively

bright.huang
2019-01-10 08:27
has joined #general

pravera
2019-01-10 12:24
Hi guys! Has anyone implemented pact in Travis CI?

jonas.natten
2019-01-10 12:33
I'm doing that in a project

lucas.beier
2019-01-10 12:36
has joined #general

tiago.ferrazmartins
2019-01-10 14:20
has joined #general

tiago.ferrazmartins
2019-01-10 14:25
hi! I have one question. I'm trying to write a match for a array, it can be empty or have at max 5 chars. I cannot use term because it is parsed to array, I cannot use eachlike because the array can be empty and I havent be able to use any other matcher. To ilustrate better, the array can be [], or ['W'] till ['W','W,'W','W','W'].

tiago.ferrazmartins
2019-01-10 14:26
Have anyone dealed with this before?

pravera
2019-01-10 16:54
maybe you need 2 interactions? one for the empty array and another for the max 5 chars?

pravera
2019-01-10 16:55
i'm not sure if it's the best solution

pravera
2019-01-10 16:55
cool! are you following the steps of pact nirvana?

pravera
2019-01-10 18:08
how is that going?

mboudreau
2019-01-10 22:22
that's the correct method. Think each pact interaction like it's own unit test; it's testing one part of the interaction with the provider

abubics
2019-01-10 22:37
If the number of elements in the array is significant, you should have a test for each different state. If it's insignificant, then `eachLike` should be fine :slightly_smiling_face:

leslie.fung.lf
2019-01-11 08:57
has joined #general

tiago.ferrazmartins
2019-01-11 09:42
I have restrictions with this idea. Because matchers increase the flexibility and thus allowing the provider to return different data and still have a valid test.

tiago.ferrazmartins
2019-01-11 09:43
And this solution just takes out all the flexibility I gain with matchers

matt.fellows
2019-01-11 10:28
Did you read the article as to why we recommend this approach?

mboudreau
2019-01-11 11:05
@tiago.ferrazmartins and what are you trying to gain from having a test or an interaction that can provide a whole gamut of different responses? it's like having a unit test that will accept almost any returned result, it's not very useful at finding issues.

tiago.ferrazmartins
2019-01-11 11:08
it is not different from property based testing as long as the result is within the requisites

tiago.ferrazmartins
2019-01-11 11:09
and the function in test is called with a series of valid parameters

tiago.ferrazmartins
2019-01-11 11:13
eachLike does not allow 0, will fail when array is empty. Creating a test for each possible array will only create overhead and contribute little

tiago.ferrazmartins
2019-01-11 11:14
where I could have a matcher and test all possibilities over time and have the same guarantee

tiago.ferrazmartins
2019-01-11 11:14
or almost the same guarantee

mboudreau
2019-01-11 11:17
if you want to do that, sure, but I mean, why test for an array of 0, 1 or multiple? just do a test to make sure it's an array. The matcher is just arrayLike

tiago.ferrazmartins
2019-01-11 11:29
because it is a requirement for it to have maximum of 5 elements, I found this an important requirement to be verified

tiago.ferrazmartins
2019-01-11 11:33
also, the value of the elements is limited, so it also verifiable and part of the contract that just those values are used

tiago.ferrazmartins
2019-01-11 11:34
that's why I find testing only if it is an array is not enough

jonas.natten
2019-01-11 12:16
More or less following the pact nirvana guide. Currently only implemented for interactions between two of our compontents, but it seems to be working flawlessly after initial setup :slightly_smiling_face:

pravera
2019-01-11 19:56
That's great! We're looking forward to implementing it between two services, but still not sure about the steps to follow for our consumer and provider

gbivins4
2019-01-12 00:23
has joined #general

alex291
2019-01-12 15:54
has joined #general

alex291
2019-01-12 15:56
Hi everyone. First of all, thank you for this tool, it'll be awesome in our project. I have an issue I couldn't fix yet, it's about unnamed arrays. The contract I'm writing is like the following:

alex291
2019-01-12 15:56
```[ {object}, {object} ]```

alex291
2019-01-12 15:57
but it only let me create a named one like

alex291
2019-01-12 15:58
```"aName": [{object}, {object2} ]```

alex291
2019-01-12 15:59
I'm using testCompile("au.com.dius:pact-jvm-consumer-junit_2.12:3.6.1")

alex291
2019-01-12 16:00
Can anyone help me?

alex291
2019-01-12 16:00
Thank you :slightly_smiling_face:

mboudreau
2019-01-12 23:51
you mean, the top level json is an array and not an object, right?

mboudreau
2019-01-12 23:52
how are you creating the interaction?

abubics
2019-01-13 09:33
It sounds like you want an `eachLike` with a max of 5?

abubics
2019-01-13 09:33
What part of the system are you testing by checking lists with each different length?

abubics
2019-01-13 09:35
And how are you setting up the provider state?

mat.auburn
2019-01-13 13:51
has joined #general

rjmcguinness
2019-01-14 14:33
Does anyone have experience with automating the generation of consumer pact tests/boilerplate? Or at least streamlining, perhaps with a cli? My current process of copying an old test and replacing things to suit the new one is just a wee bit clunky

pravera
2019-01-14 18:30
When publishing from the CI im having the following error: Failed to publish pact due to error: PactBroker::Client::Error

pravera
2019-01-14 18:30
it's weird cause in the same build that happens for only one pact

pravera
2019-01-14 18:31
there's a pact for another provider that is correctly being published to the broker

pravera
2019-01-14 18:31
anyone has a clue?


matt.fellows
2019-01-14 20:20
that being said, I know of others using other strategies to generate the tests by linking them to _other types of tests_ so that they are still going to be relevant as your code changes

mboudreau
2019-01-14 23:11
@pravera What's the client error specifically? any http errors?

matthew
2019-01-15 06:13
So I upgraded a project from babel 6 to babel 7 and my E2E tests in Nightwatch that use Pacts as mocks no longer work. Any idea how to debug this? The trace from pact-js doesn't really show anything wrong, but every call to `addInteraction` results in a ECONNREFUSED

mboudreau
2019-01-15 06:18
if you revert, does it work again?


matthew
2019-01-15 06:32
but there's also a decent amount of changes when going from 6 to 7

matthew
2019-01-15 06:32
what's weird is that according to the logs it looks like the mock server is starting up


matthew
2019-01-15 06:33
``` [2019-01-15T06:09:01.915Z] INFO: pact-node@6.21.2/2315 on 73281f2e23a6: Creating Pact Server with options: consumer = sojournal-ui, cors = true, dir = /opt/pacts, host = 127.0.0.1, log = /opt/app/logs/pact.log, pactFileWriteMode = overwrite, port = 3001, provider = sojournal-api, spec = 2, ssl = false, sslcert = , sslkey = [2019-01-15T06:09:01.918Z] INFO: pact@7.2.0/2315 on 73281f2e23a6: Setting up Pact with Consumer "sojournal-ui" and Provider "sojournal-api" using mock service on Port: "3001" ```

matthew
2019-01-15 06:33
``` Unable to connect to "http://127.0.0.1:3001/interactions" Caused by: Error: connect ECONNREFUSED 127.0.0.1:3001 at Socket.socketErrorListener (_http_client.js:391:9) at emitErrorNT (internal/streams/destroy.js:82:8) at emitErrorAndCloseNT (internal/streams/destroy.js:50:3) at process._tickCallback (internal/process/next_tick.js:63:19) ```

mboudreau
2019-01-15 06:47
Weird. Do you think Babel is changing the pact js?

matthew
2019-01-15 06:49
my hunch is that something somewhere doesn't like babel 7 or something, but I'm not sure

matthew
2019-01-15 06:49
going to try to do some more diffing in the morning

matthew
2019-01-15 06:49
see if I can nail down exactly which package is breaking

mboudreau
2019-01-15 08:09
Thanks, that would be very helpful. I can't imagine what's causing it

matt.fellows
2019-01-15 08:51
thanks @matthew - hopefully we can get to the bottom of it

matt.fellows
2019-01-15 08:51
haven?t had that combination on a project just yet

rjmcguinness
2019-01-15 09:24
The strategy of linking to other types of tests is interesting to me, as currently have to change both pact tests and unit tests if a contract changes. Could you point me in the direction of an example of this? I have also just abstracted lots of boilerplate code from my pact tests into a helper class which saves on maintenance and adds readability. Even if I cannot link to unit tests, I?m happy with this for the time being.

pravera
2019-01-15 13:33
yes, i'm getting a 500 error @mboudreau

makhov.alex
2019-01-15 13:52
has joined #general

pravera
2019-01-15 16:38
but i'm not getting any description of the error

pravera
2019-01-15 16:38
just that

matthew
2019-01-15 17:02
Yeah too be fair it's a bit complex. Running everything in Docker as well, so an extra layer of wtf. What's interesting is that I reuse the same Pact setup and config and stuff for unit tests and that works, only when I'm setting up for e2e tests in nightwatch.

mary.oconnor
2019-01-15 17:20
has joined #general

pravera
2019-01-15 20:16
I have two pacts to publish but i'm having an error when publishing only one of them (only for a specific Consumer_A/Provider_A). The error is a PactBroker::Client::Error with 500 status code. When running the `bundle exec rake pact:publish`, it tags the version of the app and the branch name, publishes correctly for Consumer_A/Provider_B, and then fails when publishing the next pact. The publishing step shown before the error: `Publishing Consumer_A/Provider_A pact to pact broker at https://pact.URL.com` , and stops there. I tried: - Publishing locally - Changing the content of the pact to the same JSON than the last one published - Publishing only for Consumer_A/Provider_A and not Consumer_A/Provider_B

pravera
2019-01-15 20:38
So pact:publish triggers a PUT to the broker right? Is it possible to check this failing requests?

matt.fellows
2019-01-15 22:50
Hmm not that I can find, but I do recall it coming up in Slack/Github at some point - might be worth searching the channels for it sorry

matt.fellows
2019-01-15 22:51
The boilerplate reduction approach is pretty commmon. Probably so common that we could do something about it

matt.fellows
2019-01-15 22:51
suggestions welcome!

matthew
2019-01-16 03:09
So digging in deeper (trying to go about updating a single package at a time), when going from @pact-foundation/pact 5.9.1 to 7.2.0 I start getting: ``` Pact Binary Error: Could not load existing consumer contract from /opt/pacts/sojournal-ui-sojournal-api.json due to undefined method `gsub' for nil:NilClass. Creating a new file. ```

matthew
2019-01-16 03:09
goes away if I change the write mode from update to overwrite, but not sure if that's a symptom of something else

mboudreau
2019-01-16 04:26
weird

mboudreau
2019-01-16 04:28
@bethskurrie Any idea what this error means?

matt.fellows
2019-01-16 04:33
I have a feeling that `update` is no longer allowed, just `merge` (I know this is contrary to the docs).

matt.fellows
2019-01-16 04:34
The error above looks like some other problem wasn?t caught earlier (i.e. it made assumptions about things working) and failed later on in the piece. It looks like a fairly generic error

matthew
2019-01-16 04:58
I've also figured out that my initial problem wasn't babel, but something with nightwatch

matthew
2019-01-16 04:58
not sure how that's affecting it though

bethskurrie
2019-01-16 04:59
I'd need the full stacktrace

bethskurrie
2019-01-16 04:59
If you can't get that, then can you create a repository with instructions to replicate the issue.

shirishcin
2019-01-16 13:11
has joined #general

rjmcguinness
2019-01-16 16:37
No worries. If this boilerplate reduction proves useful and we are happy with it in our codebase I?ll at least open a pr for an example test helper (using angular/ts/karma/jasmine right now).

shirishcin
2019-01-16 16:51
i am just not able to get started with pact on java intellij

shirishcin
2019-01-16 16:51
is there a simple project which i can use ?

ots.indrek
2019-01-16 17:35
Question regarding `can-i-deploy`. When I do `pact-broker can-i-deploy --pacticipant my-pacticipant --version 5e471db --to prod ...`, the result is the following ``` Computer says no ¯\_(?)_/¯ CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? ---------------|-----------|----------------|-----------|--------- service-a | 55c8086 | my-pacticipant | 5e471db | true service-b | 79f7707 | service-a | 55c8086 | true service-b | 79f7707 | my-pacticipant | 5e471db | true service-c | 380fd66 | my-pacticipant | 5e471db | true service-d | 2c5a9c7 | service-a | 55c8086 | true service-d | 2c5a9c7 | service-c | 380fd66 | true service-d | 2c5a9c7 | my-pacticipant | 5e471db | true service-e | 2a845ca | my-pacticipant | 5e471db | true service-f | 1d8bed8 | service-a | 55c8086 | false service-f | 1d8bed8 | my-pacticipant | 5e471db | true service-g | 70d633a | my-pacticipant | 5e471db | true my-pacticipant | 5e471db | service-a | 55c8086 | true One or more verifications have failed ``` From what I understand, `can-i-deploy` does not allow me to deploy `my-pacticipant` to `prod` because of `service-f | 1d8bed8 | service-a | 55c8086 | false`. I would have expected the output of `can-i-deploy` to only include consumer-provider pairs where `my-pacticipant` is either a consumer or a provider. Instead, I see that the output shows also `service-f` ->`service-a` and other pacticipants that are not related to `my-pacticipant`. Is this an expected behaviour? Perhaps I have fundamentally misunderstood something.

dparkes
2019-01-16 19:20
has joined #general

gopinathlangote11
2019-01-17 11:22
Well. I was also expecting not to see the other mappings than my participant


gopinathlangote11
2019-01-17 11:23
I am not pretty sure about ```-a, --pacticipant=PACTICIPANT # The pacticipant name. Use once for each pacticipant being checked.```

gopinathlangote11
2019-01-17 11:23
What does `Use once for each pacticipant being checked.` means

tomo
2019-01-17 11:34
has joined #general

alessio.paciello
2019-01-17 16:03
did anybody have to provide custom `Converter` to Spring `MockMvcTarget`?

pravera
2019-01-17 21:05
The solution was to restart the pact-broker server

matt.fellows
2019-01-18 02:58
that would be great!

karishnu
2019-01-18 05:28
has joined #general

galvinshane
2019-01-18 11:34
has joined #general

ashish.dubey91
2019-01-20 07:16
hey guys - is there a backlog of things which can be used for newbies to start contributing to pact tools? like `easy pickings` or `first time bugs` or something else

matt.fellows
2019-01-20 07:17
I use tags on pact js and go to indicate which ones are ready and good for New comers.

matt.fellows
2019-01-20 07:17
Can't remember the tag


matt.fellows
2019-01-20 07:31
That's more for general help


matt.fellows
2019-01-20 07:31
This is for more newcomers

ashish.dubey91
2019-01-20 07:31
great

matt.fellows
2019-01-20 07:32
I'm just making dinner, but glad for the reaching out. I'm sure we can do more/better - please let us know how

ashish.dubey91
2019-01-20 07:33
sure thing. since we've been playing with pact for a while, I wondered what are the ways for us to start contributing

chris
2019-01-21 14:36
has joined #general

rosemaryjarnold
2019-01-22 00:44
has joined #general

charles.prynn
2019-01-22 10:40
Hey - does anyone know of an example project using `pact-mock-service-docker` docker image? I can't quite work out how to use it if each instance should be for one consumer/provider and cleared before each test.

matt.fellows
2019-01-22 11:00
Yes it probably should

matt.fellows
2019-01-22 11:02
The provider and consumer are given to the service when started, so it's specific to a consumer/provider pair

charles.prynn
2019-01-22 11:44
@matt.fellows Thanks for the reply. Wonder what the use case is for the docker image.. I'll go back to the starting the instance via PHP.

uma.shanker
2019-01-22 12:21
PACT JVM for Message Queues : Can someone provide guide/reference/sample for simple consumer and provider test over kafka message queue?

ramakrishnan.nagaraja
2019-01-22 18:39
has joined #general

ramakrishnan.nagaraja
2019-01-22 18:44
Hi - just started exploring about using pact broker in .net. While trying to publish the pact to the hosted domain from http://pact.dius.com.au, I am getting "One or more errors occurred. (No such host is known). Socket exception" Any idea why it is? I am using the host as sent in the invite email from Pact. Any help is much appreciated.

ramakrishnan.nagaraja
2019-01-22 19:01
I got this No such host is known fixed. Now getting another error "Failed to publish Pact to the broker with http status NotFound: Not Found".

abubics
2019-01-23 02:50
:point_right: #pact-net

gyula
2019-01-23 12:18
has joined #general

bethskurrie
2019-01-24 04:23
yes.

rabih
2019-01-24 06:39
has any one worked with versioning pact with CI builds and github?

matt.fellows
2019-01-24 06:47
what?s your specific question/challenge?

rabih
2019-01-24 06:58
so on every commit, CI Build process will run. I want to know if it is possible to tag the consumer/provider version with a build number?

matt.fellows
2019-01-24 06:59
yes, of course you can. What problem are you having in doing so?

matt.fellows
2019-01-24 06:59
I would suggest as a start, reading https://github.com/pact-foundation/pact_broker/wiki/Pacticipant-version-numbers (and the other tag related docs there)

matt.fellows
2019-01-24 07:00
?and the effective pact setup guide: https://docs.pact.io/best_practices/pact_nirvana

rabih
2019-01-24 07:00
ok sure, Thank you

matt.fellows
2019-01-24 07:01
you?re welcome

inaki.varebeke
2019-01-24 12:06
has joined #general

jeanlouhallee
2019-01-24 13:45
has joined #general

ravbaker
2019-01-24 14:19
I would not recommend numbering with builds but with commit-sha

vivanov.vasily
2019-01-25 00:37
has joined #general

karishnu
2019-01-25 04:37
Is the Pact file generation and the mock server linked? The code examples imply that a Pact file can be generated only after a mock server is set up. However, why can't it be generated from the transactions alone?

matt.fellows
2019-01-25 04:58
In most of the languages, yes, they are linked

matt.fellows
2019-01-25 05:00
The reason is more to do with the ability to scale pact across languages (we re-use the validation/logic engine within the mock server instead of writing for each version of the specifiction for each language)

matt.fellows
2019-01-25 05:00
In Pact JVM this may noto be th ecase

karishnu
2019-01-25 05:08
So basically the code behind the mock server is responsible for Pact file generation too?

matt.fellows
2019-01-25 05:10
yes

matt.fellows
2019-01-25 05:11
It is more modular than that, but because each language binding has to ?cross the boundary?, as far as pact-js is concerned for example, that is the case

karishnu
2019-01-25 05:23
Thank you!

matt.fellows
2019-01-25 05:23
:thumbsup:

ravbaker
2019-01-25 06:32
Why? To be able later easily submit contract verification results back to Github or similar

norepeat17
2019-01-26 22:23
has joined #general

norepeat17
2019-01-26 22:41
Hi @everyone I have one question while using Pact. Is it right to implement the consumer-driven-test with Pact in the front-end under the situation that APIs are not developed yet?

matt.fellows
2019-01-26 22:49
Yep, that's one of the main use cases

norepeat17
2019-01-26 22:52
Thanks for your prompt reply. The cause that I have such this question is that I got this error while implementing tests with Pact.

matt.fellows
2019-01-26 22:58
Can you elaborate more on what you're currently doing? Obviously if you're trying to connect to the real service if it doesn't exist it won't work. Pact is almost always designed to work on localhost

norepeat17
2019-01-26 23:02
As I mentioned above, this service is not developed yet. But I need to implement the tests only with the format of the request and response. Ah, `Pact is almost always designed to work on localhost` This means I should mock the service on my local, right?

matt.fellows
2019-01-26 23:04
Yes, but that's what pact does. When you setup your tests, pact starts a mock service for you. You should configure your code during test to point at it instead of the real thing

norepeat17
2019-01-26 23:07
I see. Thank you. First, I will have some tests on my side And I will come back to you again.

norepeat17
2019-01-26 23:07
Thank you again!

matt.fellows
2019-01-26 23:10
:+1:

norepeat17
2019-01-26 23:24
Hi, I tried to test with mock service but I received `undefined` as a response.

norepeat17
2019-01-26 23:31
The response of the mock service is not a thing that I expect in the interaction.

matt.fellows
2019-01-26 23:40
Upon receiving is mandatory, also you should include the / in the expected path

matt.fellows
2019-01-26 23:40
Have you seen the examples?

norepeat17
2019-01-26 23:44
Thank you, I am now fixing and trying again.

nikolajs.cmihuns
2019-01-28 13:54
Hi, can some help to write in Java dsl the following json object `{"report": "entries": [], "color": "A"}`

nikolajs.cmihuns
2019-01-28 13:55
entries is array of integers which can have zero records

nikolajs.cmihuns
2019-01-28 14:47
did not write curly braces , so json object is - `"report": {"entries": [],"color": "A"},`

nikolajs.cmihuns
2019-01-28 16:52
entries_zero

nikolajs.cmihuns
2019-01-28 16:52
looks like there is no easy way of creating array of integers

thirumal.net
2019-01-28 18:42
~hi~

thirumal.net
2019-01-28 18:42
Hi All, i have specific question related to local development. When developer will run PACT test on local machine, consumer will publish local changes to pact broker. if many developers are working on the same client version in different branches simultaneously (19.0.0 for e.g.). Are there any possibility to understand that integration was broken by local development or by main release branch changes? * i am trying to understand what is the best way to pubslish the pact file to pact broker ? is it through main branch with CLI process or when ever code changes locally through specific branch?*

antonello
2019-01-28 18:55
@thirumal.net You would want to avoid publishing pacts when running the tests locally. There may be occasional circumstances in which you?d want to do that, but generally speaking it should only been done by your CI pipeline.

thirumal.net
2019-01-28 19:09
@antonello -Thank you for your reply. does that mean, developer knows only whether contract is broken or not once after running the CI pipeline ? i am just thinking what is the harm if we run pact test through locally with different branches since pact broker is smart enough to understand whether there is a change or not in pact file, if there is a change then only it will invoke/give signal to provider side , am i correct ?

james.carman
2019-01-28 19:55
If you upload a pact that?s bad from your local workstation, you could impact the provider?s build status. Also, you don?t have good traceability if you allow upload from a developer?s workstation.

james.carman
2019-01-28 19:55
I would stick with *only* the CI server doing the uploads as @antonello said, because it will be performing a repeatable, traceable build process.

matt.fellows
2019-01-28 21:32
@thirumal.net recommend you read this https://docs.pact.io/best_practices/pact_nirvana

sanyam.satia
2019-01-28 21:56
has joined #general

vicenzo
2019-01-28 22:03
has joined #general

nikolajs.cmihuns
2019-01-29 05:16
cc @uglyog @bethskurrie @matt.fellows

nikolajs.cmihuns
2019-01-29 08:33
if someone will encounter the same problem

nikolajs.cmihuns
2019-01-29 08:34
`.object("report", new PactDslJsonBody() .minArrayLike("entries", 0, PactDslJsonRootValue.integerType(), 0) .stringMatcher("color", "^[-ARG]{1}$", "R") )`

chodera.adam
2019-01-29 09:14
has joined #general

norepeat17
2019-01-29 09:19
Hi, I have some problems to publish pacts. So I've checked this https://github.com/pact-foundation/pact_broker In this example, pact broker is running based on ruby. Is it possible to run pact broker with node.js? If yes, there is any example to reference?

karishnu
2019-01-29 09:50
As far as I know the Pact broker is only written in Ruby and you cannot run it using Node. However, its very easy setting it up using the Docker image and requires little to no coding experience.

norepeat17
2019-01-29 09:52
Thank you @karishnu

norepeat17
2019-01-29 09:52
Could you please send me your samples so I can reference it?

karishnu
2019-01-29 09:54
Samples? This page describes the set up process - https://github.com/pact-foundation/pact_broker#rolling-your-own

norepeat17
2019-01-29 09:57
I decided to not use Docker. But now, I will try Docker and come back to you if I have some problems. Thank you.

matt.fellows
2019-01-29 10:51
hi Mazping, what problems are you actually having? (you alluded to problems, was it just related to hosting the Ruby bit?)

matt.fellows
2019-01-29 10:51
as an aside, we have a hosted version available at http://pact.dius.com.au if you want to reduce the amount of setup and management required to run it

matt.fellows
2019-01-29 10:52
If you need to see examples in node JS publishing to the broker, our repo has examples (see e2e) that demonstrate that feature

norepeat17
2019-01-29 10:59
Sorry for the delay in responding. Thanks a lot for your detailed explanation.

norepeat17
2019-01-29 11:00
I will try on my side and come back to you.

matt.fellows
2019-01-29 11:24
ah, nice one!

matt.fellows
2019-01-29 11:24
Sorry I?m not really across the JVM matching library - and without a heavy IDE it can be hard to see what fits into what in Java :smile:

nikolajs.cmihuns
2019-01-29 11:29
it's ok, missed somehow javadocs, here is the link


nikolajs.cmihuns
2019-01-29 11:30
thanks for the reply anyway :+1:

norepeat17
2019-01-29 14:46
@karishnu@matt.fellows Thanks for your support again. I've ran the pack broker with Docker. Now, I have one question. As you can see through screenshot, the pact verification result is not mentioned. I think it is because I skipped the verification step while implementing pact tests. So I'd like to just confirm the steps that I think for verification. 1. create pactverify.js as the second screenshot. 2. create npm script as `node ./pactverify.js` I should run this script before publish, right?

norepeat17
2019-01-29 15:33
If I think something is wrong, verifying pacts should be done on the provider side?

matt.fellows
2019-01-29 21:27
This is the order: 1) Run consumer tests 2) publish pacts 3) run provider tests (which will publish verification results)

matt.fellows
2019-01-29 21:27
step 1/2 happens in the same consumer?s CI pipeline

matt.fellows
2019-01-29 21:27
Step 3 happens in the provider?s CI pipeline

norepeat17
2019-01-30 07:17
Thank you. I thought something wrong.

melisturgul
2019-01-30 12:43
has joined #general

claudia.cordes.de
2019-01-30 13:17
has joined #general

dagarwal
2019-01-30 14:49
Hello guys , when i add pact matching with term here on path withRequest: { method: ?GET?, path: term({ matcher: ?/api/assets/[0-9]+?, generate: ?/api/assets/10006? }), }, ( I am getting 404 when i try to load the data on UI :disappointed: ) .Without adding matcher it just works fine for me . Any suggestions on what went wrong and how to achieve it ?

thirumal.net
2019-01-30 18:59
@matt.fellows - can you please clarify one question related to step 2 and step3 ? as per my understanding pact broker should invoke provider side build which will run the pact verification step . if provider build is taking lot of time what would be the better way to handle pact verification from provider side . for example one of provider system build runs for 1 hour to build the solution and running the test cases, in this scenario what is the best way to handle pact verification. i recommended invoking provider build from pact broker through web hooks but provider team dismissed my recommendation saying that we are not going to allow provider build to run multiple times in a day for 1 hour

vitaliy.grigoruk
2019-01-30 20:04
has joined #general

matt.fellows
2019-01-30 20:23
looks ok to me Dolly, what do the pact logs say?

matt.fellows
2019-01-30 20:24
The broker doesn?t have to invoke it (via web hooks) but that is a good approach for many.

matt.fellows
2019-01-30 20:26
If the provider build is taking a long time, well that?s a separate problem altogether. That?s quite a long time, and perhaps there is something else that needs to be looked at / addressed. I can?t give you specific advice about your domain/application etc., but one option could be to split the provider into smaller units so things aren?t so slow. In terms of pact, perhaps you can make the webhook only invoke the ?contract? related tests, instead of the entire pipeline?

matt.fellows
2019-01-30 20:26
This way at least you?ll get faster feedback on the contract verification

thirumal.net
2019-01-30 20:30
@matt.fellows -Thank you for clarifcation. i will recommend to run only contract related tests through web hook instead of entire pipeline

matt.fellows
2019-01-30 20:32
It?s worth thinking through the side-effects of that decision - I?m not sure what the pipeline covers, but presumably a lot. If the contract tests pass, this is probably a good indicator that things are working (especially if you have good coverage), but do exercise some caution

thirumal.net
2019-01-30 20:33
Sure, Thank you!!

andreas.flinck
2019-01-30 21:11
has joined #general

mikhail.laptev
2019-01-31 01:57
has joined #general


mboudreau
2019-01-31 05:15
@oswald.quek good job on the blog, would love to get more opinions about what worked and what could be improved in the process :slightly_smiling_face:

matt.fellows
2019-01-31 05:58
yep!

matt.fellows
2019-01-31 05:59
I tweeted yesterday, great news! We had a conference call with the team mid last year. Really great bunch of people and are doing some awesome stuff

mboudreau
2019-01-31 06:05
cool

mboudreau
2019-01-31 06:05
who's "we"? :stuck_out_tongue:

matt.fellows
2019-01-31 06:18
Beth and Ron and I

mboudreau
2019-01-31 06:23
:disappointed:

oswald.quek
2019-01-31 09:39
yes thanks for all your help and guidance @matt.fellows @bethskurrie @uglyog!

oswald.quek
2019-01-31 09:39
i think, and this is just personal opinion, is one of the things that worked for us is bypassing the java dsl completely and writing pacts in their json form


oswald.quek
2019-01-31 09:40
the pact is `publicapi-connector-create-payment.json` which is found at https://github.com/alphagov/pay-publicapi/tree/master/src/test/resources/pacts

oswald.quek
2019-01-31 09:40
java isn't good for dsls in my opinion

mboudreau
2019-01-31 10:22
Yep, understood. We've had a few people tell me something similar. I think we need to improve the experience of creating the contract

vitaliy.grigoruk
2019-01-31 10:57
Hi there. I?m looking for help / suggestion. We?re trying to implement CDCs with pact and got stuck with verification of a contact on providers side. Our contract contains a lot of requests which require auth by different users (different value for Authorization header). Currently, we can only specify 1 header value for all requests. Any suggestions / workarounds? (I?ve seen this issue, which is about the same https://github.com/pact-foundation/pact-js/issues/209)?

vitaliy.grigoruk
2019-01-31 10:57
We?re using pact-js on both consumer and provider sides.

matt.fellows
2019-01-31 11:57
Yep, that issue is in progress and we're looking for feedback. Would love your feedback on it if you're willing to try. It's functional, but not looking to put more quality into it until we get more community validation/involvement


dagarwal
2019-01-31 11:59
@matt.fellows

matt.fellows
2019-01-31 11:59
The crappy workaround I usually implement is a proxy in front of the provider that can override those headers as needed. It's basically what is moving into the frame work

vitaliy.grigoruk
2019-01-31 12:00
thanks for your answer, I?ll try it then and provide my feedback then.

matt.fellows
2019-01-31 20:26
That?d be great. I?d personally like to see this out the door, and if it proves useful i?ll roll it into other languages I maintain (e.g. Go)

ruairitobrien
2019-02-01 03:48
has joined #general

hossam.saraya.ext
2019-02-01 09:25
has joined #general

hossam.saraya.ext
2019-02-01 09:26
Hello guys. Where do we ask technical questions?

matt.fellows
2019-02-01 09:30
Depends on the topic

hossam.saraya.ext
2019-02-01 09:35
I think I found a better channel to ask the questions..lets keep general clean :stuck_out_tongue:

karishnu
2019-02-01 12:36
The provider depends on other services, and if one of those services are down during provider verification, the verification will fail. Does Pact help solve this issue?

vitaliy.grigoruk
2019-02-01 13:39
I?d suggest to run provider verification in development / test / ci environment, where you can mock those services your provider depends on @karishnu

rafael.anachoreta
2019-02-01 13:45
has joined #general

tomw
2019-02-01 15:49
has joined #general

manpreet1107
2019-02-01 16:41
has joined #general

shwetapachori1
2019-02-01 17:49
has joined #general

carolyn0429
2019-02-01 20:20
has joined #general

matt.fellows
2019-02-01 22:01
:wave:

abubics
2019-02-01 23:58
Pact helps more with verifying the contact between implementations of services. To check connectivity between instances of services (i.e. during deployment), you probably want a smoke test :)

matt.fellows
2019-02-02 02:59
Pact is designed to pick up issues prior to deployment, and each component is tested in isolation from others. So in a way, yes, it solves that problem as the dependencies should be stubbed out

karishnu
2019-02-02 07:23
@vitaliy.grigoruk Makes sense! Will give it a try.

hansika
2019-02-03 10:13
has joined #general

doritrieur
2019-02-03 15:11
has joined #general

mark.meninger
2019-02-04 02:26
has joined #general

phodgkinson
2019-02-04 14:05
has joined #general

mehrotrashubhangi
2019-02-04 16:12
has joined #general

julian.jelfs
2019-02-04 17:04
has joined #general

hossam.saraya.ext
2019-02-04 17:14
Why can't we generate pacts from interaction definitions directly? Why do we need a mock server in between the testing layer and the interactions. Is there any other way to do that other than generating the pacts through the mockup server?

james.carman
2019-02-04 17:45
Well, the mock server serves double duty

james.carman
2019-02-04 17:45
you can use it to test your client code too

james.carman
2019-02-04 17:46
I find the approach nice, because I usually end up having to figure out a way to mock out the downstream services myself in order to test my client library I?ll use to talk to it. This way, I get to kill two birds with one stone.

james.carman
2019-02-04 17:46
disclaimer: no *actual* birds were harmed

james.carman
2019-02-04 17:46
@hossam.saraya.ext ^^^^

hossam.saraya.ext
2019-02-04 17:49
Yea I agree..but in some situations one might want to isolate pact's flow from their current testing flow

james.carman
2019-02-04 17:49
I don?t know that anything really dictates that you generate the pact JSON files this way, either. If you can hand-craft them and get them uploaded to the broker, I suppose that?d work also

hossam.saraya.ext
2019-02-04 17:49
yea thats what I had in mind..like implicitly firing http requests against the mock server

james.carman
2019-02-04 17:49
I believe the maven plugin will upload JSON files from any directory you point it at

james.carman
2019-02-04 17:50
I?m a Java guy, but, I suppose the other tooling options would allow the same thing

hossam.saraya.ext
2019-02-04 17:50
ah my question is not about the broker. It's about the part where contracts get generated

james.carman
2019-02-04 17:50
oh, I think I misunderstood

james.carman
2019-02-04 17:51
my apologies

james.carman
2019-02-04 17:51
turns ears back on

hossam.saraya.ext
2019-02-04 17:51
nothing to apologise for

james.carman
2019-02-04 17:51
So, what is it that you want to achieve?

hossam.saraya.ext
2019-02-04 17:51
I want my pact contracts generated without having any unit tests

james.carman
2019-02-04 17:52
generated from what?

hossam.saraya.ext
2019-02-04 17:52
from interactions

hossam.saraya.ext
2019-02-04 17:52
just interaction objects or files

james.carman
2019-02-04 17:52
oh, so more like an api ?specification? in some form

james.carman
2019-02-04 17:52
like OpenAPI or swagger?

hossam.saraya.ext
2019-02-04 17:52
exactly

hossam.saraya.ext
2019-02-04 17:52
no, just the normal interaction form for pact

james.carman
2019-02-04 17:52
or WADL, etc.

james.carman
2019-02-04 17:53
ok, gotcha

hossam.saraya.ext
2019-02-04 17:53
``` { state: 'no conditions', uponReceiving: 'a request to do w/e', withRequest: { method: 'POST', headers: { ... }, path: '...', body: like('str') }, } ```

james.carman
2019-02-04 17:53
I suppose you *can* hand-craft those if you?d like

james.carman
2019-02-04 17:54
but, what would you do with them?

james.carman
2019-02-04 17:54
What do you envision your flow to be?

hossam.saraya.ext
2019-02-04 17:54
1. I would write the interactions manually to describe how the consumer speaks to the provider

james.carman
2019-02-04 17:55
this would be how a *particular* consumer views the world, then?

james.carman
2019-02-04 17:55
how they intend on using said service?

hossam.saraya.ext
2019-02-04 17:56
yea exactly

james.carman
2019-02-04 17:56
ok, go on. Now what happens?

hossam.saraya.ext
2019-02-04 17:57
a consumer is still responsible for documenting its interactions with all providers it speaks to

hossam.saraya.ext
2019-02-04 17:57
2. I use a util from pact that takes these interactions and generate contracts in `pactSpecification` format

james.carman
2019-02-04 17:57
ok, so you want to use the DSL to generate a pact file, but you don?t want to be forced to ?exercise? that pact right this second?

james.carman
2019-02-04 17:58
currently, I believe that if you don?t use one of your interactions, it?ll barf with some error message

james.carman
2019-02-04 17:58
am I understanding you correctly?

hossam.saraya.ext
2019-02-04 17:58
> ok, so you want to use the DSL to generate a pact file, but you don?t want to be forced to ?exercise? that pact right this second? kind of, I don't want to write code for setting up a provider and launching http requests against it

hossam.saraya.ext
2019-02-04 18:01
I think an option would be to write the contracts manually..but that feels wrong

james.carman
2019-02-04 18:11
I think the philosophy (I?m not the expert, so hopefully one of the gurus will correct me if I?m way off base here) is that you really don?t know that your ?pact? is correct or not if you don?t use it (dog-food it) in some way, by testing/exercising your client code against it

james.carman
2019-02-04 18:12
If you don?t use it, you?re really not asserting anything useful from the client side

hossam.saraya.ext
2019-02-04 18:14
that's true

hossam.saraya.ext
2019-02-04 18:15
but when I define the interaction and write a test to assert for the interaction I just hardcoded..that sounds like doing it twice to me. Maybe I am missing something

james.carman
2019-02-04 18:35
that?s a fair point

james.carman
2019-02-04 18:36
I might be too far out over my skis here, so maybe one of the gurus can jump in

james.carman
2019-02-04 18:36
:slightly_smiling_face:

james.carman
2019-02-04 18:36
I agree that sometimes the consumer-driven contract testing can get tedious

james.carman
2019-02-04 18:36
Is there a better way? That?s a fair question to ask (and it?s how innovation happens)

zach.the.hammer
2019-02-04 19:44
hey all! haven't had much time for off-hours developing so haven't been too active here for a bit, but i have a question re: plans for pact i know @bethskurrie mentioned once when talking about the python implementation of pact/request/response matcher logic eventually (ideally) moving to one implementation (i believe in rust) what are thoughts on having a side-effect free endpoint on the pact broker that takes in a request / response and a pact, runs the matcher algorithm, and returns the match document? i think this could be pretty cool (but not perfect). essentially pact libraries could just check their pact broker on what their matcher results are, and not have to worry about implementing that logic in their own language or porting in some tricky way to another languages implementation

zach.the.hammer
2019-02-04 19:45
that request/response service could also live in a shipped docker container that you run locally for testing / CI

matt.fellows
2019-02-04 20:19
So if I understand correctly, rather than verifying locally, you?d have the provider verify by talking directly to the broker which has that capability?

matt.fellows
2019-02-04 20:20
@hossam.saraya.ext @james you kinda of covered it, but here is the docs link that discusses this tension: https://docs.pact.io/faq#can-i-generate-my-pact-file-from-something-like-swagger

abubics
2019-02-05 00:40
In the consumer side of Pact tests, there are 3 potential gains: - declaring the intent of a consumer-side API client - verifying that the API client sends out the correct request - verifying that the API client handles the incoming response correctly

abubics
2019-02-05 00:40
You *don't* really get any value from asserting things in the unit test that Pact already verifies

abubics
2019-02-05 00:41
But you can get value from asserting that, for example, once the JSON came in, it was converted to domain objects properly.

abubics
2019-02-05 00:42
I think there are some code samples that just assert the same things that Pact already checks, and we should fix those, rather than devaluing the process (of exercising our API clients)

hossam.saraya.ext
2019-02-05 00:43
I meant that we already define the interactions as json objects and feed it to the mockserver. Doing that and then testing/asserting for the interactions feels like doing the same thing twice just in a different way

hossam.saraya.ext
2019-02-05 00:46
I think if we have something that generates the contracts directly from the interaction objects we define, it won't defeat pacts purpose if we integrate this as a step in consumer ci pipeline

hossam.saraya.ext
2019-02-05 00:48
you are welcome to correct me..I am just speaking out of my 1-week-old pact experience

hossam.saraya.ext
2019-02-05 01:13
Yea I see where that is coming from! I think the selling point for having pact as a unit test is the luxury to treat it as a real provider and write less stubs/mocks inside your unit tests. Also, if I use pact in unit tests, I would integrate it into the current tests that asserts request body,headers..etc against mocked/stubbed provider client code instead of writing new `<filename>.pact.spec.js`

zach.the.hammer
2019-02-05 01:46
Basically just having an http endpoint to verify against

zach.the.hammer
2019-02-05 01:46
As an easy way to integrate a dedicated ?matcher? in any language


karishnu
2019-02-05 05:24
I had a similar question a while ago too.


matt.fellows
2019-02-05 06:37
One issue I would have with this, is that in mandates the use of a broker - something that is a managed infrastructure. On the one hand, commercially that would be great for business, but on the other, the Pact Broker is currently still an ?optional? part of the ecosystem

abubics
2019-02-05 06:38
@james.carman If you wanted to get some more rationale, my take is hiding in this thread ;D

matt.fellows
2019-02-05 06:38
We have bandied around similar ideas for the broker to enrich the experience, just not for replacing aspects of the core

matt.fellows
2019-02-05 06:38
(and you?re right, rust is the target)

matt.fellows
2019-02-05 06:39
I think I understand what you?re saying

matt.fellows
2019-02-05 06:40
> Doing that and then testing/asserting for the interactions feels like doing the same thing twice just in a different way (edited) Just to be clear, you shouldn?t be asserting that the response was `200` both in Pact and then in the unit test. The Unit test should be _testing the code that calls the API_ - e.g. a `UserService` which may return a `User`. You should have assertions about the `User`, not the JSON response directly.

hossam.saraya.ext
2019-02-05 09:02
Yea that makes sense now. Would be great to have that in FAQ or docs somewhere.

hossam.saraya.ext
2019-02-05 09:16
Is it a good practice to have pact files commited into git repos? Trivial answer is "No" because they are generated during the consumer CI build anyways. I wast just wondering if there is any use case that supports having the pacts managed by git

karishnu
2019-02-05 09:30
Considering that a Pact Broker is used, which also manages different versions of Pact files, I do not see a use case where committing Pact files to git will help in any way

matt.fellows
2019-02-05 09:45
The main use case was to be able to easily and conveniently use the pacts to run a local stubs from. I believe we either will or already do support fetching from the broker

matt.fellows
2019-02-05 09:45
But you can also do this without committing them

hossam.saraya.ext
2019-02-05 10:08
> I believe we either will or already do support fetching from the broker I think we can already do `broker/url/pacts/` to get all pacts

ruban.mahendran
2019-02-05 10:14
has joined #general

matt.fellows
2019-02-05 10:14
Sure, but that's not as easy as passing a flag to the pact-stub-server (https://github.com/pact-foundation/pact-ruby-standalone/releases) to do it for you. But yes, it's all scriptable today, we want to package it up and make that easier

hossam.saraya.ext
2019-02-05 10:19
Does `Pact.verify()` write the pact files even if the verification fails? It's writing pacts for me which is weird as verify should only verify the interactions is being used against mock server? correct or not

bethskurrie
2019-02-05 10:32
It should not write the pact if the mock service verification fails on the consumer side.

keetron
2019-02-05 10:32
has joined #general

bethskurrie
2019-02-05 10:33
I'm not sure at what level the js api works. The pact writing might have been bundled in with the verify method.

bethskurrie
2019-02-05 10:33
Matt should know.

hossam.saraya.ext
2019-02-05 10:34
Yea I removed all `finalize` and `writePact` calls from my tests. Yet, I still have pacts generated for me using only `.verify()`

bethskurrie
2019-02-05 10:35
You'll have to have a look at the source code.

bethskurrie
2019-02-05 10:35
I'm surprised, but I don't maintain the js.

hossam.saraya.ext
2019-02-05 10:35
I did. at a glance, it looks like it doesn't do anything to write the pacts

hossam.saraya.ext
2019-02-05 10:35
``` public verify(): Promise<string> { return this.mockService.verify() .then(() => this.mockService.removeInteractions()) .catch((e: any) => { // Properly format the error /* tslint:disable: no-console */ console.error(""); console.error(clc.red("Pact verification failed!")); console.error(clc.red(e)); /* tslint:enable: */ return this.mockService.removeInteractions().then(() => { throw new Error("Pact verification failed - expected interactions did not match actual."); }) }) } ```

bethskurrie
2019-02-05 10:36
Doesn't look like it's writing to me.

hossam.saraya.ext
2019-02-05 10:36
yea me neither. I suspected that it's jest cache or something..cleared it, but still getting generated pacts O_o

hossam.saraya.ext
2019-02-05 10:36
@matt.fellows any idea?

keetron
2019-02-05 10:37
I am trying to have my pact files written someplace else than `/target/pact`, we will have a pact broker in a few weeks but want to do some POC before that and I cannot find how to do this

bethskurrie
2019-02-05 10:37
Are there automatic hooks created for your test framework?

keetron
2019-02-05 10:37
I am using Java

bethskurrie
2019-02-05 10:37
Ask in #pact-jvm

keetron
2019-02-05 10:38
oh cool, more channels :slightly_smiling_face:


hossam.saraya.ext
2019-02-05 10:39
no, just a single test file being run by `jest <file>`

hossam.saraya.ext
2019-02-05 10:39
nothing fancy

bethskurrie
2019-02-05 10:39
:man-shrugging: Tis a mystery to me.

hossam.saraya.ext
2019-02-05 10:39
You basically set that in the mock server constructor. (Speaking about the JS lib). Hopefully the java library follows the same convention

bethskurrie
2019-02-05 10:40
Nah. Probably goes though 4 levels of factory impls and xml :-P

hossam.saraya.ext
2019-02-05 10:40
Thanks god for js :smile:

hossam.saraya.ext
2019-02-05 10:42
To all my fellow java engineers/devs..stay strong

matt.fellows
2019-02-05 10:58
I'm just at my folks house, will check when I get home (soon)

matt.fellows
2019-02-05 10:58
It's also surprising to me

bethskurrie
2019-02-05 10:59
Can you make a reproducible example repository @hossam.saraya.ext?

hossam.saraya.ext
2019-02-05 11:00
yea will work on that @evening

dipeshlpatel
2019-02-05 11:20
has joined #general

matt.fellows
2019-02-05 11:24
OK had a quick peep. The workflow that causes this behaviour: - Set expectations - fail a unit test (whether or not it actually hits the correct endpoint) - ~verify()~ won?t be called, because the test framework bails In this case, because `verify()` is never called, when the mock service is shutdown, it still writes the pact.

matt.fellows
2019-02-05 11:24
When `verify()` is actually called, if this fails, the pact isn?t written

matt.fellows
2019-02-05 11:25
that being said - is it actually a problem? If your unit tests fail, then subsequent steps (e.g. publishing to a broker) should not run.

hossam.saraya.ext
2019-02-05 11:35
What if my tests pass but the verification fails?

hossam.saraya.ext
2019-02-05 11:36
So, the pacts are written anyways when the mockserver is shutdown?

jlopespereira
2019-02-05 14:09
has joined #general

hossam.saraya.ext
2019-02-05 15:35
> because `verify()` is never called, when the mock service is shutdown, it still writes the pact. So if I want to generate pacts without hitting the server. I just don't call `verify()` and that would make the server generate pacts when it's closed? :thinking_face:

japedersen
2019-02-05 19:23
Hi, is there a way to ignore a specific header param in the pact test, but still generate it into the pact/interaction file?

hossam.saraya.ext
2019-02-05 19:30
Interesting. You mean a request header right?

matt.fellows
2019-02-05 19:42
What's the reasoning behind the need for this?

matt.fellows
2019-02-05 19:43
Something like an auth token?

japedersen
2019-02-05 19:44
yes like an auth token, and in the request header.

hossam.saraya.ext
2019-02-05 19:47
but your tests already include these request headers when testing against the mock server? You just don't want to define it in the interactions? If that's the case, I don't know if it's entirely possible, but if you are worried about having sensitive data specified in the pact file, you can use `like` matchers

japedersen
2019-02-05 20:02
So, this header needs to be in the pact file. However, specifying it in the interaction test will cause a failure.

japedersen
2019-02-05 20:02
~So I'm wondering how to ignore a specific header in the test~

matt.fellows
2019-02-05 20:15
It probably ought to be in the interaction (pact file) - why shouldn't it be there? That being said, auth token are often short lived. You can inject a valid one using custom headers. Which language are you using?

matt.fellows
2019-02-05 20:15
There is a section on the docs site about this

japedersen
2019-02-05 20:20
Javascript.

japedersen
2019-02-05 20:22
So in the test if I specify the header param, then there will be a failure, and wont generate that endpoint into the pact file because it doesn't exist (even tho it does in the api swagger). If I could ignore this in the pact test, then my hope is it gets generated into the pact file.

japedersen
2019-02-05 20:23
Is there a way to work around this and just add this into the pact file?

japedersen
2019-02-05 20:24
Or does the pact manager allow to add a new header after tests run?

matt.fellows
2019-02-05 20:26
No, there is no way to add stuff into the pact after the tests run, unless you do it manually (which is almost always a bad idea)

matt.fellows
2019-02-05 20:31
I'm still confused tho. If in your consumer test you must specify an auth header as the API needs it, why does the provider API fail during verification?

matt.fellows
2019-02-05 20:32
Is it a different endpoint for auth? Or is it a token the provider needs and then passes to an auth svc?

hossam.saraya.ext
2019-02-05 21:33
> However, specifying it in the interaction test will cause a failure. Is this because you don't know the header value in compile time? so you can't hardcode that value in the interaction?

hossam.saraya.ext
2019-02-05 21:33
if I understood you right, then probably this is the reason you can't get your `pact.verify()` to pass

matt.fellows
2019-02-05 21:36
So we?re clear, when we say `pact.verify()` this is in the _consumer_ test, right?

matt.fellows
2019-02-05 21:37
Why would it fail the consumer test?

hossam.saraya.ext
2019-02-05 21:39
:man-shrugging:

hossam.saraya.ext
2019-02-05 21:39
@japedersen would be great if you provide more context

japedersen
2019-02-05 22:25
Hi, apologies. I have solved this.

japedersen
2019-02-05 22:27
I had to fix my jest mocking in all this.

japedersen
2019-02-05 22:30
Adding back the request header, lets my pact tests pass and are being added to the pact file. As desired!

japedersen
2019-02-05 22:30
Sorry for the confusion! @matt.fellows @hossam.saraya.ext

mahyar-1
2019-02-06 08:36
has joined #general

mahyar-1
2019-02-06 08:38
Hi Everyone, Is there anyway to match use path-parameters in pact? I am on jvm and using java


mahyar-1
2019-02-06 13:38
thanks will check it

vitaliy.grigoruk
2019-02-06 14:48
Hey folks, I?ve noticed that pact mockserver doesn?t save multiple providerStates (defined in spec v3) when generating a contract file. I?ve made a small PR to fix it. Coudl somebody take a look? https://github.com/pact-foundation/pact-mock_service/pull/101

dipeshlpatel
2019-02-06 21:01
Hello everyone, I am new to PACT and was wondering if someone can point out if there is any video series which i can follow or attend PACT workshop in London to gain better understanding to implement using JAVA. Referred the link below but i guess step by step docs/video that is what i need ; https://github.com/DiUS/pact-workshop-jvm

matt.fellows
2019-02-06 22:10
Thanks!

matt.fellows
2019-02-06 22:11
Hi Dipesh, there's no video that I'm aware of that gives you a step by step instruction.

matt.fellows
2019-02-06 22:11
We're considering running webinars but not for a little bit

dipeshlpatel
2019-02-07 07:36
Thanks for the reply @matt.fellows It will be great to have a guide to use PACT as I feel that it is a brilliant tool do Contract Testing instead of Integration Testing.

matt.fellows
2019-02-07 08:28
Thanks Dipesh. Have you gone through the workshop?

dipeshlpatel
2019-02-07 08:59
Not yet. I have explore that avenue too but no workshop in London at present

matt.fellows
2019-02-07 08:59
I meant, have you gone through the github workshop?

dipeshlpatel
2019-02-07 09:02
I have gone through the above pact-workshop-jvm but i am unable to find where to start This could be me being an automation test analyst

bart.schotten
2019-02-07 14:18
has joined #general

martin.hock
2019-02-07 14:24
has joined #general

vitaliy.grigoruk
2019-02-07 15:36
any chance to get this merged / released?

hossam.saraya.ext
2019-02-07 20:57
What is the difference between pact-node and pact-js?

matt.fellows
2019-02-07 21:07
Pact JS is the DSL you would use to write your contract tests in. Pact Node is essentially a NodeJS wrapper for the Pact components. In most cases, you shouldn?t have to use it directly, but it is used by Pact JS (and other related components). It?s essentially a dependency

matt.fellows
2019-02-07 21:08
You might want to use it for fine grained control over certain things, or for having a JS interface to tools like `can-i-deploy`

james.carman
2019-02-07 21:42
Would it be possible to move the logic in ?can-I-deploy? to an endpoint on the pactbroker?

matt.fellows
2019-02-07 21:43
It?s certainly possible. Why would you want it there

matt.fellows
2019-02-07 21:43
(not disagreeing, just interested in your perspective)

james.carman
2019-02-07 21:43
So that I don?t need a CLI

matt.fellows
2019-02-07 21:44
:slightly_smiling_face:

james.carman
2019-02-07 21:44
I can easily script web calls into my Jenkins workflows

james.carman
2019-02-07 21:44
I really wasn?t trying to be a smart ass :)

matt.fellows
2019-02-07 21:45
haha I think the bulk of the logic is there anyway

james.carman
2019-02-07 21:45
Sometimes it?s just natural

matt.fellows
2019-02-07 21:45
The CLI probably just orchestrates it. ?The matrix? is what contains the magic

james.carman
2019-02-07 21:45
You get what I mean though, right?

matt.fellows
2019-02-07 21:45
yep

matt.fellows
2019-02-07 21:45
@bethskurrie will be able to tell you more

james.carman
2019-02-07 21:45
Can we move the orchestration behind an endpoint?

james.carman
2019-02-07 21:46
Even if it?s async?

bethskurrie
2019-02-07 21:46
It is.

james.carman
2019-02-07 21:46
All of it?

bethskurrie
2019-02-07 21:47
No, it depends on what your arguments are.

james.carman
2019-02-07 21:47
That?s what I mean

bethskurrie
2019-02-07 21:47
It could be more abstracted.

james.carman
2019-02-07 21:47
Can we move that logic server-side?

bethskurrie
2019-02-07 21:47
Yes

james.carman
2019-02-07 21:48
It does some blocking, right?

bethskurrie
2019-02-07 21:48
The wait?

james.carman
2019-02-07 21:48
Some wait period or something

james.carman
2019-02-07 21:48
Yeah

bethskurrie
2019-02-07 21:48
I wouldn't want to move that into the endpoint

james.carman
2019-02-07 21:48
Right

james.carman
2019-02-07 21:48
Agreed

bethskurrie
2019-02-07 21:48
Not a good use of server cycles.

james.carman
2019-02-07 21:48
Nope

james.carman
2019-02-07 21:48
What is it waiting for?

james.carman
2019-02-07 21:49
Does it trigger notifications for jobs to run?

bethskurrie
2019-02-07 21:49
A result to come back

bethskurrie
2019-02-07 21:49
No


james.carman
2019-02-07 21:50
Ok it?s polling

james.carman
2019-02-07 21:51
Hoping something changes (a job runs) to change a verification result

james.carman
2019-02-07 21:51
Makes sense

james.carman
2019-02-07 21:51
Is that all the logic it?s doing, then?

james.carman
2019-02-07 21:52
The polling?

james.carman
2019-02-07 21:53
If not, can we move whatever else it?s doing server-side?

james.carman
2019-02-07 21:53
And the server just always responds immediately with yes/no?

james.carman
2019-02-07 21:54
And maybe the data that backs up that claim

james.carman
2019-02-07 21:54
Like all the verifications that passed

james.carman
2019-02-07 21:55
I don?t mind helping with a PR (my ruby is dusty). I just wanna make sure it?s not against the vision before I crack open some code

james.carman
2019-02-07 21:57
@bethskurrie did I lose you?

bethskurrie
2019-02-07 21:57
I'm in a tunnel

james.carman
2019-02-07 21:57
I hope you are not driving

james.carman
2019-02-07 21:59
No problem, just let me know. I don?t mind helping out. We are benefiting quite a bit from all the great work you folks have done!

bethskurrie
2019-02-07 21:59
In on a train to work

james.carman
2019-02-07 22:00
:train:

bethskurrie
2019-02-07 22:00
There is a little bit of logic in the cli code, but it's mostly working out what arguments to send to the matrix

bethskurrie
2019-02-07 22:00
Any waiting code would need to be put into your http client.

james.carman
2019-02-07 22:00
Yep

james.carman
2019-02-07 22:00
Agreed

james.carman
2019-02-07 22:01
Provide back the immediate response from the data currently present



james.carman
2019-02-07 22:03
Love the emoticon in the message


james.carman
2019-02-07 22:42
I know the answer involves tags or labels or whatever they?re called, but does anyone have an example of how they?ve managed that stuff in a CD type environment?

james.carman
2019-02-07 22:44
Like, if I want to verify a new version of my provider against all pacts that are currently tagged as ?prod? to make sure it?s safe to push out my updates?

james.carman
2019-02-07 22:45
Can we push tags onto existing, versioned pacts?

bethskurrie
2019-02-07 22:45
yes

bethskurrie
2019-02-07 22:46
that's kind of the point


james.carman
2019-02-07 22:46
And I suppose we?d have to remove the previously tagged prod version

bethskurrie
2019-02-07 22:46
no

james.carman
2019-02-07 22:46
Yeah, I?ve read it

bethskurrie
2019-02-07 22:46
You specify "the latest version tagged prod"

james.carman
2019-02-07 22:46
It?s been a while

bethskurrie
2019-02-07 22:46
it means you don't have to remove previous tags.

james.carman
2019-02-07 22:47
Latest is temporal, not version-based?

bethskurrie
2019-02-07 22:47
technically, it's the latest version with that tag

bethskurrie
2019-02-07 22:47
where the ordering is the order the version was published

james.carman
2019-02-07 22:47
Hmmm

james.carman
2019-02-07 22:48
If I deployed version 1, then 2

james.carman
2019-02-07 22:48
Then I had to rollback because we found an issue

james.carman
2019-02-07 22:48
I redeploy 1

james.carman
2019-02-07 22:48
And re-tag

james.carman
2019-02-07 22:48
Who would be considered ?latest??

james.carman
2019-02-07 22:49
I?m guessing 2, since the pact was published after 1?

james.carman
2019-02-07 22:49
That?s probably unlikely

james.carman
2019-02-07 22:50
But in that case, could we ?untag? 2 as prod?

bethskurrie
2019-02-07 22:51
yes

james.carman
2019-02-07 22:51
Cool

james.carman
2019-02-07 22:52
Most likely, we?d just fix 2 and deploy 2.0.1 or something

bethskurrie
2019-02-07 22:52
Btw, lets move this to a thread in #pact-broker so we're not spamming everyone

james.carman
2019-02-07 22:53
Oh sorry

mboudreau
2019-02-07 23:16
yes, please thread your convo :slightly_smiling_face:

vitaliy.grigoruk
2019-02-08 09:46
@bethskurrie looks like you are maintaining this repo. Could you please take a look at this PR? it is just 2 lines of code

matt.fellows
2019-02-08 09:58
There might have been a reason why it wasn't supported the first time, if it was so easy. I recall discussing it around when we were doing the message pacts

hossam.saraya.ext
2019-02-08 10:30
~http://blog.pact.io/tag/can-i-deploy~ ~Why is this blog post trimmed off? :smile:~ Apparently because I am viewing the tags not the post itself :blush:

bethskurrie
2019-02-08 10:40
I'll have a better look tomorrow, as it's late here now. I don't think v3 writing is actually supported at all from memory. I think it just supports reading v3 pacts. The rule writing format is different for v3 also.

vitaliy.grigoruk
2019-02-08 11:22
oh, well. Didn?t think about rule writing format in v3? :disappointed:

vitaliy.grigoruk
2019-02-08 11:23
I guess I have to specify provider states in 1 string then?

biercoff
2019-02-08 16:23
has joined #general

biercoff
2019-02-08 16:25
Hi guys. Small question. I have a provider that provides a big json payload. And i also have bunch of consumers - each of them is interested in part of this payload. Does every consumer has to specify full provider payload in the contract, or they can specify only structure they are interested ?

james.carman
2019-02-08 16:29
typically a consumer should only deal with the data they?re interested in


biercoff
2019-02-08 16:31
where i find this

biercoff
2019-02-08 16:31
the documentation here http://docs.pact.io/documentation/gotchas.html it says - "Be conservative in what you send - when the mock server in the consumer project compares the actual request with the expected request, the actual request body is not allowed to contain fields that are not defined in the expected request body. We don't want the situation where our real consumer is "leaking" data that we don't know about."

biercoff
2019-02-08 16:31
and i get confused :slightly_smiling_face:

james.carman
2019-02-08 16:55
I got 404

james.carman
2019-02-08 16:55
on the ?gotchas? link

james.carman
2019-02-08 16:56
There?s a huge difference in how you should treat the request vs. the response here.

james.carman
2019-02-08 16:56
As a consumer, you shouldn?t care that the service sends more data than you need

james.carman
2019-02-08 16:56
restated, you shouldn?t care that the response contains more data than you need

biercoff
2019-02-08 17:31
got it thanks

matt.fellows
2019-02-09 02:02
Yep. Optional elements are a separate but related thing. There is an article on http://docs.pact.io about it discussing it in more deptg. In your case, different consumers just need different bits of the payload And they should write pact tests that only include those bits.

matt.fellows
2019-02-09 02:02
I should say it's very common to do what you're asking, if it helps

petro.turovskyy
2019-02-09 18:41
has joined #general

petro.turovskyy
2019-02-09 18:46
Hey guys! I would really appreciate your input on this one: https://github.com/DiUS/pact-jvm/issues/849

ruban72
2019-02-09 19:39
has joined #general

arvindr3
2019-02-11 08:53
has joined #general

javid.ali
2019-02-11 11:21
has joined #general

arvindr3
2019-02-11 11:27
Hi,

arvindr3
2019-02-11 11:28
i m getting the issue while i m running the Pact Workshop - js

arvindr3
2019-02-11 11:29
Error: Error from response: undefined at request.get.query.then.err (D:\Pact\pact-workshop-js-master\consumer\client.js:33:15) at process._tickCallback (internal/process/next_tick.js:68:7)

javid.ali
2019-02-11 11:33
Hi non-techie here, had a quick look at docs but couldn't gather, does Pact interactions use the real API and database of the app or is this mocked out? Sorry for dumb question. Thanks.

matt.fellows
2019-02-11 12:19
Hi Arvind, please ask in the #pact-js channel, and provide all of the details as to what you?re doing, what steps you?ve attempted to resolve them and the results of those attempts.

matt.fellows
2019-02-11 12:20
From the point of view of the _consumer_, the _provider_ is completed mocked out in the test, and the recordings with that mock (it?s still a real API endpoint) become the contract (simplified). When testing the _provider_, Pact assumes the role of the consumer, and sends actual HTTP requests to the real provider - if it needs a DB you may choose to use it or mock it out.

matt.fellows
2019-02-11 12:20
That help?

james.carman
2019-02-11 12:23
I always mock it.

james.carman
2019-02-11 12:23
:)

gopinathlangote11
2019-02-11 12:24
.

gopinathlangote11
2019-02-11 12:24
.

gopinathlangote11
2019-02-11 12:25
sorry mistake

javid.ali
2019-02-11 13:34
Thanks @matt.fellows that makes sense :slightly_smiling_face:

sneha.puskoor
2019-02-11 20:04
has joined #general

brian
2019-02-11 23:10
has joined #general

pilit63
2019-02-12 07:57
has joined #general

pilit63
2019-02-12 07:58
Hi guys! New on the channel

pilit63
2019-02-12 08:04
Im creating a pact verification platform and I found a problem managing versions and where to publish result. The use case is this: in a provider test, I want to publish or not the results of my verification depending on the version of the consumers. These versions can be snapshots or finals, so I want to select only snapshots to be published (the verifications) to work in merge requests. Currently Im using the property "pact.verifier.publishResults" but I need to select whether I publish a verfication of a contract or not dynamically reading consumer version. Is there any option to do this? As PactRunner uses InteractionRunner, I cannot extend it easily..

hossam.saraya.ext
2019-02-12 14:29
How can we match two request with the same METHOD & URL. The difference between requests is that one has 1 more json field than the other

vitaliy.grigoruk
2019-02-12 14:32
there should be different state probably, and different description in this case

hossam.saraya.ext
2019-02-12 14:35
is it ok to have both interactions with request.body set to `Pact.like({...})`

hossam.saraya.ext
2019-02-12 14:35
does that make the matcher match against body type only and disregard the body content?

hossam.saraya.ext
2019-02-12 14:37
in other words.. IS: ``` body: like({ name: 'str' }) ``` equivalent to ``` body: { name: like('str') } ``` ?

jonas.lmk
2019-02-12 14:43
has joined #general

mtissot79
2019-02-13 07:51
has joined #general

sam
2019-02-13 16:10
has joined #general

sam
2019-02-13 16:43
Looking for some advice regarding where to put the consumer pact. We have some webservices, where the webservice team provides its own client library (java). For example, a team provides both application "foo-ws" and "foo-ws-client" library. A different team creates an application "bar" that makes uses of "foo-ws-client" to get data from "foo-ws". Does the consumer pact belong in "foo-ws-client" or "bar"? Should the pact make use of foo-ws-client, or should bar create it's own client to talk to foo-ws?

james.carman
2019-02-13 16:45
I would vote ?bar?.

james.carman
2019-02-13 16:46
because your pact would only specify the data that ?bar? is interested in

james.carman
2019-02-13 16:46
For example, the response type coming from foo-ws-client might have 10 fields in it

james.carman
2019-02-13 16:46
but, bar only cares about 3 of them

james.carman
2019-02-13 16:46
it shouldn?t bother with the other 7 when specifying its pact

james.carman
2019-02-13 16:47
it?ll still use foo-ws-client to talk to foo-ws, but it only does stuff with those 3 fields

sam
2019-02-13 16:50
that makes sense. but if foo-ws makes a breaking changing that breaks foo-ws-client, "bar" would break instead of foo-ws-client

sam
2019-02-13 16:51
that's ok? it's really the client that's broken

james.carman
2019-02-13 16:55
well, if *anything* breaks, that means folks need to start talking :slightly_smiling_face:

james.carman
2019-02-13 16:56
foo-ws is hopefully downloading all pacts declared against it and verifying them as they make changes

james.carman
2019-02-13 16:57
regardless of what client library they use to talk to foo-ws. All clients don?t get the luxury of auto-upgrading to the latest and greatest foo-ws-client

james.carman
2019-02-13 16:57
we have the exact same situation here at work

james.carman
2019-02-13 16:57
we use JAX-RS, though

james.carman
2019-02-13 16:57
so, one team will publish an API jar that has JAX-RS-annotated interfaces in it

james.carman
2019-02-13 16:58
everybody that wants to use it will create a type-safe client proxy object that implements the jaxrs interface from the API jar

sam
2019-02-13 17:03
very good points! thanks for your help

sam
2019-02-13 17:11
That's an interesting way of publishing an API! We use JAX-RS for our webservice implementation too, but I'm curious about the setup you just mentioned. Is there a blog post or something that goes over that particular strategy?

james.carman
2019-02-13 17:15
The trick is separating your JAX-RS annotated stuff out into its own jar

james.carman
2019-02-13 17:15
lemme see if I have an example?


james.carman
2019-02-13 17:16
That?s an example of the pattern

james.carman
2019-02-13 17:16
from my ?jaxxy? library

james.carman
2019-02-13 17:20
we are using CXF to generate the client proxies

james.carman
2019-02-13 17:20
The ?microprofile? API has a new feature that makes this standardized

sam
2019-02-13 17:22
cool, thanks for the info

james.carman
2019-02-13 17:22
you?re welcome

bilgehanl.03
2019-02-14 13:21
has joined #general

igwe.kalu
2019-02-14 15:32
has joined #general

igwe.kalu
2019-02-14 15:38
Hi everyone

igwe.kalu
2019-02-14 15:40
I'm new in this community and I came armed with a question :crossed_swords: :slightly_smiling_face: With reference to this Github issue: https://github.com/pact-foundation/pact-js/issues/268 > Contract testing is about making sure your consumer team and provider team have a shared understanding of what the requests and responses will be in each possible _*scenario*_. > ~ https://docs.pact.io/best_practices/consumer#use-pact-for-contract-testing-not-functional-testing-of-the-provider - How could one possibly test a resource update contract without being sure there's an existing record to update? - In other words, how may the contract regarding a hypothetic product update scenario be tested?

james.carman
2019-02-14 16:25
@igwe.kalu contract testing isn?t functional testing

james.carman
2019-02-14 16:26
just make sure you?re not trying to verify that the service is, behind the scenes, doing the right thing with your data

james.carman
2019-02-14 16:26
with the contract test, you should only really be concerned with the ?shapes? of the responses.

james.carman
2019-02-14 16:26
There can be a bit of a gray area around error scenarios

pkuang
2019-02-14 16:38
has joined #general

jwatanabe
2019-02-14 18:38
has joined #general

igwe.kalu
2019-02-14 18:44
@james.carman thanks for the reminder. Be rest assured that I already have those factors in strict consideration. However, my questions remain open. And I?d very much appreciate an actual answer from any person experienced in the concept

james.carman
2019-02-14 18:45
you?re welcome (I think, although that sounded terribly dismissive)

james.carman
2019-02-14 18:47
@igwe.kalu what exactly are you trying to test and what have you tried so far?

james.carman
2019-02-14 18:48
?functions as expected? sounds a bit ?functional testy?

james.carman
2019-02-14 18:48
and not ?contract testy?

james.carman
2019-02-14 18:53
Perhaps what you?re trying to do is establish some known ?state??


matt.fellows
2019-02-14 23:45
@igwe.kalu > - How could one possibly test a resource update contract without being sure there?s an existing record to update? You?re right, you can?t. But the way you test this in Pact is separated into different pieces 1. The consumer test _does not create the state in advance_ by, for example, first creating the resource. It simply is a test that specifies its expectations - including the state: ?_given_ that resource X exists? (this is the ?state?) then ?when I call `GET` on `/resource/id`? I should get back some response. 2. It is important here that this test is performed in isolation from any other, stateful tests to avoid the functional nature of the test 3. When the provider verifies this piece of code, it is passed the state before the test. In the case above, the state is ?_given_ that resource X exists?. It is the responsibility of the provider to ensure it is in this state before the tests runs. This usually takes the form of seeding/clearing a database The net result is that the consumer tests are clean, simple to understand, and not dependent on the stateful ordering of things, yet the provider can still test interactions that traditionally depended on those things.

matt.fellows
2019-02-14 23:46
Theoretically, if you could spin up multiple provider code bases, you could perform the contract tests _in parallel_. Typically this isn?t needed because they are usually quite fast anyway owing to the fact that you usually stub out any of its dependencies, repeating this pattern all the way down the dependency tree

cocoa
2019-02-15 06:52
has joined #general

cocoa
2019-02-15 06:59
Incidentially, I have a question regarding provider states and this last post. if I have a test for GET on /resources/id and have a provider state "resource X exists" I see two options regarding the "id" part. The id in the request obviously has to match the id of the provider state. 1. predefine a fixed id (e.g. 42) that all "consumers" using that provider state must know and use (requires out of band documentation)

cocoa
2019-02-15 07:00
2. templateable provider state, e.g. "resource X with id {id} exists", which does not exist (as far as I see)

cocoa
2019-02-15 07:01
3. include id in provider state, i.e. "resource X with id 42 exists"

cocoa
2019-02-15 07:01
letting the consumer define ids at will seems crazy :slightly_smiling_face:

cocoa
2019-02-15 07:02
and as a side question: what are the params in pact jvm on the ProviderState meant for? I don't see it being used by the interaction runners at all

cocoa
2019-02-15 07:03
and another related question: what is the best way to avoid provider state explosion in regard to "options" on a resource

cocoa
2019-02-15 07:03
e.g. if I have a resource X that can optionally have option A and B

cocoa
2019-02-15 07:04
I don't want to define provider states for all combinations (without A and without B, with A and without B, ...)

cocoa
2019-02-15 07:05
use three provider states? "resource X exists" + "has option A" + "has option B"?

cocoa
2019-02-15 07:05
this requires a strict ordering of provider state

cocoa
2019-02-15 07:06
"has option A" cannot be done after "resource X exists" because "has option A" requires the existence of "option A"

stein
2019-02-15 08:06
"It is the responsibility of the provider to ensure it is in this state before the tests runs. This usually takes the form of seeding/clearing a database" This is quite an interesting topic and I would be interested to see how different folks manage the provider setup. I have always ran a version of the provider with the entire service/domain layer mocked out - which ensures we aren't testing any behaviour or business logic. I feel having a real database goes too far, but I'd be interested in hearing arguments for it - maybe easier setup. I've taken the mocking approach in both golang and java projects.

james.carman
2019-02-15 12:03
Running your verification using mocks makes this much simpler

james.carman
2019-02-15 12:05
We have state methods that allow you to pass in data to establish state. We don?t store data in a database or anything, but simply train the mocks using the desired state

james.carman
2019-02-15 12:05
The tests are very fast and it?s easy to isolate everything

james.carman
2019-02-15 12:09
@sam the client proxy stuff is being standardized by the microprofile client API: https://github.com/eclipse/microprofile-rest-client

james.carman
2019-02-15 12:10
CXF implements this

matt.fellows
2019-02-15 12:17
You'd still need to know that the state exists, but the ids at least could be made to be dynamic with, say, a callback/hook in the provider tests to fetch known "parameters" for the interaction. @uglyog thoughts?

matt.fellows
2019-02-15 12:17
We are also looking at ways to visualise these available states in the pact broker

matt.fellows
2019-02-15 12:17
To ease with new clients getting started

robin
2019-02-15 13:56
has joined #general

daniel.hegner
2019-02-15 14:36
has joined #general

tom.mortiboy
2019-02-18 05:49
has joined #general

tom.mortiboy
2019-02-18 05:55
Hello all! Just been looking at the hosted pact broker at https://pact.dius.com.au. If you use this service, are contracts and documentation public, or is there auth to keep pacts private?

abubics
2019-02-18 06:07
There is currently basic auth (in the free version), and no anonymous option

abubics
2019-02-18 06:07
Also, hello! Welcome :smile:

tom.mortiboy
2019-02-18 06:07
thanks!

bethskurrie
2019-02-18 06:20
We are at this very moment working on social login.

bethskurrie
2019-02-18 06:21
And API tokens.

ben.smith
2019-02-18 08:07
has joined #general

matt.fellows
2019-02-18 08:50
Ah back travelling again I see Tom. Snow good in Japan? :grinning:

matt.fellows
2019-02-18 08:51
Just so we're clear, acct is private - no one else can see your contracts etc.

rabih
2019-02-18 13:00
Hello, is there a way to hide password from the generated testing debugging log?

matt.fellows
2019-02-18 19:59
what password are you referring to? which language are you using?

vitaliy.grigoruk
2019-02-19 09:37
Hey @bethskurrie @matt.fellows. Considering that V2 doesn?t support multiple provider states (and V3 contract writing is not yet implemented), what would be your suggestion for specifying multiple provider states for pact interactions? In order to run provider verification in our app, we need to set up multiple entities in a DB (e.g. `user with name=TestUser exists`, `company with id=1 exists`, `Survey round for user with id=1 is open`). Defining this state as 1 string is not optimal and will lead to a lot of code duplication on provider?s side (in a state setup code). As a workaround, I?m thinking about encoding JSON object with states into a string using `JSON.stringify` and then decoding it from string to a JSON object via `JSON.parse` on provider verification side. What do you think about such idea?

bethskurrie
2019-02-19 09:38
What languages are you working in?

bethskurrie
2019-02-19 09:38
Pact Ruby actually supports verifying in v3, just not writing in v3.

bethskurrie
2019-02-19 09:39
Hence, pact go, js, net also support verifying in v3.

bethskurrie
2019-02-19 09:39
Not all features are supported yet, but the multiple states and params are supported

bethskurrie
2019-02-19 09:40
It calls the provider state endpoint once for each state.

bethskurrie
2019-02-19 09:42
What is your consumer written in?

vitaliy.grigoruk
2019-02-19 09:43
JS

vitaliy.grigoruk
2019-02-19 09:43
on both sides

bethskurrie
2019-02-19 09:44
Do you really need to specify all 3 things?

bethskurrie
2019-02-19 09:44
I tend to just specify the most important object in the request. In your case, the survey round I would think.

vitaliy.grigoruk
2019-02-19 09:45
well, there a lot of interactions in a contract and some of them depend on different combinations of states

bethskurrie
2019-02-19 09:45
Does this change the way the responses look?

vitaliy.grigoruk
2019-02-19 09:45
yes

vitaliy.grigoruk
2019-02-19 09:46
the endpoints we?re covering with a contract are quite flexible in terms of output (based on query params and provider states)

bethskurrie
2019-02-19 09:47
We really need to support v3. Matt and I are just a bit maxed out at the moment with the commercial pact broker work.

bethskurrie
2019-02-19 09:48
You can try putting all the provider state info in a json string. It'll be yucky, but if it gets you through until we can support it properly, we'll and good

vitaliy.grigoruk
2019-02-19 09:49
Thanks! I?ll be happy to contribute to both Ruby & JS codebases, if some help is needed.

bethskurrie
2019-02-19 09:50
I'd love help.

bethskurrie
2019-02-19 09:50
There's going to be a lot of little things scattered throughout the Ruby library though, it's not straight forward unfortunately.

bethskurrie
2019-02-19 09:52
I'll see if I can find some things that are easy to explain.

ola.jankowska
2019-02-19 09:57
hi I need some help, I have frontend in Angular that is publishing tests to broker and backend in java that is running tests against production environment, the only thing we are missing is adding Authorisation (Bearer Token) header to all requests, we have test user for that, how can we inject this header (end before that get the token because it is valid very short time ) I am using pact-jvm-provider-maven_2.12

matt.fellows
2019-02-19 10:07
look for ?request filters? - that?s probably what you need

matt.fellows
2019-02-19 10:07
But testing against prod?. probably not a great idea

vitaliy.grigoruk
2019-02-19 10:08
:+1:

ola.jankowska
2019-02-19 10:11
why not? we want to be sure we will not brake any contracts when releasing new version

ola.jankowska
2019-02-19 10:12
thanks I found request filters! that is what i Need now I just need to log in :smile:

matt.fellows
2019-02-19 10:13
:slightly_smiling_face:

matt.fellows
2019-02-19 10:13
So, the contract really should be something owned by the provider team and done at build time. Not all contracts will be able to be performed this way - say creating an order or something

matt.fellows
2019-02-19 10:14
Best to have it automated in CI, and have the provider team own the outcome

matt.fellows
2019-02-19 10:14
if it works for you, sure, but the approach will have limits

ola.jankowska
2019-02-19 10:33
I see you can filter tests per environment so we can always split test for P and T


matt.fellows
2019-02-19 10:35
which password though? a password in a test, or for a broker?

bethskurrie
2019-02-19 19:56
@ola.jankowska the recommended way to test contracts is to do it before deploying to production. You can read about it here: https://docs.pact.io/best_practices/pact_nirvana

bethskurrie
2019-02-19 19:57
Testing against a live deployed app rather than against one running in CI can make it slower and more difficult to set up and tear down provider states, and to stub downstream services.

bethskurrie
2019-02-19 19:58
The contract tests would typically be run in the CI pipeline of the provider.

bockus
2019-02-20 02:46
has joined #general

rickard.andersson
2019-02-20 07:01
has joined #general

vitaliy.grigoruk
2019-02-20 08:36
Interesting? Just discovered that I can pass a JSON object to `state` in provider interaction definition and then it is gonna be saved as JSON in a contract json file and then pact verifier reads it and passes a JSON object to /pactStateSetupUrl. So, no need to encode state into a string?

matt.fellows
2019-02-20 09:32
oh wow, magic! (I don?t really like magic, especially if that magic may have been written by me)

matt.fellows
2019-02-20 09:33
I?ll take a look later, hopefully that?s something that?s repeatable across languages and not a ?quirk? for JS only

hossam.saraya.ext
2019-02-20 09:41
Also wanted to add that testing in general against production servers is a bad idea because you don't want to add test data or delete existing data into/from your production data stores if you are not mocking/stubbing

mail
2019-02-20 11:03
has joined #general

oswald.quek
2019-02-20 12:17
:wave: is there a way to tell the pact broker to ignore certain consumers when using the can_i_deploy script (https://github.com/pact-foundation/pact_broker-client/blob/4a27c00e09f4512d539dedbc5c26518e29b8dde5/lib/pact_broker/client/can_i_deploy.rb)?

martin.green
2019-02-21 07:30
Hello, first of all, I love the concept of Pact and CDC?s. Well done! I?m really interested in hearing about peoples implementation of Pact into their company. Most documentation seems to be on tutorials, which is great. But I can?t seem to find much on people?s experiences with using Pact. What are the pain points? How long did it take to implement etc. Much appreciate any info

matt.fellows
2019-02-21 07:45
I'm a maintainer so I'm biased. I'll let the crowd answer and pop in later

vitaliy.grigoruk
2019-02-21 10:19
Hi @martin.green I?m currently implementing Pact in a company I?m working for (at the moment, we have 1 provider and a bunch of consumers). Integrating pact mockserver on the consumer side was quite easy and straightforward. Enabling pact contract verification on provider side took much more time for me, as we need to set up states on our provider side for each request + some of our provider endpoints require auth. While I was implementing provider verification, it turned that I had to refactor all interaction definitions on a consumer side (fix states, make sure that dynamic data is not hardcoded and relevant matchers are used).

lukas.mrtvy
2019-02-21 12:19
has joined #general

lukas.mrtvy
2019-02-21 12:20
Does Pact provide healthcheck or metrics endpoint for Prometheus?

vitaliy.grigoruk
2019-02-21 12:35
I think you need to ask this in #pact-broker @lukas.mrtvy

ramkhi
2019-02-21 14:51
has joined #general

martin.green
2019-02-21 15:08
Thanks very much for the reply @vitaliy.grigoruk

simon.nizov
2019-02-21 16:19
@martin.green What language are your services written in?

martin.green
2019-02-21 16:41
Hey @simon.nizov, the consumers are written in js and the backends are Scala

simon.nizov
2019-02-21 16:43
No tips from me then :)

oswald.quek
2019-02-21 16:44
hello. looking at https://github.com/DiUS/pact-jvm#supported-jdk-and-specification-versions, i take it pact doesn't support java 11 at the moment?

oswald.quek
2019-02-21 16:59
hi @martin.green some pain points i've found are: - the pact consumer js doesn't have the ability to set parameterised states for use with a pact java provider, for e.g. in https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-junit#provider-state-callback-methods `someProviderState(Map<String, Object> providerStateParameters)` - circular dependencies, for example changing a consumer pact without requiring a change of code on the provider side. we documented this in more detail at https://gdstechnology.blog.gov.uk/2019/01/29/lessons-learnt-using-contract-testing-in-gov-uk-pay/ - recently we had an issue where 1) there was a master build of a [provider] project built 2) someone came along and added a brand new consumer service that had a contract with said provider service on a pull request branch. this published the new pact to the pact broker 3) when the provider project was to be deployed to our staging environment, it failed because the "can-i-deploy" (https://github.com/pact-foundation/pact_broker-client/blob/4a27c00e09f4512d539dedbc5c26518e29b8dde5/lib/pact_broker/client/can_i_deploy.rb) check - which is a dynamic check on the pact broker - returned some `incompatible pacts` message as all of a sudden the pact broker had knowledge of this new consumer service so was expecting the new consumer service pact to be in the staging environment, but there was none. at this moment in time we can't get the "can-i-deploy" to ignore certain services. so be very careful when adding new services to the pact broker. - it's generally a bit more painful when updating pacts between services because we always use the "can-i-deploy" function before deploying a service so developers often have to think about the deploy cadence (i.e. what code changes on what services to deploy first)

oswald.quek
2019-02-21 16:59
but all in all the pain is worth it, otherwise we wouldn't be doing it :wink:

yousafn
2019-02-21 18:43
I have written up my first blog post about how we are utilising swagger & pact in our dev flow. Feel free to have a read https://you54f.wordpress.com

matt.fellows
2019-02-21 19:45
Great feedback! FWIW we?ll be addressing the workflow issues soon, I hope. This should make all but the first if not disappear, much easier to deal with

uglyog
2019-02-21 20:51
That is correct. Although some people have indicated they have used some of the libraries with Java 9+, you may have some issues that you?ll have to work around.

mike.key
2019-02-21 22:13
has joined #general

anmalik
2019-02-22 02:42
has joined #general

fil.calcutt
2019-02-22 07:59
has joined #general

martin.green
2019-02-22 09:10
Hey @simon.nizov I'd still be interested to hear any tips or experiences you've had. Regardless of the languages used. :slightly_smiling_face:

oswald.quek
2019-02-22 09:15
awesome!

oswald.quek
2019-02-22 09:22
:+1: we're actually going to try upgrading from Java 8 -> 11 and skip everything in between! will see how we get on.

vitaliy.grigoruk
2019-02-22 09:48
Hi @oswald.quek I?m also using JS on consumer side and to address item #1 from your list I?m just setting `state` field as a JSON array (following the format from pact spec v3: `[{ name: 'statename', params: { foo: 'bar', bar: 'buzz' }}]` which is then also stored as json array in a contract file. But, on a side of provider, I?m also using JS and a custom http endpoint for /pactStateSetupUrl. The payload I get to /pactStateSetupUrl is the same JSON array, I?ve provided in `state` during interaction definition on a provider side?

simon.nizov
2019-02-22 10:24
@martin.green I only just started honestly. A couple of months ago I presented Pact to the dev teams in our company and got a positive response. Since then I've been sort of forcing them to write any new unit tests of our api client classes using pact instead of VCR. This accumulated into a decent amount of interactions spread over 2 pacts between 3 services. Actually our front end team should have been the 3rd pact but they had some troubles integrating pact-js into their react+redux codebase (though they gave up after less than an hour due to more pressing issues). This week I finally published the pacts to our self hosted Pact Broker. The next step is to create an endpoint on each provider to setup the provider state.

wnek.piotr
2019-02-22 11:20
has joined #general

wnek.piotr
2019-02-22 11:25
Hello

wnek.piotr
2019-02-22 11:25
Is there a way to secure somehow pact-broker?

wnek.piotr
2019-02-22 11:26
I wonder, if I can to secure it using LDAP users

supraja.kr
2019-02-22 12:33
has joined #general

vitaliy.grigoruk
2019-02-22 13:16
here is where the fun part starts, @simon.nizov :slightly_smiling_face:

vitaliy.grigoruk
2019-02-22 14:08
Hi everybody. I?m looking for a way to get better test reports on a provider verification side. Currently, https://github.com/pact-foundation/pact-provider-verifier supports only a patched rspec formatter (default option), json and RspecJunitFormatter. We?re using default formatter and when 1 interaction out of 50 fails the output contains all the interactions, which is not very convenient. I?d like to have an option to see only failed interactions. Any suggestions?

m.r.green
2019-02-22 23:31
has joined #general


soap6gal
2019-02-24 11:53
has joined #general

m.r.green
2019-02-25 08:57
Really interesting to see your pipeline @oswald.quek. I assumed git branches would allow us to navigate around the circular dependency issues you mention, perhaps naively.

matt.fellows
2019-02-25 09:01
As a brief aside, whilst you can't _ignore_ certain consumers, you can do the opposite - list the ones you care about

matt.fellows
2019-02-25 09:01
Soon we'll have the ability to ignore the verification result if a new consumer (whilst still verifying it, providing feedback to the consumer). This should make things less disruptive to the provider team

m.r.green
2019-02-25 09:01
@matt.fellows any clue as to the work flow solutions you mention above? I?m doing a presentation to my company about Pact so be great hear any new features

matt.fellows
2019-02-25 09:03
I'll dig up the draft blog article that was to be published, that should give you an indication of what's to come

pravera
2019-02-25 14:31
hi! in our team we?re looking forward to implement pact nirvana


pravera
2019-02-25 14:32
very interesting btw!

pravera
2019-02-25 14:34
In our consumer build, we will need to check if it?s compatible with the production version of our provider. So the question is: as we do with the head versions, do we need to trigger a provider (production) build if the pact changes? So we can pact:verify and fill the matrix row for that Consumer-Provider?

kajan.siva
2019-02-25 14:49
has joined #general

nigel.hannam
2019-02-25 17:17
Hi all. In the pact spec 3 (https://github.com/pact-foundation/pact-specification/tree/version-3), the concept of generators was introduced. The spec document states: ?In some cases, dates and times may need to be relative to the current date and time?, but as far as I can tell, the Date related generators always use today rather than allowing for example today+1 . We have a provider endpoint that must be given a date in the future (i.e. AFTER today), and the generator concept seemed like a suitable way to handle it. Am I missing something in the generators, or is there some other recommended way to handle dates relative to today?

mboudreau
2019-02-25 22:58
Currently, the consumer is the one dictating the contract, hence you wouldn't be able to test your production provider on your consumer locally. We aim to change this behavior in pact to make it a lot more collaborative so that both sides should be testable at all times

mboudreau
2019-02-25 22:59
In your data, how is the date transferred as? a ISO8601 string? a unix timestamp?

abubics
2019-02-26 01:15
> do we need to trigger a provider (production) build if the pact changes? Not a build, but a verify (especially for consumer changes). And there's a webhook to trigger such verify CI processes :slightly_smiling_face:

uglyog
2019-02-26 05:56
The idea was to allow different types of generators, but only ones that generate dates based on the current clock have been implemented. It should not be hard to implement what you need.

nboyd
2019-02-26 09:32
has joined #general

nigel.hannam
2019-02-26 09:39
dates are indeed ISO8601 strings. The other approaches we have considered (but don?t particularly like) are: 1) Using a date that?s a long way in the future 2) Using a TargetRequestFilter on the provider side to override the date in the pact 3) Using a provider state to configure a fixed clock on the provider side (effectively overriding what date is ?today?

nigel.hannam
2019-02-26 09:40
Is it possible for us to add our own generators, or do they need to be provided as part of the pact libraries?

damien.castelltort
2019-02-26 16:36
has joined #general

franckxcode
2019-02-26 16:39
has joined #general

smridula2845
2019-02-26 19:37
has joined #general

smridula2845
2019-02-26 19:52
Hi .. I am a newcomer to the contract testing world and I am noticing an issue with my consumer test run. All my matching rules are ignored and the test fails by trying to match the exact value. Details Posted in the thread.

smridula2845
2019-02-26 19:53
```WARN: Ignoring unsupported matching rules {"$.entitlements"=>{"matchers"=>[{"match"=>"type", "min"=>2}], "combine"=>"AND"}, "$.entitlements[*].entitlementStartDate"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.entitlements[*].entitlementEndDate"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.entitlements[*].parentFeatureId"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.entitlements[*].featureId"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.entitlements[*].featureName"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.entitlements[*].featureType"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.entitlements[*].entitlementType"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.entitlements[*].userType"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.entitlements[*].meteringType"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.entitlements[*].active"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.entitlements[*].source"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.entitlements[*].orderOrigin"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}} for path ['body']```

smridula2845
2019-02-26 19:53
Json in pact file

smridula2845
2019-02-26 19:53
```"body": { "entitlements": [ { "entitlementEndDate": "string", "meteringType": "string", "parentFeatureId": "string", "featureName": "string", "featureType": "string", "orderOrigin": "string", "active": true, "userType": "string", "source": "string", "entitlementType": "string", "featureId": "string", "entitlementStartDate": "string" }```

smridula2845
2019-02-26 19:56
npm error log

smridula2845
2019-02-26 19:56
```4 verbose stack Error: e2e@1.0.0 test:provider: `mocha test/provider.spec.js` 14 verbose stack Exit status 1 14 verbose stack at EventEmitter.<anonymous> (/Users/sasikum/.nvm/versions/node/v6.10.3/lib/node_modules/npm/lib/utils/lifecycle.js:255:16) 14 verbose stack at emitTwo (events.js:106:13) 14 verbose stack at EventEmitter.emit (events.js:191:7) 14 verbose stack at ChildProcess.<anonymous> (/Users/sasikum/.nvm/versions/node/v6.10.3/lib/node_modules/npm/lib/utils/spawn.js:40:14) 14 verbose stack at emitTwo (events.js:106:13) 14 verbose stack at ChildProcess.emit (events.js:191:7) 14 verbose stack at maybeClose (internal/child_process.js:886:16) 14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 15 verbose pkgid e2e@1.0.0 16 verbose cwd /Users/ssss/Automation/contract-tests 17 error Darwin 17.7.0 18 error argv "/Users/sss/.nvm/versions/node/v6.10.3/bin/node" "/Users/sss/.nvm/versions/node/v6.10.3/bin/npm" "run" "test:provider" 19 error node v6.10.3 20 error npm v3.10.10 21 error code ELIFECYCLE 22 error e2e@1.0.0 test:provider: `mocha test/provider.spec.js` 22 error Exit status 1 23 error Failed at the e2e@1.0.0 test:provider script 'mocha test/provider.spec.js'. 23 error Make sure you have the latest version of node.js and npm installed. 23 error If you do, this is most likely a problem with the e2e package, 23 error not with npm itself. 23 error Tell the author that this fails on your system: 23 error mocha test/provider.spec.js 23 error You can get information on how to open an issue for this project with: 23 error npm bugs e2e 23 error Or if that isn't available, you can get their info via: 23 error npm owner ls e2e 23 error There is likely additional logging output above. 24 verbose exit [ 1, true ] ```

sthan
2019-02-26 20:23
Hi. I am also new to contract testing and trying to create a POC for our http://ASP.NET WebApi application. I've been following the code example in your PactNet repo. I've been able to create working Consumer tests, but I'm having a bit of trouble creating the Provider test. We have a Global.asax.cs which starts the Provider application like this: public class WebApiApplication : System.Web.HttpApplication { protected void Application_Start() { Common.NetworkingHelper.ConfigHttpTlsLevel(); DependencyConfig.Configure(GlobalConfiguration.Configuration); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalConfiguration.Configuration.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); GlobalConfiguration.Configuration.Formatters.Add(new System.Net.Http.Formatting.XmlMediaTypeFormatter()); } } But the example code in PactNet uses OWIN Hosting to start the application. I'm not sure how to reconcide the difference. Can you provide some helpful documentation that will help. An example code would also be very useful.

uglyog
2019-02-26 22:28
It was designed to allow generators to be looked up, but the only implementation at the moment uses a hard coded package. This just needs to be extended so you can supply your own. Which implementation are you using?

matt.fellows
2019-02-26 23:47
Thanks @smridula2845, could you please share your code? That will probably help us understand why the matching rules aren?t working

matt.fellows
2019-02-26 23:48
hiya! Might be best asking in the .NET channel. This looks more of support about .NET than Pact itself, but I?m not sure as I?m not familiar with that language

sthan
2019-02-26 23:53
Thanks. didn't realize there was a separate channel.


matt.fellows
2019-02-27 00:01
Js doesn?t support v3 of the pact specification (assume you?re using Pact JVM as the consumer?)

matt.fellows
2019-02-27 00:02
So it doesn?t support the `combine` matchers

mboudreau
2019-02-27 00:03
did you create the JSON by hand?

smridula2845
2019-02-27 00:14
no i didnt create the Json by hand. I wrote consumer side code

smridula2845
2019-02-27 00:15
```@Pact(provider = "lemService",consumer = "portal") public RequestResponsePact createPact(PactDslWithProvider builder) { PactDslJsonBody body = (PactDslJsonBody) new PactDslJsonBody() .minArrayLike("entitlements",2) //.object() // Throws exception .stringType("entitlementStartDate") .stringType("entitlementEndDate") .stringType("parentFeatureId") .stringType("featureId") .stringType("featureName") .stringType("featureType") .stringType("entitlementType") .stringType("userType") .stringType("meteringType") .booleanType("active") .stringType("source") .stringType("orderOrigin") .closeObject() //.closeObject() .closeArray(); return builder .given("valid oxygenId ") .uponReceiving("get entitlement call") .path("/service/lem/v2/admin/aaaaa/entitlements") .method("GET") .matchQuery("includeRelationships", "true") .matchQuery("source","pelican,legacy") .matchQuery("guid","201606300402219") .willRespondWith() .status(200) .body(body) .toPact(); } ````

smridula2845
2019-02-27 00:15
this is the gist of the code i had to create the pact

smridula2845
2019-02-27 00:16
is there an example of JVM V2 pact specification i can use ?

mboudreau
2019-02-27 00:17
isn't your consumer javascript? Why is the DSL written in java?

smridula2845
2019-02-27 00:22
our consumer is java based not JS

smridula2845
2019-02-27 00:24
should we move the provider tests also to Java ?

smridula2845
2019-02-27 00:25
what is the recommendation

matt.fellows
2019-02-27 00:27
is the provider written in java or JS? If it?s written in JS that?s totall yfine

matt.fellows
2019-02-27 00:27
so you have a Java consumer and a JS provider?

matt.fellows
2019-02-27 00:28
You are fine to use the Java DSL for your java consumer, but you need to ensure that Pact JVM is serialising the pacts in v2 specification

smridula2845
2019-02-27 00:28
yes ..

smridula2845
2019-02-27 00:28
How do i serialise to v2 ?


matt.fellows
2019-02-27 00:29
You?ll need to use the 2.4.x version of Pact

smridula2845
2019-02-27 00:30
Thank you. I will change the version and get back .

smridula2845
2019-02-27 00:30
Thank you for spending time !

nigel.hannam
2019-02-27 12:13
Currently using a mixture of pact-js and pact-jvm for consumer side, and pact-jvm (spring) for provider side. If this were to be extended so that we could provide our own generators, would both the consumer and provider side need an implementation? It would add overhead if it needed to be implemented for all types of consumer, and it kinda seems like the consumer side only needs to allow the generator to be specified without necessarily needing to use an implementation of it

sgleadow
2019-02-27 21:47
I saw Pact mentioned in a Nordic APIs article this morning :slightly_smiling_face:, for websockets no less, I haven't tried it in that scenario https://nordicapis.com/functional-contract-testing-a-case-study/

matt.fellows
2019-02-27 22:43
It?s awesome to see this sort of blog, but if I?m honest, I?m not sure the message conveyed in it is very clear. Perhaps it?s a non-native English speaker/writer, but a lot of it didn?t make sense to me, so I?m sure it woudn?t make sense to others. I need to watch the video, i?m guessing the article is a summary of the video which perhaps hasn?t done a great job of distilling the key points.

bethskurrie
2019-02-27 22:44
@oswald.quek I've just been working on the "can't 'deploy the provider because the consumer isn't deployed to the environment' circular issue.

bethskurrie
2019-02-27 22:44
It should be fixed soon.

brendon.flanagan
2019-02-27 23:01
has joined #general

uglyog
2019-02-27 23:15
Pact-js only supports spec V2. Generators are V3. Generators can be applied to both the request and response. If you only care about applying them to the response, then what you have said is correct.

uglyog
2019-02-27 23:16
I'll have some time this weekend, I'll look to add the expression to them in pact-jvm

shekharsp27
2019-02-28 06:26
As per my understanding, the concept of PACT has been used to implement contract testing using 'Erlang'. And there is no use of PACT to implement contract testing. Please correct me if I am missing something here.

matt.fellows
2019-02-28 06:31
you may well be right

matt.fellows
2019-02-28 06:32
Perhaps that?s why it didn?t make sense to me, but I suspect otherwise

brendon.flanagan
2019-02-28 07:20
Hi there, does anyone who knows what Datapower is (IBM gateway devices), if you?ve successfully implemented a solution using Pact ? I?d be interested to know as I?m in the process of understanding pact now and from what I can tell thus far is that it?s currently not possible. Even though datapower runs nodejs under the covers, it?s not the complete implementation and you just can?t go installing node modules onto it and issue node commands. I think I might have a way to achieve this using datapower still but interested to know if anyone else has struck this.

punarjit.singh
2019-02-28 08:38
has joined #general

mboudreau
2019-02-28 09:07
Instead of using the node package, you could always just use the base Ruby binaries instead for all your pact testing

nigel.hannam
2019-02-28 09:10
:+1:

nigel.hannam
2019-02-28 09:11
Do we know if/when pact-js is likely to support V3?

matt.fellows
2019-02-28 10:51
I know of datapower (came across it working at Bank)

matt.fellows
2019-02-28 10:52
are you looking at it from a consumer/provider perspective?

matt.fellows
2019-02-28 10:53
As Michel said, even if you can?t run the unit tests integraated into Datapower, you can still write both consumer and provider tests and execute it remotely (via a ruby CLI toolo)

oswald.quek
2019-02-28 13:34
nice. let me know when there's a new version of the pact broker!

uglyog
2019-02-28 21:09
Depends on when someone implements it, probably in ruby. There is no plan that I?m aware of

me1
2019-02-28 22:50
has joined #general

punarjit.singh
2019-03-01 03:07
Hi there... how are we supposed to pass request parameters in Pact Verifier ? are there any opts or do we need to use requestFilters... ?

bethskurrie
2019-03-01 03:09
Hi @punarjit.singh. Welcome to the pact slack group. Please ask your question in the channel for the relevant language.

punarjit.singh
2019-03-01 03:09
Hi @bethskurrie sure... will join the channels .. thanks

brendon.flanagan
2019-03-01 06:12
Looking at it from a consumer perspective first. Didn?t know about ruby cli toolo so will look into that.


matt.fellows
2019-03-01 06:25
That?s a very crude summary of what the wrapper libraries do

brendon.flanagan
2019-03-01 06:37
Not quite sure how datapower fits in here just yet. The train of thought I am having was a client tool that kicks off the tests under a pact control, the actual client request message goes to the datapower service, that service does xyz and sends to the provider endpoint which would be back to the pact client tool, which will validate against the pact file pulled from the pact broker (local to start off with) send back the pact response all the way back though the datapower service, thus confirming the success or failure against the pact. Note still yet to fully understand what pact does, but I think I?m close. This also means nothing extra has to be deployed with the service on datapower. As we already alias out our endpoints so in a lab environment, the endpoint would be to pact thing and not a real provider which typically doesn?t exist in a lab setup.


matt.fellows
2019-03-01 07:00
TL;DR You only want to test 2 layers at a time in a contract test.

lextiz
2019-03-01 09:15
has joined #general

kristoffer.bakkejord
2019-03-01 13:40
has joined #general

pltran875
2019-03-01 18:28
has joined #general

thirumal.net
2019-03-01 19:14
Hi All, we did poc on pact and it is going to work well in our system but unfortunately my dev teams are not ready to adopt it due to project dead lines ..etc so i am wondering is there any way i can do contract testing with out touching production code base. i know it defeats the purpose of pact if we are not writing unit test cases in production code but i am wondering is there any tool/approach i can use to get the same flavour of contract testing. i am from QA team and did poc on pact and understood the value of it . i would like to use the power of pact broker but dont have access to write unit test cases in production so searching for alternatives which will follow similar pact steps Thanks in advance

matt.fellows
2019-03-01 19:59
Is this for the consumer side, provider side or both?

thirumal.net
2019-03-01 22:39
Hi @matt.fellows - Thank you for looking into query, actually it is for both . i am still pushing hard to implement pact at least from one side(consumer or provider) to show the value of it , but not sure whether i will succeed or not . please guide me if there is any alternative if we implement one side(consumer or provider) vs not implementing both sides

mboudreau
2019-03-02 00:37
It's easy to start on the consumer side as the consumer often already needs a mock of some kind for testing, pact gives the added benefit of generating contracts based on those mocks which can be used to test the producer, but really soonest have to straight away

mboudreau
2019-03-02 00:38
On the producer side, you can do the same thing by creating a contract by hand or with a tool to test what's expected front the consumer

saiarunlak
2019-03-02 13:52
has joined #general

uglyog
2019-03-03 02:41
I've updated to Pact-JVM generators to be loaded from a configured package, so you should be able to add your own. I did not get enough time to add the expressions yet.

ngrigoriev
2019-03-03 20:16
has joined #general

sven
2019-03-03 22:28
has joined #general

nigel.hannam
2019-03-04 09:48
Thanks for looking at this. Unfortunately, without support for the generators in pact-js we can?t use them for our biggest consumer, so we will probably have to stick with one of existing workrounds for now

oswald.quek
2019-03-04 11:18
@uglyog is getting pact to work with Java 11 on your radar for the future? i guess with Java 8 and 9 not being supported many teams will be looking to upgrade

thirumal.net
2019-03-04 18:45
@mboudreau - Thank you for your response. how can i start from consumer side ,you mean to say create the json file(Contract ) from pact libraries or create json file(contract ) from any third party tools ? my scenario is i have swagger/API Blurprint , wondering how can i create contract file out of it so that i can publish the file to pact broker

bhoyt
2019-03-04 18:48
has joined #general


yousafn
2019-03-04 21:16
You don?t need your actual consumer to exist to create a consumer test. You look at your swagger api, define a test ( what you expect to receive which might not be everything the response returns), register this interaction in your mock pact provider. Create the test in your unit test language of choice and run it. It creates a pact contract which you can publish to the broker

yousafn
2019-03-04 21:17
You can then use the tool suggested above to validate the pact contract is valid when compared to the swagger spec

yousafn
2019-03-04 21:19
I am using it to prove the case you are talking about, my provider still isn?t ready 5 months on. I wrote a blog post about it recently using swagger and pact https://you54f.wordpress.com/2019/02/19/protecting-your-api-development-workflows-with-swagger-openapi-pact-io/

thirumal.net
2019-03-04 21:39
@yousafn - Thank you very much for your help on this scenario . i will go through your blog and let you know if i have any questions. Thank you again for your help

yousafn
2019-03-04 23:36
Btw you can?t create pact contracts from a swagger api specification. It lists the operations a service can provide but doesn?t convey the expectations of a consumer, and you can?t infer those automatically. You can still use it as a testing tool even if you aren?t using as part of your development flow, but it offers many dev flow benefits. If only one side implements it, it can still protect you, to can run it against each new release of your dependencies or dependants, and see if the contract still holds water, if not sound the alarm bells. The pact broker still works well in that instance. I will implement the providers tests in my pipeline list against their developed service, the provider for me doesn?t really need to do anything, as long as I have agreed some test cases that have some defined data I can use.

yousafn
2019-03-04 23:37
But api development is much better with collaboration so get them all to feel the pact :heart:

thirumal.net
2019-03-04 23:46
@yousafn - Thank you, Yes, we can't create pact files from swagger specification . initially i was under impression that there might be tool available to convert swagger to pact contract but i don't think we can do that right now. between i like the idea of running one unit test project in isolated environment and generate pact file from expected request/expected response from consumer side . only thing missing here is we are not syncing with production code base and depending on some documentation

mboudreau
2019-03-05 00:02
@thirumal.net you wouldn't want to do that anyways since it would make pact useless if all it does is imitate swagger definitions since it doesn't actually precisely show the interactions between the consumer and the provider

mboudreau
2019-03-05 00:02
however, I feel like there's an opportunity to make it a bit easier to generate the pact contracts from a swagger definition file

brendon.flanagan
2019-03-05 09:51
Been doing some more reading and I'm pretty confident I think I know how I can make this work with Datapower involved to ensure the datapower service is doing what is expected where transformation is invovled, or is not altering what is expected where the service is a proxy. But theres one thing I don't fully understand. So as I understand, the consumer is the one that generates the pact file, which obviously can be shared with the provider, nominally via a pact broker. This is thus the contract. Meaning the provider is free to do what they want with their code, so long as it still passes against the published contract. Now what I don't understand is, if the consumer makes a change to their app, thus a new pact file is generated, with part of that change being what is expected by the provider, means, that once published to the broker, will break the provider. Meaning the consumer has now gone and dictated that the provider has to change ? So to me, the consumer controls the contract outright. Whereas I originally had thought that the consumer would also pull the pact file from the broker to validate against, just like the provider would. Does that sound right ? have I missed something (this being based on what I've read several times over where consumer generates and publishes a pact file to a broker, and where the provider pulls from the broker to validate against) ?

mboudreau
2019-03-05 10:09
That's correct, but only if the provider is testing on the latest contract all the time. The way we recommend you do it is that you tag your contacts based on the environment or the feature your working on, which is then tested based on the tag on the provider side

mboudreau
2019-03-05 10:11
For instance, you should test to make sure whatever you're changing to your provider needs to pass the "production" contract (what's currently deployed), but if you're working on a new feature and the contract is already created from the consumer but hasn't been deployed yet, you can test it based on the same tag

mboudreau
2019-03-05 10:11
Does that make sense?

khaled.hamlaoui
2019-03-05 12:22
has joined #general

thirumal.net
2019-03-05 21:47
@mboudreau -Thank you for your reply but i am still wondering how it is possible to generate pact file from swagger definition so that i can push the same pact file(json) to pact broker ? my assumption is , we can generate pact file from test project with the help of pact library so that it exactly looks like pact flow except calling real production code base . if there is already tool avilable to convert swagger file to pact file then i think no need to create test project to generate pact file . is my assumption correct ? Thank you in advance


matt.fellows
2019-03-05 22:22
this can?t be done

matt.fellows
2019-03-05 22:23
But we are exploring how we integrate swagger into the broker. If that?s of interest to you perhaps we can talk about that

yousafn
2019-03-06 01:13
That sounds like a great idea, as they compliment each other well. My 2p :) I think if you can allow the upload of a swagger api definition registered as a provider, each client that register that they use that api definition. On publish of a swagger file, you can run ?swagger-cli validate? to ensure the swagger is valid. On publish of a client pact contract, it can evaluated against the swagger spec with swagger-mock-validator On new publish of a swagger definition, it could be checked against existing contracts, and mark consumer versions as compatible, or provide a matrix of compatible consumer versions.

matt.fellows
2019-03-06 03:08
Your two cents are? very compatible with our thinking :smile:

asad
2019-03-06 12:23
has joined #general

steve.perkins
2019-03-06 15:46
has joined #general

krzysztof.stepniak
2019-03-07 10:30
has joined #general

stefan.deussen
2019-03-07 12:04
has joined #general

stefan.deussen
2019-03-07 12:22
Hello everybody! I was wondering what the best strategy for writing the tests on the provider side is. Currently we are mocking on the service layer. This makes the tests very robust and easy to write. One the other hand there is no guarantee, that the real implementation is returning the same response as the mock implementation. So what would you recommend? Mocking as much as possible to get small and robust tests or mocking as little as possible to have more confidence on the tests?

keetron
2019-03-07 12:31
mock as much as possible, you are testing the API, not the service behavior

aidamanna
2019-03-07 14:36
has joined #general

phil.a.herbert
2019-03-07 15:57
has joined #general

timepasstimepass1234
2019-03-08 12:33
has joined #general

timepasstimepass1234
2019-03-08 12:45
I am new to Java and to PACT I am getting an error while writing the provider test for an API 0) return BIOS Details returns a response which has a matching body comparison -> Expected a response type of 'application/json' but the actual type was 'text/plain' Verifying a pact between BiosProOnLoad_consumer and BiosProOnLoad_provider Given BIOS OnLoad return BIOS Details MockHttpServletRequest: HTTP Method = GET Request URI = /rest/v1/biospro/onload/component/1234 Parameters = {} Headers = {cid=[2], Accept=[application/json], } Body = <no character encoding set> Session Attrs = {} Async: Async started = true Async result = <200 OK,{"BIOS_Settings": "BIOS_Settings","duration" : 3},{}> Resolved Exception: Type = null ModelAndView: View name = null View = null Model = null FlashMap: Attributes = null MockHttpServletResponse: Status = 200 Error message = null Headers = {} Content type = null Body = Forwarded URL = null Redirected URL = null Cookies = [] [DEBUG] [main 08 Mar 2019 15:53:50] (IndyInterface.java:selectMethod:232) Received response: 200 [DEBUG] [main 08 Mar 2019 15:53:50] (IndyInterface.java:selectMethod:232) Response: [statusCode:200, headers:[:], contentType:application/json; charset=UTF-8, data:] returns a response which has status code 200 (OK) has a matching body (FAILED) Failures: 0) return BIOS Details returns a response which has a matching body comparison -> Expected a response type of 'application/json' but the actual type was 'text/plain'

timepasstimepass1234
2019-03-08 12:48
Can someone help me understand why this may be happening? I have sent the response headers for pact as application/json but it does not show up in pact file..Is that the problem?

timepasstimepass1234
2019-03-08 12:49
Or is it because the response body is null?

hamzahuk
2019-03-09 10:34
has joined #general

timepasstimepass1234
2019-03-10 19:55
My controller call is returning result in DeferredResult format. MockMvcTarget returns the result without waiting for async process. How to async option to pact through PactDslWithProvider builder in java?

matt.fellows
2019-03-10 21:29
The error message is pretty clear there, it was expecting json but didn't get it. Perhaps you could come share more of your code. The headers map looks empty too

matt.fellows
2019-03-10 21:29
Might want to ask in the #pact-jvm channel

thomas.koppensteiner
2019-03-11 14:57
has joined #general

luca.ippolito
2019-03-12 08:27
has joined #general

luca.ippolito
2019-03-12 08:50
Hi there! I've got a question regarding the execution order of provider states, couldn't find anything elsewhere about this. So, let's assume in a contract are the following states configured for a testcase: "providerStates": [ { "name": "service has student", "params": { "id": 1, "firstName": "John", "lastName": "Doe" } }, { "name": "student has grade", "params": { "subject": "Mathematics", "grade": "A" } } ] The expected result by the consumer for this testcase would be "student": { "id": 2, "firstName": "John", "lastName": "Doe", "grades": [ { "subject": "Mathematics", "grade": "A" } ] } When executing this testcase as a provider, I noticed that the execution order of the provider states is reversed, so instead of executing the provider states in this order on the provider side: 1. service has student 2. student has grade The states are getting executed like this: 1. student has grade 2. service has student Can anyone explain me, why the execution order is inverted? Because of that, on the provider side we are implementing something like a "reverse builder pattern" to setup the object that needs to be returned. What would be a better approach on this? I know, a possible answer would be "just use one provider state instead", but I would like to allow multiple consumers to use the same states and they should be able to create their own expected result value, so my key requirement is the usage of multiple paramterized states. Another possible solution would be to tell the consumer that he should invert the order of the provider states on his side, but that does not make that much sense to me. I think, it is more logical to set the provider states like this: .given("service has student", studentParameters).given("student has grade", gradeParameters) instead of setting the states up like this: .given("student has grade", gradeParameters).given("service has student", studentParameters) Thanks in advance for your feedback!

bethskurrie
2019-03-12 09:02
Hi Luca. You'll need to ask in the channel for your language

bethskurrie
2019-03-12 09:03
I would have expected them to be called in the other they were defined.

bethskurrie
2019-03-12 09:03
Petty sure the Ruby impl does, so I'm guessing you have a jvm implementation.

ghandour.jihad
2019-03-12 09:30
has joined #general

mestrez.matthieu
2019-03-12 09:42
has joined #general

luca.ippolito
2019-03-12 09:51
Hi Beth, thanks for your response. I'm using java, so #pact-jvm would be correct than?

matt.fellows
2019-03-12 10:10
yep

matt.fellows
2019-03-12 10:10
Is it always returning it that way, or just often? Might be implement as an unordered type under the hood

bethskurrie
2019-03-12 10:27
That would surprise me.

matt.fellows
2019-03-12 10:36
Indeed, I?m probably going into bug finding mode here

luca.ippolito
2019-03-12 11:56
It looks consistent to me, as far as i can tell. An interaction with the following provider states configured: "providerStates": [ { "name": "stateOrderExample", "params": { "order": "1" } }, { "name": "stateOrderExample", "params": { "order": "2" } }, { "name": "stateOrderExample", "params": { "order": "3" } }, { "name": "stateOrderExample", "params": { "order": "4" } }, { "name": "stateOrderExample", "params": { "order": "5" } } ] While the corresponding method in the provider implementation looks like this: @State("stateOrderExample") public void stateOrderExample(final Map<String, Object> params) { log.debug((String) params.get("order")); } Returns this consistently: 2019-03-12 12:52:57.450 DEBUG traceId= spanId= parentSpanId= reqId= clientId= [c.s.b.d.s.p.ProviderTest] (main) 5 2019-03-12 12:52:57.450 DEBUG traceId= spanId= parentSpanId= reqId= clientId= [c.s.b.d.s.p.ProviderTest] (main) 4 2019-03-12 12:52:57.450 DEBUG traceId= spanId= parentSpanId= reqId= clientId= [c.s.b.d.s.p.ProviderTest] (main) 3 2019-03-12 12:52:57.450 DEBUG traceId= spanId= parentSpanId= reqId= clientId= [c.s.b.d.s.p.ProviderTest] (main) 2 2019-03-12 12:52:57.450 DEBUG traceId= spanId= parentSpanId= reqId= clientId= [c.s.b.d.s.p.ProviderTest] (main) 1 I am using the following dependencies by the way: <dependency> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-provider-junit_2.12</artifactId> <version>3.6.2</version> <scope>test</scope> </dependency> <dependency> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-provider-spring_2.12</artifactId> <version>3.6.2</version> <scope>test</scope> </dependency> <dependency> <groupId>com.swisscom.cdc.pact</groupId> <artifactId>pact-jvm-provider-junit-spring-boot</artifactId> <version>3.6.0-rc.0.0</version> <scope>test</scope> </dependency>

aditya_pradeepkumar
2019-03-12 15:25
has joined #general

lauren.borodajko
2019-03-12 15:41
has joined #general

timepasstimepass1234
2019-03-12 19:20
Hi Matt Thanks for your reply.. My controller looks something like this DeferredResult<ResponseEntity<?>> deferredResult = new DeferredResult<>(deferredResultTimeout); CompletableFuture.supplyAsync(() -> { try { return new ResponseEntity<String>(<some function call>), HttpStatus.OK); } catch (Exception exception) { return restResponseException.parse(exception);} }) .whenCompleteAsync((result, throwable) -> deferredResult.setResult(result)); return deferredResult; This Async call is what is failing the provider test for me... When I remove the async call and make the function call directly in controller Provider test will pass If you look at the response the body we are expecting is in asyncResult at the top..Is there a way to tell provider to assert/verify on asyncResult and not body OR bring the asyncResult into body

arian.maykon
2019-03-13 03:41
has joined #general

msc.consults
2019-03-13 09:31
Hi, I've been looking at writing a contract test that asserts a response when the provider service is unavailable. It ran on the provider side and failed as the service was in-fact up and running. Thinking about this, it doesn't feel like a valid test, as... when the service is unavailable, a `HTTP STATUS 503` is returned, therefore why would I need a contract test for this? I'm deciding to remove this test, however what were your thoughts on this?

matt.fellows
2019-03-13 09:34
I typically don't test 503s, because by definition they tend to be hard to produce in an actively deployed mode

matt.fellows
2019-03-13 09:34
I'm also keen to hear others thoughts

msc.consults
2019-03-13 10:05
I also have another thought *(up for debate)* if a consumer is planning to add restrictions to their service to ensure (let say a bad `POST` request cannot be made to the provider), is there still any value in a contract test being in place that exercises an invalid schema scenario?

abubics
2019-03-13 10:16
You really want to test the intended interactions that your API client exposes, that get marshalled/unmarshalled from/to domain entities. That's the highest value stuff. If you have other expected failures (e.g. re-deleting the same ID accidentally), they're lower value, but worth testing if you have had some real bugs that you want not to regress. Things like 503s may make sense for another kind of testing, not so much contact testing :)

abubics
2019-03-13 10:17
To your question, if you have an API client that doesn't let you send the wrong thing, then I wouldn't worry about forcing unhappy path tests.

oswald.quek
2019-03-13 10:28
hello, am needing some help on the pact broker! some slightly pressing questions. i posted in #pact-broker but didn't get a response. It's a bit of a bottleneck in our deployment pipeline as I think there is too much data in its database. I'm seeing the database used by the pact broker hitting 100% frequently. 1) i'm not sure how to tell which version of the pact broker I have - is there a way to do this? 2) will upgrading to version 2.18.0 help? i see from https://github.com/pact-foundation/pact_broker/blob/master/CHANGELOG.md#v2180-2018-04-05 there is a feature to "add rake task to clean unused data to improve performance". that said v2.18.0 was released 2018/04/05 and that's approximately when the pact broker became a thing in our pipeline 3) is there an endpoint on the pact broker to delete old data?

oswald.quek
2019-03-13 10:34
@bethskurrie?

mboudreau
2019-03-13 11:03
if the pact broker DB is hitting 100%, there must be an issue with that DB. Is it out of storage? Memory? I mean, unless it's getting hit constantly by the broker, I don't see how this is possible

mboudreau
2019-03-13 11:03
and if it is being hit constantly, then are you getting DDoS'ed?

oswald.quek
2019-03-13 11:13
yes i guess we can upgrade the CPU. but we upgraded it just last week and i want to make sure it isn't anything to do with exponential pact verifications between services

oswald.quek
2019-03-13 11:13
no we aren't getting DDoS'ed

oswald.quek
2019-03-13 11:17
it's preferable to delete data. it's inconceivable we are going to have to deploy months-old versions of our services - we don't need those verifications anymore

msc.consults
2019-03-13 11:19
thanks @matt.fellows @abubics for both of your inputs

davidjgmendes
2019-03-13 11:38
has joined #general

mboudreau
2019-03-13 12:00
I mean, it could be. I haven't played around enough with the broker to know what it's doing behind the scene, just trying to think about it from the DB perspective

mboudreau
2019-03-13 12:01
I mean, if you were to go into the admin for the DB, it would become clear easily enough as to why it's hitting 100%

ghandour.jihad
2019-03-13 12:35
Hello Everyone :slightly_smiling_face: I am new to the PACT world and trying to explore it, looking great sofar :slightly_smiling_face:. I am trying to have a pact that expects as a return "body": [ { "firstName": "Emma", "familyName": "Smith" }, { "firstName": "Marc", "familyName": "Johnson" } ] The provider does return this body, but at times Marc would be before Emma. How can I for java ignore the order? https://docs.pact.io/getting_started/matching is Ruby DSL, and can't find the java version. Any help is very appreciated.

alisdaircole
2019-03-13 16:29
has joined #general

yousafn
2019-03-13 16:59
surely the ordering isn?t important if it can change request by request? In that case shouldn?t you just be checking that you get an array of objects with two key/value pairs, of which the value is a string? I assume if the ordering is important (ie you need it alphabetical order) you either get the provider to ensure that the endpoint is deterministic or your consumer takes the response and sorts it before doing something with it

pkuang
2019-03-13 19:41
Hi, does the pact verifier not automatically uncompress responses from the provider if it includes a 'content-encoding: gzip' header?

yousafn
2019-03-13 19:54
Here is our broker at work, there are 4 consumers and 2 providers, over a 30 minute period. it is very similar across a 3 month range.

yousafn
2019-03-13 19:55
It is a postgres instance exclusively for the pact-broker. Is your DB only for the broker?

bethskurrie
2019-03-13 20:45
@oswald.quek I would advise upgrading as there were some major improvements done to optimise the matrix queries.

bethskurrie
2019-03-13 20:45
It may well be responsible for the high usage you're seeing.

bethskurrie
2019-03-13 20:47
There is a clean task, but it is not currently working. The main problem when I was writing it is, knowing which data is safe to clean is dependent on how each company uses their broker (eg tags, verifications etc)

bethskurrie
2019-03-13 20:49
@oswald.quek you can see which version of the broker you have by looking at the response headers - there is an X-Pact-Broker-Version header.

abubics
2019-03-13 21:36
Pact isn't so much for checking specific content, but more for verifying content shape. If there's a material significance to the order, I'd suggest making that more apparent on the interface, or asserting it in unit tests on the provider side :) To ensure the content shape (in a Pact idiomatic way), use `eachLike` :ok_hand:

abubics
2019-03-13 21:37
Also, if you have JVM-specific questions, you can take them to #pact-jvm for better help ^^

mboudreau
2019-03-13 22:20
that's a good question...

matt.fellows
2019-03-13 22:42
I recall this coming up in a discussion somewhere on github (perhaps the pact specification repository) or pact js


ghandour.jihad
2019-03-14 08:37
thanks a lot guys!!!

ghandour.jihad
2019-03-14 11:03
I will continue this thread here, then any other jvm question will send it on the other channel :slightly_smiling_face: I tried to use eachLike, but it looks like it works only for children of a specific parent with name. My object: { "firstName": "Emma", "familyName": "Smith" } Is not the child of anything, so any use of eachLike(name , ...) will result in adding a parent to the object :confused: .willRespondWith() .body(new PactDslJsonBody() .eachLike(2) .stringType("firstName", "Emma") .stringType("familyName", "Smith") it didn't work, and when I use .eachLike("Any name",2) which is a supported form, I will have Any name the parent of my object :confused:

oswald.quek
2019-03-14 13:58
cool thanks. yeah our version is quite recent - 2.27.6. we've managed to resolve our issues by deleting data older than a certain date in the database.

pkuang
2019-03-14 14:47
Thanks, I saw the issue but was hoping support had been implemented since then but I guess not. I can understand the reasoning behind it though.

matt.fellows
2019-03-14 20:47
:+1:

abubics
2019-03-14 23:37
are you using Java or Kotlin? this DSL is very hard for me to read :stuck_out_tongue: I have examples of nicer object blocking with Kotlin in #pact-jvm


abubics
2019-03-14 23:42
Aside from that, I'm not familiar with any `eachLike` or `minArrayLIke` that lets you specify multiple entities with different content.

abubics
2019-03-14 23:43
So, back to my original point, it's not really for verifying content. What is the interaction you're trying to test?

abubics
2019-03-14 23:44
maybe you want `minArrayLike` :slightly_smiling_face:

abubics
2019-03-14 23:44
it's listed with `eachLike` in the docs here: https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-consumer

priyasilverback
2019-03-15 00:47
has joined #general

vitaliy.grigoruk
2019-03-15 08:11
Hi everybody. What is the biggest argument against using pact for browser acceptance tests of a frontend application (in order to replace a real API server with pact mockserver)?

bethskurrie
2019-03-15 08:21
Maintainability of the provider verifications.


vitaliy.grigoruk
2019-03-15 08:34
thanks! But we still need to have some kind of mocking of our API when we run browser tests for our front-ends. Any suggestions?

bethskurrie
2019-03-15 08:36
You can use the pact file to start up a mock server locally.

bethskurrie
2019-03-15 08:36
Stub server rather

bethskurrie
2019-03-15 08:36
It's a pretty dumb stub though.

vitaliy.grigoruk
2019-03-15 08:37
ok, but in this case I need to make sure that my contract still contains all the interactions that I need for my tests to run.

bethskurrie
2019-03-15 08:37
Yes.

bethskurrie
2019-03-15 08:37
It's not ideal.

vitaliy.grigoruk
2019-03-15 08:38
so, it is basically the same as using pact mockserver when running browser test for the frontend, except that I don?t need to explicitly define pact interactions in test cases.

bethskurrie
2019-03-15 08:38
Yes.

vitaliy.grigoruk
2019-03-15 08:38
thanks for your answers!

bethskurrie
2019-03-15 08:39
It helps control the number of interactions, because you'll see more clearly if you start adding duplicate pact unit tests.

bethskurrie
2019-03-15 08:40
It's a bit easier to get carried away with a bajillion slightly different combinations if you're defining your interactions for your UI tests directly.

oswald.quek
2019-03-15 09:45
if anyone's interested, we've had the pact broker for nearly a year now and there were 10 million rows in the view `matrix`

oswald.quek
2019-03-15 09:45
we deleted 7 million rows

bethskurrie
2019-03-15 09:46
Impressive! No wonder your database was struggling!

sergiy
2019-03-15 10:48
has joined #general

james.carman
2019-03-15 10:52
Our fronted developers are using cypress for mocking/stubbing out backend services I believe.

vitaliy.grigoruk
2019-03-15 10:53
well, cypress is not a tool we want to use.

james.carman
2019-03-15 10:54
Fair enough.

james.carman
2019-03-15 10:57
I definitely wouldn?t consider pact to be the right choice for functionality testing browser JS code. You certainly would want to have a pact test.

james.carman
2019-03-15 10:58
There has to be a better stubbing tool, though. I?m not a JS guy, so I don?t know the landscape well, though.

bethskurrie
2019-03-15 10:59
Yeah, I'm in the same boat.

james.carman
2019-03-15 11:01
Cypress is what I?ve heard our folks talk about, but it?s JS, so there have to be a bajillion options.

sergiy
2019-03-15 11:38
:wave: hi all, just a :heavy_plus_sign: to cypress, we've also started to use it in combination with PACT in our project. `@pact-foundation/pact-web` and `@pact-foundation/pact-node` good written JS libraries. For mocking on consumer side, even without cypress, use - `@pact-foundation/pact-node` or for non-Node environments - `@pact-foundation/pact-web`. You can read more here - https://github.com/pact-foundation/pact-js#consumer-side-testing

adb
2019-03-15 12:19
has joined #general

adb
2019-03-15 12:42
Hello ladies and gentlemen. I'm trying to run consumer unit test against pact-mock-service docker image in .NET. So I started container and tried to run consumer tests from https://github.com/tdshipley/pact-workshop-dotnet-core-v1#step-332---completing-your-first-consumer-test. But with no luck: ``` [Test Class Cleanup Failure (tests.ConsumerPactTests)]: PactNet.PactFailureException : {"message":"Error ocurred in mock service: JSON::ParserError - 765: unexpected token at ''","backtrace":["/usr/local/lib/ruby/2.5.0/json/common.rb:156:in `parse'","/usr/local/lib/ruby/2.5.0/json/common.rb:156:in `parse'","/usr/local/bundle/gems/pact-mock_service-2.1.0/lib/pact/mock_service/request_handlers/pact_post.rb:27:in `respond'","/usr/local/bundle/gems/pact-mock_service-2.1.0/lib/pact/mock_service/request_handlers/base_request_handler.rb:17:in `call'","/usr/local/bundle/gems/rack-2.0.3/lib/rack/cascade.rb:33:in `block in call'","/usr/local/bundle/gems/rack-2.0.3/lib/rack/cascade.rb:24:in `each'","/usr/local/bundle/gems/rack-2.0.3/lib/rack/cascade.rb:24:in `call'","/usr/local/bundle/gems/pact-mock_service-2.1.0/lib/pact/consumer/mock_service/cors_origin_header_middleware.rb:11:in `call'","/usr/local/bundle/gems/pact-mock_service-2.1.0/lib/pact/consumer/mock_service/error_handler.rb:13:in `call'","/usr/local/bundle/gems/pact-mock_service-2.1.0/lib/pact/mock_service/app.rb:32:in `call'","/usr/local/bundle/gems/pact-mock_service-2.1.0/lib/pact/consumer/mock_service/set_location.rb:14:in `call'","/usr/local/bundle/gems/rack-2.0.3/lib/rack/handler/webrick.rb:86:in `service'","/usr/local/bundle/gems/webrick-1.3.1/lib/webrick/httpserver.rb:138:in `service'","/usr/local/bundle/gems/webrick-1.3.1/lib/webrick/httpserver.rb:94:in `run'","/usr/local/bundle/gems/webrick-1.3.1/lib/webrick/server.rb:191:in `block in start_thread'"]} ``` Even most simple tests fails with this ParserError. There is no error when running tests without docker. Any ideas?

8surajsingh9
2019-03-15 12:58
has joined #general

ghandour.jihad
2019-03-15 13:26
it was solved by PactDslJsonArray and value.object().stringType. Thanks in all cases Boris!

pkuang
2019-03-15 17:18
Hi, can someone provide more details on this workflow: https://gist.github.com/bethesque/43eef1bf47afea4445c8b8bdebf28df0 I have consumer -provider chains that I'm having trouble finding a good way to stub out the rest of the chain while ensuring the "stub" is valid. I explored option #2 but came to the same conclusion as the first comment on the gist where this would cause coupling of tests and the necessity of loose matching requests doesn't seem appealing. Is there an example of option #1 that shows how the "linking" that verifies the stub would be implemented?

kapoor84pu
2019-03-16 20:07
has joined #general

simon.nizov
2019-03-17 10:39
Any tips for DRYing up complex provider state setup when using spec V2? Some ideas I had: 1) Using commas in the state description and splitting by comma in the provider state setup. For example the provider state `"User with email X exists, Post with id Y exists"` would be parsed to `["User with email X exists", "Post with id Y exists"]`. 2) Faking a V3 pact by passing JSON inside the string and parsing it. For example passing the following provider state: `"\[\"User with email X exists\", \"Post with id Y exists\"\]"` - very ugly but would make the move to V3 easier in the future. Is it even worth it to do any of this? What?s the current status for supporting V3 in Ruby?

uglyog
2019-03-17 20:32
I would go with option 1.

uglyog
2019-03-17 20:33
Nobody has put their hand up to implement V3 support in ruby, so it will still be a while.

zach.powell
2019-03-18 11:01
has joined #general

vitaliy.grigoruk
2019-03-18 14:19
Hey Simon. I?m using JS implementation (which is a ruby wrapper) and I can pass a JSON array of objects to a provider state in v2. Not sure why, but it works

simon.nizov
2019-03-18 14:31
@vitaliy.grigoruk Interesting.. can you post a code snippet of how it looks?

ghandour.jihad
2019-03-18 15:16
I have a service that starts on a dynamic port. How can I start it, fetch its port, place it in @TestTarget, before @TestTarget is executed? In other words, is there anything cleaner than: @TestTarget public Target target = new HttpTarget(startServiceAndReturnPort()); private Integer startServiceAndReturnPort() { if (!started) { try { // code that starts the service and fetches servicePort } catch (Exception e) { e.printStackTrace(); fail(); } } return servicePort; }

hstene
2019-03-18 15:19
Why can?t you start it on a static port while testing?

ghandour.jihad
2019-03-18 15:20
I run several tests in parallel on the same machine as part of the CI. all the services (many) use dynamic ports so that non conflicts with another

hstene
2019-03-18 15:21
Are you using a framework for running your application? (Like Spring Boot?)


ghandour.jihad
2019-03-18 15:26
Unfortunately I am not using Spring Boot, and I can't for the moment. there is a complex piece of code that needs to be written to start the service. So my workaround was the one in the initial comment. I am checking if there is any kind of @before_everything where I can do things before the @TestTarget PS I checked and @Before_Class is not launched before @TestTarget :confused:

james.carman
2019-03-18 15:27
@ghandour.jihad can you tell your service which port to use?

james.carman
2019-03-18 15:27
From the outside?

james.carman
2019-03-18 15:27
or does it choose a random port internally?

ghandour.jihad
2019-03-18 15:27
No because it will create a race condition. The port I specify before the service starts, might be consumed by another service before my service is started

ghandour.jihad
2019-03-18 15:28
that's why we rely on the OS, by starting on 0 and getting an empty port

james.carman
2019-03-18 15:28
you can find a free port programmatically and hand that to the service rather than letting the OS do so

ghandour.jihad
2019-03-18 15:28
I edited it my reply. Choosing a free port will create a race condition as explained

james.carman
2019-03-18 15:31
what part of your test case starts the service?

hstene
2019-03-18 15:31
Well, why? If you programmatically look for a free port and take it if possible then it should be good?

ghandour.jihad
2019-03-18 15:35
Due to this: 1-You programmatically choose a port X. 2-You ask the service to start on that port X. 3-Service takes 30 seconds to start on that port X. 4-Service starts and the port X appears as busy if during 2 or 3, another service contacts the OS for an empty port, OS might give it X and step 4 will fail because port already in use

ghandour.jihad
2019-03-18 15:37
just to give you a scale, we are talking about thousands of services being started in parallel, and we always recommend using dynamic ports. I think many with such a scale would need a @before_everything or to at least let @before_class run before @TestTarget

james.carman
2019-03-18 21:42
are these thousands of services all downstream dependencies of whatever you?re trying to test?

jmcknight
2019-03-18 23:04
has joined #general

nikbarch
2019-03-19 02:03
has joined #general

nikbarch
2019-03-19 03:07
Hi everyone! Does anyone have a production-like example of pact test suite for python?

marko.justinek
2019-03-19 03:08
has joined #general

luca.ippolito
2019-03-19 06:29
Hey @matt.fellows Any updates on this? I was talking with others about this in the #pact-jvm channel. I was told that i should try to avoid using states that are dependent on each other. What's your opinion on this? Is the order of execution never guaranteed?

ghandour.jihad
2019-03-19 07:23
no no not at all :smile: I am talking about the amount of services being started in parallel and all counting on the OS to handle their port allocation

bethskurrie
2019-03-19 07:43
@uglyog is the author, and is the only one who can give you a definitive answer.

bethskurrie
2019-03-19 07:44
Have you tried in the #pact-python channel @nikbarch?

nikbarch
2019-03-19 10:16
I did. No one answered though

bethskurrie
2019-03-19 10:16
Try @richard.jones

ghandour.jihad
2019-03-19 10:35
Hi @bethskurrie :slightly_smiling_face: what do you think about @before_everything or to at least let @before_class run before @TestTarget ?

onebrianparker
2019-03-19 10:40
has joined #general

bethskurrie
2019-03-19 10:45
@ghandour.jihad I'm not familiar with the jvm implementation, sorry. @uglyog will have to answer your question (sorry to harass you Ron!)

bethskurrie
2019-03-19 10:46
Your use case is quite unusual, to have thousands of tests running in parallel.

bethskurrie
2019-03-19 10:46
Can you explain that more?

bethskurrie
2019-03-19 10:47
Sorry, it's late here, so I can't continue to respond now, but I'll put a reminder to follow up in the morning

uglyog
2019-03-19 11:23
@ghandour.jihad if you use the junit 5 version instead of junit 4 one, you can set the port for the Target.

vitaliy.grigoruk
2019-03-19 14:01
Sorry for a delay, @simon.nizov. Sure I can

vitaliy.grigoruk
2019-03-19 14:03
on a consumer side: ``` const interaction = { state: [ { name: 'session exists', params: { sessionId: 'session_id' } } ], uponReceiving: `a request for session information`, withRequest: { ... }, willRespondWith: { ... } } ```

vitaliy.grigoruk
2019-03-19 14:05
then when contract is generated, I get the following inside it: ``` { "description": "a request for session information", "providerState": [ { "name": "session exists", "params": { "sessionId": "session_id" } } ], "request": { ... }, "response": { ... } } ```

ghandour.jihad
2019-03-19 14:07
@bethskurrie, we have a pool of machines where many developers run their tests in parallel, even one team might be running same test on different branches, that's why dynamic ports are needed @uglyog, interesting. indeed I am not currently using junit 5. Well at least now I know there is a cleaner solution than my workaround. thanks!

vitaliy.grigoruk
2019-03-19 14:08
and on provider side, I?m running NodeJS express app for to handle http calls from pact verifier to /pactStateSetupUrl, which has the following middleware: ``` const express = require('express'); const bodyParser = require('body-const app = express(); app.use(setupUrl, bodyParser.json()); http://app.post(setupUrl, async (req, res) => { /* state handling goes here */ } ```

ots.indrek
2019-03-19 14:34
Found this thread via search. Seems to be an old one. @liran.tal how did you handle the feature toggle/flag use case?

wayofthepie
2019-03-19 20:54
has joined #general

james.carman
2019-03-19 21:35
We solved the port collision problem by using docker containers for our builds.

bethskurrie
2019-03-19 22:06
@adb can you set up a git repository with an executable example that demonstrates the problem, and raise an issue in the pact-mock-service-docker repository please.

bethskurrie
2019-03-19 22:07
Are you sure .net supports use of a standalone mock service, btw?

evan_l00
2019-03-20 00:45
has joined #general

marko.justinek
2019-03-20 02:19
I?m still here, just with my personal account now :slightly_smiling_face: Still keen to help out/support the swift side to the best of my time allowance(s)

matt.fellows
2019-03-20 02:35
:smile:

sdpoling
2019-03-20 02:36
has joined #general

sumanthbharan
2019-03-20 08:37
has joined #general

simon.nizov
2019-03-20 11:53
Hey @vitaliy.grigoruk, thanks for posting. From looking at your code and the pact generated, it seems like you *are* using V3.. https://github.com/pact-foundation/pact-specification/tree/version-3#allow-multiple-provider-states-with-parameters I?m using the ruby implementation and there is no way to pass an array as a state (the `given` method in ruby). If I pass in an array I just get `"providerState": "[\"foo", \"bar\"]"` in the pact file.

vitaliy.grigoruk
2019-03-20 11:54
Well, I?m using v2

vitaliy.grigoruk
2019-03-20 11:54
But I?m using pact-js

simon.nizov
2019-03-20 12:13
In the pact file, `providerState` takes an array (i.e `"providerState": []`) and at the bottom of the file it says `"version": "2.0.0"`? @vitaliy.grigoruk

vitaliy.grigoruk
2019-03-20 13:12
yes, that?s exactly what I have.

simon.nizov
2019-03-20 13:16
Very strange :S @matt.fellows - Isn?t multiple provider states a version 3 feature?

vitaliy.grigoruk
2019-03-20 13:35
it is, but in v3 the fields in contract is called ?poviderStates?, not ?providerState?

vitaliy.grigoruk
2019-03-20 13:36
the fact that it works for me in v2 this way is kind of a ?bug?, which I consider as undocumented feature :slightly_smiling_face:

simon.nizov
2019-03-20 13:38
This has now become my only good reason for leaving ruby in favor of JS :smile:

luca.ippolito
2019-03-20 14:09
Looks like https://docs.pact.io/ is having trouble loading images currently

matt.fellows
2019-03-20 19:31
Looks to be ok now, still having issues @luca.ippolito? We use gitbook for hosting the docs

matt.fellows
2019-03-20 19:32
:laughing:

luca.ippolito
2019-03-21 06:01
@matt.fellows looks better now for me as well :slightly_smiling_face:

a.bokias
2019-03-21 08:17
has joined #general

joseiglesias
2019-03-21 12:46
has joined #general

arunkumarpoonia
2019-03-21 17:07
has joined #general

arunkumarpoonia
2019-03-21 17:11
I am unable to build interaction without given, more details - https://github.com/pact-foundation/pact-php/issues/117

mboudreau
2019-03-21 22:13
please use our stackoverflow to ask questions, issues in github are for code issues: https://stackoverflow.com/questions/tagged/pact#

matt.fellows
2019-03-22 09:03
It looks like a real issue, tho

mboudreau
2019-03-22 09:19
Sorry, assumed that it would work like the other libraries :/

adb
2019-03-22 09:37
Hey, thanks for your reply. I'm not sure about that. It turned out that there is no need to use pact-mock-service image to run tests because .NET implementation uses pact-ruby-standalone. So I run .NET pact tests inside linux container like any other tests, without additional pact-mock-service container. Our devops complicated our life unnecessary :slightly_smiling_face:

upgundecha
2019-03-22 10:05
has joined #general

liran.tal
2019-03-22 19:39
Using something I call a pact manifest

liran.tal
2019-03-22 19:40
@ots.indrek ping me on twitter, I?m happy to share with you an article that I?m actually just about to publish next week on this whole setup


mwroblewski
2019-03-24 13:35
has joined #general

venkata.uday24
2019-03-25 00:07
has joined #general

bethskurrie
2019-03-25 03:00
@oswald.quek @m.r.green the latest version of the broker has the corrected logic to allow you to deploy new providers without requiring the consumer to be deployed.

bethskurrie
2019-03-25 03:00
2.29.0. Please update and let me know how you go.

kataramoonlight
2019-03-25 08:55
has joined #general

dave.carrell
2019-03-25 14:07
has joined #general

lekocrod
2019-03-25 14:32
has joined #general

mmarcottulio
2019-03-25 18:21
has joined #general

vtambourine
2019-03-26 02:45
has joined #general

vtambourine
2019-03-26 02:51
Hi everyone, I'm not sure if this is the right channel for such questions. Please, guide me where should I seek help. I'm wondering about status of this issue ? https://github.com/uglyog/pact-stub-server/issues/19 ? Support for different provider states in pact-stub-service. This feature would be extremely useful in our project, where we actively use pacts. generated from unit tests and pact-mock, to run stub to fuel E2E tests and demo certain features in emulated environment

anliang2314
2019-03-26 03:58
has joined #general

uglyog
2019-03-26 04:09
It was released in version 0.2.2. I've added a comment to the issue.

mateusz.beczek
2019-03-26 07:21
has joined #general

mateusz.beczek
2019-03-26 07:29
hi there, I'm Mateusz and I've got some issues with Pact Broker/Pact Broker clients security - for JVM we need to secure communication between Pact clients and Pact Broker, as I see in sources there is by default "Basic" authentication type, is there an option to use Bearer with token with pact-jvm?

bethskurrie
2019-03-26 08:25
Can you explain why basic auth is any less secure than a bearer token @mateusz.beczek?

bethskurrie
2019-03-26 08:26
Both are sending a value in an http header over a secure channel. I can't see that one is any more or less secure than the other.

bethskurrie
2019-03-26 08:27
Having said that, we are currently adding token auth to the Dius hosted pact broker. It should be released in late April.

mateusz.beczek
2019-03-26 08:37
Hi, issue is that you need to place somewhere user/password (probably plaintext), so that is for us unacceptable

mateusz.beczek
2019-03-26 08:38
we thought that we can us i.e. Keycloak, i.e. call for token and then push pact to Broker

mateusz.beczek
2019-03-26 08:39
we cannot store user/password in repository or whatever because of legal regulations

gopinathlangote11
2019-03-26 09:03
Recently I talked about `confidently-releasing-microservices-with-consumer-driven-contracts`At `Agile India 2019` conference. The slides from the talk are here, (Might help for beginners to understand CDC) https://www.slideshare.net/GopinathLangote/confidently-releasing-microservices-with-consumer-driven-contracts-1

matt.fellows
2019-03-26 09:16
How would you authenticate to keycloak?

matt.fellows
2019-03-26 09:16
Or is that managed at the OS level?

matt.fellows
2019-03-26 09:18
Bearer token would still suffer the same issue. You'd need to call keycloak to get the token and then send. Can you not do the same with the user/pass?

matt.fellows
2019-03-26 09:18
And yes, as Beth mentioned we're adding to the Enterprise offering later next month. If you'd like to discuss feel free to DM one of us and we can chat further

mateusz.beczek
2019-03-26 09:21
With certificate/key stored with sources?

bethskurrie
2019-03-26 09:38
@mateusz.beczek I think what you're getting at is that the bearer token would be a jwt, and hence, able to be validated without any credential stored in the broker itself. It's the fact that the token value would be a jwt that would solve your problem, not the fact that your auth type would be bearer token in itself.

matt.fellows
2019-03-26 09:48
Storing certificate/key with sources is the same as storing a user/pass, is it not?

matt.fellows
2019-03-26 09:48
What I'm saying is no matter which approach you go for, you still have to get a credential (whatever type) before authenticating

vtambourine
2019-03-26 10:16
Thank you, Ronald!

vtambourine
2019-03-26 10:53
Since yesterday I learned that starting from version 0.2.2 _pact-stub-server_ supports declaring provider states, I want to ask what?s your opinion on using stub server for negative testing scenarios. Currently, we are using stub server in E2E tests to mock responses for different edge cases ? for instance, to mock API returning full set of value, part of values, no values, or 4xx error. We have to use special headers (X-Mock-Header) to specify which 2xx response we expect in each particular test case. But that solution doesn?t feel right because of necessity to add test logic in otherwise production code. Instead, would it be possible to launch new instance of stub server with different provider state on each of the ?mocked? test scenarios? What do yo think?

ben.scown
2019-03-26 22:23
has joined #general

paras.vora
2019-03-27 08:29
has joined #general

skirankumars31
2019-03-27 22:50
has joined #general

skirankumars31
2019-03-27 22:58
Im a beginner to pact. We have some mocks for our microservices run with wiremock. Is it possible to keep them in sync with the provider using pact ?

bethskurrie
2019-03-27 23:00
Hi @skirankumars31. Welcome. No, you can't use wiremock with pact, as you need to use the pact mocking framework to generate the contract that is verified with the provider.

skirankumars31
2019-03-27 23:08
Thanks for the reply @bethskurrie. Can pact can help me keep the wiremock services in sync with production service ?

bethskurrie
2019-03-27 23:08
When you say " wiremock services", do you mean, your providers?

bethskurrie
2019-03-27 23:09
Pact will help you keep your dev/prod consumer and provider versions in sync with each other.

skirankumars31
2019-03-27 23:16
We use wiremock to mock all these services in our dev environment, but sometimes they get out of sync with production. So i was wondering if pact could help us run some tests to check if the mocks are not up to date with production

james.carman
2019-03-27 23:21
If you don?t have any state requirements, you may be able to run your pacts against the mocks.

skirankumars31
2019-03-27 23:47
Should i use pact-stub-server or wiremock ?. If i use pact stub server i can be sure that my mocks will be up to date. How can i make sure my wiremock mocks and providers have the same contract ?

yousafn
2019-03-27 23:57
which side are you on? consumer / provider or both? who owns the mocks? If you are the consumer, and you are using wiremock to mock your provider Then you could setup pact consumer tests that describe the behaviour you expect from your wiremock service. You then call the pact broker via pact, and pass it the provider endpoint of your wiremock service and verify it is acting as expected. You would then, in your example run then against your real (non wiremocked) provider to check for drift. However, the real question is the value of your wiremock representations, if they are drifting out of sync with production service. Why is it not being picked up earlier than production? Surely this could be determined much earlier in your workflow. I am currently working in a team where we have pact implemented on our consuming services, they have published contracts to the pact broker. Our provider has given us wiremock representations of their services, and we have validated them against consumer-provider contracts and they are all green now. The hope is that when they finish their first provider service, they will run validate the contracts and again we will see nice green builds. If not, something will have gone amiss, but this would be caught in an integration environment. For protecting production services, we will run the same tests against a staging enviroment (basically pre-prod) which should protect us from having any production incidents due to contractual problems :metal:

yousafn
2019-03-28 00:02
if you guys use swagger, there are some tools to help check drift between swagger & wiremock (https://github.com/telegraph/wiremock-swagger)

skirankumars31
2019-03-28 00:11
Im on the consumer side

uglyog
2019-03-28 04:21
@skirankumars31 pact came about based on consumer tests precisely to keep the mocks in sync. It was designed as a feature. But you can use pact mock servers instead of wiremock. There is nothing to verify the wiremock responses.

uglyog
2019-03-28 04:26
However, you could write provider pact tests against wiremock, assuming you can share the wiremock config.

uglyog
2019-03-28 05:49
Sounds like an ok approach to me

vtambourine
2019-03-28 17:25
Hi everyone! Can someone help me understand ? which pact-stub-service implementation is used in pact-node package? Is it Ruby or Rust?

mboudreau
2019-03-28 22:15
Ruby for the moment

vtambourine
2019-03-29 00:53
Hm? Does it mean, that option to provide regexp for provider state (as in rust cli) is not available yet?

mboudreau
2019-03-29 00:55
It does not

chakra.yadavalli
2019-03-29 01:42
has joined #general

chakra.yadavalli
2019-03-29 01:43
Hi I am looking for information on using pact with grpc proto3

bethskurrie
2019-03-29 03:39
Try the #protobufs channel?

matt.fellows
2019-03-29 10:25
Short answer is that it?s not officially supported? yet. It might be possible, but I?ve not heard of anyone doing it

matt.fellows
2019-03-29 10:25
We?d love support to make it happen

lextiz
2019-03-29 13:24
Hi guys, I have created a Docker image that wraps Pact Ruby CLI (all executables), in case some of you are interested: https://github.com/lextiz/pact-docker.

joseph.s.egan
2019-03-30 18:43
has joined #general

franklin.huynh
2019-04-01 02:59
has joined #general

skirankumars31
2019-04-01 10:43
Hi, Can anyone point me to a example usage of regex matchers in Pact-jvm ?


mboudreau
2019-04-01 11:14
with the dsl, you should be able to do `.stringMatcher("property", "^regex$", "generated value")`


skirankumars31
2019-04-01 12:22
Thanks @mboudreau :slightly_smiling_face:

skirankumars31
2019-04-01 12:38
Can i also have regex on numbers ?

skirankumars31
2019-04-01 12:38
Sorry got that one too

skirankumars31
2019-04-01 12:38
stringMatcher("FNR","\\d{11}","19048634263")

skirankumars31
2019-04-01 12:41
Hi guys, Is it possible to show the pact plugin in Intellij maven panel ?. I have pact plugin in pom.xml but it does not show in intelliJ maven panel

richard.jones
2019-04-01 23:15
Pact V3/V4 question: in pact V3 the ?match? element was replaced with ?matchers? allowing multiple matchers to be specified with a ?combine?, allowing things like ?match the type or a null?. In the V4 spec, the example at the bottom reverts back to the singular ?match? element. Is that indicative of a move away from the multiple matchers model? I note that V4 also includes a reference to ?matcher defintions like or(decimal, nullValue)?, so I?m pretty sure it?s not - just checking :slightly_smiling_face:

richard.jones
2019-04-01 23:27
I?d be interested to know whether anyone?s done anything in the space of multiple matchers. In terms of specifying the rules in our code (Python in this case) we?re thinking that it could be `Any(Like('string'), None)` which would allow the verifier to match a string OR null (the Like could also be an exact value, or a regex `Term()` or whatever). `Any()` would accept 2+ arguments and the concrete value (for mocking) is the first element. I?d also add `All()` at the same time which would generate an AND combiner. The functions could be called `Or` and `And` but I think `Any` and `All` read better.

abubics
2019-04-01 23:32
I think that's a powerful (and relatively complex) feature to provide, but does it give much value? I find (usually) when people start trying to match complex optionals, they really should just have more concrete, explicit test cases :thinking_face:

richard.jones
2019-04-01 23:35
Yeah, it?s a thought. We?ve not jumped yet :slightly_smiling_face:

abubics
2019-04-01 23:38
(I'm not a maintainer, just a frequent user, fwiw)

richard.jones
2019-04-01 23:43
the specific use case we have here derives good benefits from being able to have the representative data set (which includes values and nulls) in the pact, rather than splitting it into two artificial payloads.

uglyog
2019-04-02 01:05
V4 is incomplete, and only a work in progress

pkuang
2019-04-02 01:29
Does Pactjs (or pact in general) have support for request matching MIME types?

richard.jones
2019-04-02 02:52
yep, cool

matt.fellows
2019-04-02 07:03
Search for "optional types" on the pact specification , I believe there is a discussion there on this problem. Also there is a QandA dedicated to it on the pact website. Tldr we explicitly don't currently support it

qatrera
2019-04-02 13:54
has joined #general

pkuang
2019-04-02 15:03
more specifically a application/pdf body

bheemreddy181
2019-04-02 15:07
has joined #general

bheemreddy181
2019-04-02 15:09
Is there a ruby-channel around ?

rjmcguinness
2019-04-02 15:31
#pact-ruby

acooper106
2019-04-02 20:23
Can pact be used for Mobile Applications (Swift and Android)?

acooper106
2019-04-02 20:35
I see this announcement for swift https://docs.pact.io/implementation_guides/swift Please confirm this the recommendation

acooper106
2019-04-02 20:35
And do you have a recommendation for android?

marko.justinek
2019-04-02 21:19
@acooper106 yes, it can be used for Swift consumer side, and Android with JVM and/or Kotlin.

marko.justinek
2019-04-02 21:20
are you looking for something specific? @acooper106

matt.fellows
2019-04-02 21:30
So there's nothing specific to Android, it's just the JVM so you can use pact JVM for that purpose

richard.jones
2019-04-02 21:43
Yep, definitely bleeding edge. I think we might experiment with it and see how it goes? We?ll only be generating/verifying the pacts within pactman space, so having other implementation support it isn?t an issue.

2019-04-03 05:45
@matt.fellows has sent a survey for you!

matt.fellows
2019-04-03 10:12
apologies but I?m going to have to replace the Polly survey with an old-fashioned Google form. There are some restrictions on the Slack integration that weren?t obvious until after the results started coming through. I was hoping that the Slack integration would be more convenient, but not at the $$ it?s asking? Please instead complete the following.

matt.fellows
2019-04-03 10:13
Could we ask you answer a few quick questions on your usage of Pact? Your answers to these really help us understand how we can continue to improve the product. It shouldn?t take more than 1 minute, I promise! https://docs.google.com/forms/d/e/1FAIpQLSeLNdSSTP6eUHeJWnqMiJoD9Trib2Kw-fDarc3SzUM6cB-Bew/viewform?usp=sf_link (only new respondants)

thadir
2019-04-03 10:14
Then you should also set the permisions correct :wink: its now only set to owner organisation

matt.fellows
2019-04-03 10:15
I can?t believe how quick you must have gone to that link!! should be open now, I did both almost at the same time :slightly_smiling_face:

000sps97
2019-04-03 11:55
has joined #general

acooper106
2019-04-03 11:57
@marko.justinek @matt.fellows Thanks for you response. I'm not using it, I will pass along your answers.

laxmi.somni
2019-04-03 14:06
has joined #general

laxmi.somni
2019-04-03 14:07
Hi

laxmi.somni
2019-04-03 14:09
Do we have a good simple easy-to-follow example on PACT- using js? I just need a simple bare-bone example using any 3rd party public API (with clear insturactions to follow) ? Thanks in advane


vinod.baradwaj
2019-04-03 14:13
have u published that article ?

laxmi.somni
2019-04-03 14:19
Cool.

laxmi.somni
2019-04-03 14:19
Thanks a lot

laxmi.somni
2019-04-03 14:20
Its running all fine

laxmi.somni
2019-04-03 14:38
But I need a lighter version of this framework, which I can rewire & use it to create a small working model for our project

laxmi.somni
2019-04-03 14:39
i.e. to propose PACT framework to seniors

simon.nizov
2019-04-03 14:42
:man-shrugging:

simon.nizov
2019-04-03 14:51
Best way IMO is to actually do it yourself on an existing consumer and provider in your company


laxmi.somni
2019-04-03 15:08
sure. let me go through it

simon.nizov
2019-04-03 15:08
More specifically step #3

laxmi.somni
2019-04-03 15:08
Thanks

laxmi.somni
2019-04-03 15:09
I think Step-1 - implementing it on your own API is going to be a big milestone

laxmi.somni
2019-04-03 15:09
I've worked on RestAssured so, I'm sure will be able to work on this as well!:+1:

dagarwal
2019-04-03 18:29
I agree as well, it would be better if you demonstrate on existing services in http://company.it will help your seniors to understand use of pact in a better way

marko.justinek
2019-04-03 22:58
note, if you're using `pact-ruby-standalone` and would like to install it using Homebrew (https://brew.sh) you can use the following tap: ``` brew tap surpher/pact-ruby-standalone brew install pact-ruby-standalone ```

bethskurrie
2019-04-03 23:18
Woot! Thanks @marko.justinek!

bethskurrie
2019-04-03 23:19
You interested in moving it to the pact-foundation org?

marko.justinek
2019-04-03 23:19
sure

bethskurrie
2019-04-03 23:19
Pretty sure you're in the org already

bethskurrie
2019-04-03 23:19
Let me know if I need to add you.

marko.justinek
2019-04-03 23:19
am I?

bethskurrie
2019-04-03 23:20
When I get in front of my laptop I'll check and add you if not.

marko.justinek
2019-04-03 23:20
We'll sort it out np. Maybe over the weekend. Got _things_ to do now

bethskurrie
2019-04-03 23:20
How could anything be more important?! ;-)

marko.justinek
2019-04-03 23:20
Yah, i know ¯\_(?)_/¯

bethskurrie
2019-04-03 23:21
Pact is not the best tool for testing 3rd party APIs.

bethskurrie
2019-04-03 23:21
Let me find the FAQ.


nathan.wilson
2019-04-04 02:49
has joined #general

ghandour.jihad
2019-04-04 07:08
I am really sorry for the following question but well :smile: is there a plan for a c++ version of pact? :eyes:

matt.fellows
2019-04-04 07:25
No worries

matt.fellows
2019-04-04 07:25
Are you planning on creating one?

ghandour.jihad
2019-04-04 07:48
Wasn't planning on creating it, was just checking if there is plan to do it, that way I can use that as a good argument while trying to convince my company to use Pact :slightly_smiling_face:

bethskurrie
2019-04-04 07:49
Shouldn't be too hard to make one with the c bindings from @uglyog's rust impl

ghandour.jihad
2019-04-04 07:52
sounds good thanks!

bethskurrie
2019-04-04 07:53
Sorry, I'm not volunteering - I haven't written any c++ since uni! Just saying it wouldn't be too much work if someone who knew the language was interested. The hard work (the matching logic) is done.

ghandour.jihad
2019-04-04 08:00
oh no worries I got you correctly :slightly_smiling_face: the good news for me is that it is not hard to make since we already have these c bindings, and that is the argument I was looking for.

matt.fellows
2019-04-04 08:11
Hehe

matt.fellows
2019-04-04 08:11
We're definitely happy for it to be created and would support however we can. Let us know if you need help convincing bosses :grinning:

neelofer.tamboli
2019-04-04 10:49
has joined #general

neelofer.tamboli
2019-04-04 11:10
Hi everyone. Can someone help me with fixing this error through the pact broker UI rather than the DB? On the UI everything is looking fine, but our webhook is not getting triggered and we see the following error in logs: ```App 373 output: E, [2019-04-04T10:17:37.341770 #373] ERROR -- : PG::ForeignKeyViolation: ERROR: update or delete on table "pact_publications" violates foreign key constraint "triggered_webhooks_pact_publication_id_fkey" on table "triggered_webhooks" App 373 output: DETAIL: Key (id)=(1172) is still referenced from table "triggered_webhooks".: DELETE FROM "pact_publications" WHERE ("consumer_version_id" = 755) App 373 output: E, [2019-04-04T10:17:37.342049 #373] ERROR -- : PG::ForeignKeyViolation: ERROR: update or delete on table "pact_publications" violates foreign key constraint "triggered_webhooks_pact_publication_id_fkey" on table "triggered_webhooks" App 373 output: DETAIL: Key (id)=(1172) is still referenced from table "triggered_webhooks".```

shutchin
2019-04-04 21:51
has joined #general

matt.fellows
2019-04-04 23:06
Do you know what was done to get it into this state?

matt.fellows
2019-04-04 23:06
Did you do anything manually via the DB?

neelofer.tamboli
2019-04-05 05:53
Nothing via DB. We deleted the webhook and a specific pact version through the `Non-Get` requests from the Browser and then created a new Webhook when this was observed. All this was done for the same Provider and Consumer.

neelofer.tamboli
2019-04-05 05:54
Also when I checked the DB last night, and queried the problematic row, `SELECT FROM "pact_publications" WHERE ("consumer_version_id" = 755)`, there was no record in DB for it.

vaso.giamarelou
2019-04-05 08:46
has joined #general

thadir
2019-04-05 09:54
some cool reading stuff folks


neelofer.tamboli
2019-04-05 10:19
Please ignore my last comment, was looking at the pre-prod data.

neelofer.tamboli
2019-04-05 10:22
The issue is fixed now. The problem was as follows and the fix is also here. To repro: 1. Consumer `C` has two providers, `P1` and `P2`. 2. Pacts and contract content change webhooks are created for both C-P1 and C-P2 combinations. 3. Delete the webhook and latest pact version between `C` and `P1`. 4. Recreate the webhook between `C` and `P1`. 5. Publish a contract with contract change. 6. The webhook is not triggered, the issue we were facing. To fix this: Delete webhooks between `C` and `P1` and between `C` and `P2`. And then do the action required. The webhook then created will be triggered.

k.kaskavelis
2019-04-05 12:17
has joined #general

ghandour.jihad
2019-04-05 15:59
Hello fellow Pacters, I need convincing arguments to help me convince people :slightly_smiling_face: What is your best answer to the below skepticism: If the consumer calls a provider endpoint, using a client interface built by provider team, and places the response in an object built by the provider team, what would be the use of pact? In the consumer test, the consumer team will have to ?re-build? the provider object as a set of .stringType ... body response, just so that the mockedServer returns something that correctly fits in the provider object. Thus the consumer will have to specify all the parts of the response object, which deprives us from the use of Pact, which is specify only what you need. Is pact only for consumers calling providers directly, and parsing the json themselves to fill their own object? (unfortunately that rarely happens in my company :/)

matt.fellows
2019-04-05 21:22
Ho do you _guarantee_ that the client library stays in sync with the provider?

matt.fellows
2019-04-05 21:25
This reminds me of the old days with soap. Yes, we guarantee the client library is compatible with the provider (e.g. it was generated) but it's very brittle because you are coupled to each other. you now have to release all components together (painful) and roll backs aren't gonna be easy

matt.fellows
2019-04-05 21:26
The whole point of contract testing is to enable independent releases of components and continuous delivery. Coupling this way prevents this and scales poorly as you add more teams and components

james.carman
2019-04-06 20:24
We usually keep the service interface as a separate project

james.carman
2019-04-06 20:24
Cuts down on the churn.


matt.fellows
2019-04-06 22:42
Good question if anyone has a moment to answer. I'll look at responding later today when in front of a computer


mo.balghonaim
2019-04-08 00:41
has joined #general

nathan.deamer
2019-04-08 10:51
has joined #general

nathan.deamer
2019-04-08 10:55
Hey, Is anyone able to help with an intermittent 409 conflict from our hosted pact broker? https://github.com/pact-foundation/pact_broker/wiki/Troubleshooting I?ve checked the name and it is unique and not similar from any other names

nathan.deamer
2019-04-08 10:56
I?ve ran a curl script manually from my machine - always fine. But when it runs as part our of circleCI pipeline from an apple build we see 409s.

bethskurrie
2019-04-08 11:03
Are these new consumers or providers?

bethskurrie
2019-04-08 11:04
Do you have the body of the response in your output?

bethskurrie
2019-04-08 11:05
There are a couple of reasons you might get a 409.

bethskurrie
2019-04-08 11:07
Are you sure it's the naming reason?

nathan.deamer
2019-04-08 11:16
Hi Beth, Its an existing consumer and an existing provider - just an update - possibly without any changes other than version number. I don?t have the body of the response, from iOS we only get `HTTP Error 409: Conflict` ```except urllib2.HTTPError as e: print e``` I am not sure if it is the naming reason?. that is the only documentation I could find for why.

nathan.deamer
2019-04-08 11:16
Currently adding more logging :slightly_smiling_face:

bethskurrie
2019-04-08 11:34
The other cause of a conflict is when multiple pact files are merged into one resource using a PATCH request.

bethskurrie
2019-04-08 11:35
Which implementation are you using to publish the files?

nathan.deamer
2019-04-08 12:19
It could be that one?. Our iOS implementation of pact: 1. Starts a mock service . 2. Creates a pact for the next provider 3. Exports the json files etc. 4. Calls flush on the mock service. 5. Repeat for next microservice. Then at the end we use some custom python scripts against the rest apis


bethskurrie
2019-04-08 23:38
@nathan.deamer what are you using to *publish* the pact files to the broker?

bethskurrie
2019-04-08 23:40
Can you copy paste the code for me?

bethskurrie
2019-04-08 23:41
@neelofer.tamboli can you raise an issue for this in the pact_broker repository, with an explanation of how to recreate the issue?

dglaubman600
2019-04-09 04:34
has joined #general


neelofer.tamboli
2019-04-09 07:13
Thank you

maximkugatov
2019-04-09 08:20
has joined #general

nathan.deamer
2019-04-09 09:50
@bethskurrie I think the issue was our side and hopefully got to the bottom of it? iOS was outputting 2 x json files for the same consumer / provider. Would be interesting to know if you have any documentation on iOS and microservices.

bethskurrie
2019-04-09 09:54
What in particular about ios and microservices? I'd try asking in the #pact-swift channel.

jon.pascoe
2019-04-09 11:16
has joined #general

nschmuter
2019-04-09 12:49
has joined #general

bheemreddy181
2019-04-09 18:51
I completely agree with this and Clients are so much to maintain

florian
2019-04-09 20:37
has joined #general

harshal.kulkarni
2019-04-10 00:57
has joined #general

matt.fellows
2019-04-10 00:59
does this resonate with you @ghandour.jihad?

ghandour.jihad
2019-04-10 06:35
it completely resonates :slightly_smiling_face: thanks a lot! that was the argument I needed

matt.fellows
2019-04-10 07:03
OK, let us know how you get on with the team - it will be great feedback for us (and perhaps could move it to the FAQs)

ghandour.jihad
2019-04-10 07:07
sure!

oswald.quek
2019-04-10 09:15
@bethskurrie apologies for only getting back to you now. i'm about to deploy the latest pact-broker soon but will it break the way the pact broker client is used? we currently use it like its done at https://github.com/pact-foundation/pact_broker-client/blob/master/spec/lib/pact_broker/client/can_i_deploy_spec.rb#L25

oswald.quek
2019-04-10 09:16
can we instruct the pact broker to ignore a consumer via the pact broker client?

bethskurrie
2019-04-10 09:17
it won't break any existing commands.

bethskurrie
2019-04-10 09:18
hopefully you shouldn't need to tell it to ignore the consumer

bethskurrie
2019-04-10 09:19
let me know if you have issues

oswald.quek
2019-04-10 09:27
great, thanks. we actually did a work around to get our provider deployed (think it was something to do skipping the pact compatibility check) so it might not be a while till we add a new consumer so we can actually test this.

vinod.baradwaj
2019-04-10 10:00
thanks @liran.tal

gnana_margoschis
2019-04-10 16:26
has joined #general

bhollister
2019-04-10 18:05
has joined #general

bheemreddy181
2019-04-11 13:58
@matt.fellows do you suggest to have own interactor on the consumer side for provider or just open the connection where ever need and close it off ?

matt.fellows
2019-04-11 20:25
Sorry I don't know what that means, can you please elaborate?

bethskurrie
2019-04-12 00:08
Yo. If you're using the pact-ruby-standalone for anything (publishing, verifying) you can now run it via docker using `pactfoundation/pact-cli`. Eg. publishing pacts, can-i-deploy ``` export PACT_BROKER_BASE_URL="https://test.pact.dius.com.au" export PACT_BROKER_USERNAME="dXfltyFMgNOFZAxr8io9wJ37iUpY42M" export PACT_BROKER_PASSWORD="O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1" docker run --rm \ -e PACT_BROKER_BASE_URL \ -e PACT_BROKER_USERNAME \ -e PACT_BROKER_PASSWORD \ pactfoundation/pact-cli:latest \ broker can-i-deploy \ --pacticipant Foo \ --latest ``` Try it now just for funsies!

bethskurrie
2019-04-12 00:09
Btw, if you're using can-i-deploy, it's worth upgrading to the latest version of the broker, because the error explanations when you can't deploy are much more helpful.

bethskurrie
2019-04-12 00:10
I've also fixed the 'provider can't deploy without the consumer' issue.

bheemreddy181
2019-04-12 03:46
Is it a good idea to host a own pact broker or use the one registered on http://dius.com @bethskurrie if you have any documentation for setting it up can you please share the same

bheemreddy181
2019-04-12 03:47
Is there a way to set up Auto upgrades on pact broker

matt.fellows
2019-04-12 03:47
As it stands, the documentation for setting it up is on the github page for the pact broker.

bethskurrie
2019-04-12 03:48
I am part of the team at DiUS that runs the hosted broker. If you're interested in having one, you can sign up at http://pact.dius.com.au. It saves you the hassle of managing your own infrastructure, and we've been working hard on it for the last couple of months to add some new features like social login, and a fancy new UI. They're set to be released at the end of April.

matt.fellows
2019-04-12 03:48
Upgrades would require a backup of the DB, re-deployment to your servers with the latest Ruby code base etc. It should migrate without breaking things, unless of course we release a ?breaking change? (signalled by a major version bump in the semver)

matt.fellows
2019-04-12 03:48
I can recommend the hosted service, but then again, I am one of the maintainers of that product :slightly_smiling_face:

bheemreddy181
2019-04-12 03:49
What I mean most of the Ruby on Rails built api are habituated to use Client gems for communication between consumer and provider

bethskurrie
2019-04-12 03:49
If you're using the docker image, you just upgrade the docker image.

bethskurrie
2019-04-12 03:49
The data will be automatically upgraded for you when you start up the broker again.

bheemreddy181
2019-04-12 03:49
I was asking is it recommended to open a HTTP connection where ever required or have provider specific interactor to communicate?

bethskurrie
2019-04-12 03:50
There is an upgrades section in the documentation where any necessary information for upgrading will be noted.


bethskurrie
2019-04-12 03:51
@bheemreddy181 here is the documentation for setting up your own if you're interested in doing that https://github.com/pact-foundation/pact_broker#for-reals

matt.fellows
2019-04-12 03:52
Oh. I don?t have specific opinions about this, other than the ones shared above. Gems like that can be useful, and if it speeds up your development and you can still guarantee the contract will be satisfied (e.g. as described above), then I?d say go for it

steve
2019-04-12 10:39
has joined #general

slack1949
2019-04-12 12:03
has joined #general

david.edwards
2019-04-12 12:29
has joined #general

m.balghonaim
2019-04-12 13:09
has joined #general

m.balghonaim
2019-04-12 13:30
Hello, I have the following questions: 1) Based on what I understood, a pact's interactions are replayed against the actual server when they're verified for the provider. However, how do I work around the scenario where the interaction has hard-coded data in the query params that might not exist in the future (e.g., querying for a deleted user account)? Is that not a recommended usage of pacts? 2) Why must the consumer unit test the interaction against mock server?

thomas.stock
2019-04-12 13:53
has joined #general

bheemreddy181
2019-04-12 13:53
How about the security concerns and downtime support and all other maintenance?

bheemreddy181
2019-04-12 13:55
@matt.fellows ^

thomas.stock
2019-04-12 14:04
@m.balghonaim I'll try to answer, someone correct me if I'm wrong. 1) you're supposed to set up state on your server specifically for the pact interactions. Otherwise you can never make 2 interactions "I have employees in my company" and "I have no employees in my company" succeed because they are mututually exclusive. Here is a (dirty) example of setting up states for 2 interactions.

thomas.stock
2019-04-12 14:10
2) not sure I fully understand your question, but you're supposed to write a test in your consumer that somehow triggers the API call to the mockserver, which will then return the instructed response. This interaction is then recorded into your pact file. So basically you use pact's mockserver as provider in your unit test. The mockserver records the interactions into a file which your real provider can validate against. The unit test guarantees that the API interaction is actually one that is needed by your consumer. if you refactor the consumer code and delete "api.getEmployees()", you will also remove the unit test for getEmployees(), causing the GET to '/employees/all' to disappear from your pact file, so that the provider knows it must no longer provide/maintain this endpoint.

mo.balghonaim
2019-04-12 17:23
Gotcha, thanks! :bulb:

mo.balghonaim
2019-04-12 17:26
But in this case, wouldn't I be hard-coding responses from the actual provider?

matt.fellows
2019-04-12 22:59
The free tier as it stands today comes with email support and automatic upgrades. See my recent post where we enabled a WAF, we have a number of security measures in place.

bethskurrie
2019-04-12 23:03
@bheemreddy181 as a tool that needs to support CI, we are well aware of the need for the service to be as stable as possible, and this was in the forefront of our minds when we rearchitected the platform recently.

bethskurrie
2019-04-12 23:05
I maintain both the open source and the hosted projects, so the hosted platform always has the latest code.

michaelzaporozhets
2019-04-14 04:54
has joined #general

alexplusm
2019-04-14 14:44
has joined #general

mdsucgang
2019-04-15 01:05
has joined #general

thomas.stock
2019-04-15 10:07
Not really, you are preparing your provider's database to be able to respond to the specific interaction. For example: You prove that there is an endpoint GET /employees/all and that, given 'there are no employees', the endpoint will return an empty array. In order to prove this, you set up a database with an empty employees table. For the next interaction 'given there is an employee called Joan, I can find the employee' you insert an employee called Joan in the database and calling /employees?name=joan endpoint should now return that employee. etc

thomas.stock
2019-04-15 10:09
if you look at my screenshot, you see I'm not hardcoding API responses, I'm just inserting stuff in a database. This proves to me (as provider) that my API is able to return the expected/inserted data.

asite-rshah
2019-04-15 11:21
has joined #general

bheemreddy181
2019-04-15 18:51
1. PACT generally comes into picture for syntax for the API response, not for the semantics( what value will I have the particular field ) of the response. You can handle such cases (/DELETE) with having the Provider States where you can populate or mock the response of the database object or populate the DB and perform cleanup at the end. 2. Consumer interaction against the mock server would help Consumer to talk to real service so that we can reply the same interaction on the provider side - @bethskurrie Can you give you a better answer than me

kyle
2019-04-15 20:54
has joined #general

m.balghonaim
2019-04-16 03:35
That makes sense, thanks Thomas :thumbsup:

handa.manik
2019-04-16 06:31
has joined #general

iruben91
2019-04-16 14:32
has joined #general

ian.mcwilliams
2019-04-16 14:46
has joined #general

gopinathlangote11
2019-04-17 08:55
Who is maintainer from pact foundation here? We at our company want to introduce pact broker in our infrastructure. For the same we have some questionaries to get answer from the pact foundation organisation. please DM me, I will continue discussion there.

bethskurrie
2019-04-17 08:55
Ok

mboudreau
2019-04-17 09:21
@gopinathlangote11 there's a few of us here, just ask.

iruben91
2019-04-17 10:12
Hello everyone. My company is currently replatforming all its existing systems into a microservices architecture hosted with a cloud provider and is considering adopting Pact for contract testing between our services. At this time we're using C# and .NET Core and we don't have Ruby developers, so we would be using Pact-Net. Some questions that have been raised are: - Could Pact be used to test contracts between queues and consumers (i.e. non-HTTPlike AMQP)? I came across this Gist (https://gist.github.com/bethesque/0ee446a9f93db4dd0697) and thread (https://groups.google.com/d/msg/pact-support/4QVTdecls9s/3-cJQh1TUTgJ), but I'm trying to understand whether this would be achievable with the Pact-Net library or if it would need plugging into the underlying Ruby implementation. - Are there any future plans for implementing Protobuf testing in Pact? - Is it possible to use Pact-Net's mock server for additional test cases for component testing within the consumer without including all of them in the Pact. I understand that the mock and stub service used by Pact is accessible for additional uses, but I'm unsure whether it is accessible through the Pact-Net library.

matt.fellows
2019-04-17 10:44
Short answer is yes to all 3. For messaging support there is a caveat as the message provider work is currently in flight for .NET. it looks like there is a working branch close to completion, so you might like to check our the GH issues to follow that work

matt.fellows
2019-04-17 10:44
Also, sounds exciting!

matt.fellows
2019-04-17 10:45
I'll try to answer more a bit later once I've finished with dinner etc :laughing:

murphy.meng
2019-04-17 12:06
has joined #general

murphy.meng
2019-04-17 12:08
Great! People are alive here

murphy.meng
2019-04-17 12:10
@beth Sorry I dropped you an email seeking some help before I get in the slack.

murphy.meng
2019-04-17 12:11
I am attempting to implement v3 spec to pact-python. Who is the best contact there to seek help and discuss?

matt.fellows
2019-04-17 12:19
@matthew.balvanz @jose and @richard.jones (pactman) are worth chatting to

matt.fellows
2019-04-17 12:19
Also #pact-python

neil
2019-04-17 12:38
@iruben91 What @matt.fellows said. Have a look at the `message-pact` branch. You can build a nuget package from that branch if you?d like to use it.

neil
2019-04-17 12:41
For question 3, you can always run another instance of the mock service and just ignore the pact file. Otherwise if you don?t call `.Build()` on the `PactBuilder` the pact file won?t even be written.

iruben91
2019-04-17 13:16
Thank you for your help! So, I understand that AMQP support is nearing completion, and that the mock and stub Pact server can be used separately for other non-contract tests. So, are you saying that the Protobuf support may be being considered for future iterations of Pact?

neil
2019-04-17 13:23
Yeah message support is getting close, we just need to put in some time to cleanup the api and finish things off. I just haven?t had the time lately. Yes it should be, however I?d recommend you run some PoC to see if it works for what your are trying to do. I?m not sure on the status of Protobufs TBH. Check out #protobufs for the conversations.

marc
2019-04-17 13:27
has joined #general

000sps97
2019-04-17 13:45
Hello everyone,

000sps97
2019-04-17 13:48
i am using Pact Provider Verification for verifying pacts using CLI i want to use multiple tags so that i can verify all the pacts containing the tags, like i have 2 pacts, one with tag as "develop" version 1.2 and other with "abcd" version 1.0 i want to run all the interactions in for given two tags at the same time (for checking backward compatibility )

000sps97
2019-04-17 13:49
this the command i am running `./pact-provider-verifier --provider=ApiGatewayProvider --consumer-version-tag=develop --provider=ApiGatewayProvider --consumer-version-tag=abcd --provider-base-url http://localhost:4000 --pact-broker-base-url=http://localhost:9292` it was written in documentation that we can use --consumer-version-tag multiple time

000sps97
2019-04-17 13:52
but its overwriting the tag and searching for only tag abcd instead of both

murphy.meng
2019-04-17 14:11
@matt.fellows pact-mock_service claims it support spec v3, does it support mocking messaging? If yes, any chance I have some examples? If no, how jvm and golang client claim they do asynchronous api? (I did assume all impls relies on pact-mock_service the ruby impl)

nodkane12
2019-04-17 14:22
has joined #general

nodkane12
2019-04-17 14:27
Hi everyone! I'm using Pact for Node.JS and Mocha and I've been using the example provided in the mocha examples section of the Pact-JS repo; I want to validate the pact generated from the local pact server against some external API that is for all intents and purposes a black box. there doesn't seem to be any documentation on how I can go about doing this, (I appreciate this is probably not the right channel, but I'm not sure which one to post this in)

ariel
2019-04-17 15:12
has joined #general

simon.nizov
2019-04-17 16:03
Looking for implementation details regarding tagging pacts when using feature *toggles*, not branches. I?m implementing step 5 of the pact nirvana guide https://docs.pact.io/best_practices/pact_nirvana#5-allow-contracts-to-change-without-breaking-your-builds. Trying to figure out what?s the best way to pass the feature toggles to my CI build which publishes the pact with `pact-broker publish`. Anyone willing to share?

tmok01
2019-04-17 21:41
hey all - quick question for you all. When a consumer publishes a pact to pact-broker which is the same as the last pact it published, is it supposed to require the provider to verify it again? (It looks to me as though it does)

matt.fellows
2019-04-17 22:08
No, if the contract hasn?t changed the previous verification result still applies.

matt.fellows
2019-04-17 22:08
The caveat to this is that if you are generating random values in the contract, the broker will detect this as a change and expect a new verification

matt.fellows
2019-04-17 22:09
Can you please elaborate further by ?mock? in this context?

matt.fellows
2019-04-17 22:10
In short, it supports messaging, but we work at a different layer of abstraction. Rather than implementing the thousands of various messaging protocols, we expect you to separate out the bit that creates the _message_ from the bits that send that message over a wire format. The bit that generates (and on the other side, consumes) the message is the bit we test in Pact

matt.fellows
2019-04-17 22:10
Have you looked at the examples?

matt.fellows
2019-04-17 22:11
Might be worth chatting in #pact-js

matt.fellows
2019-04-17 22:12
It isn?t ideal, but it is doable. There is no reason why you couldn?t just point the provider verification at the external service (rather than a local one). What have you tried so far?

matt.fellows
2019-04-17 22:12
And what issues have you encountered?

mboudreau
2019-04-17 22:15
is this front-end or backend feature toggles?

simon.nizov
2019-04-17 22:35
@mboudreau backend

tmok01
2019-04-17 22:53
Thanks for that Matt. But I seem to have a situation in my pact broker matrix that contradicts that ....

tmok01
2019-04-17 22:55
What would be the process to get some help with this?

mboudreau
2019-04-17 23:25
Right, so you want your feature toggle backend to have a contract with an API? I need more context here :P

ylin
2019-04-18 03:13
has joined #general

matt.fellows
2019-04-18 03:39
Ideally an isolated reproducable test that we can use to identify the cause. There is a test pact broker you can publish to if you need

murphy.meng
2019-04-18 07:04
Yes. @matt.fellows, had gone through all examples (groovy and go impl) but I did not feel myself understood. I don?t see a single example that shows how it actually works with a actually messaging broker. True I know pact does abstraction for messaging recv/produce, but the integration part (make it work with activemq, kafaka) is the bit I am after.

murphy.meng
2019-04-18 07:09
By ?mock? in my question, I mean in a consumer testing for async api, do you expect a real message client (stomp, openwire transport) integrated with pact client, and in the test code, it is the messaging client which sends out the messages __generated__ by pact client? If the answer is yes. I definitely expect the pact mock server should be able to receive the message, read out and parse the body before it generates the pact. However the pact mock server does not have the ability to receive messages (abstraction remember?), then what extra work we need do to help the mock server to consume real messages? I dont see any option to do so in pact-mock_service cli.

murphy.meng
2019-04-18 07:11
(I did not make it clear enough perhaps, when I say mock in my question, I though concept-wise, pact could even mock the message recv/produce with normal http transport, thus it is not actually testing asyn api under the hood)

nodkane12
2019-04-18 07:56
```It isn?t ideal, but it is doable. There is no reason why you couldn?t just point the provider verification at the external service (rather than a local one). What have you tried so far?``` I tried that, I changed the provider verification to the dummy API I am using as a proof of concept, but got an error to the tune of: ``` Pact verification failed! Actual interactions do not match expected interactions for mock MockService. Missing requests: GET /api/v1/employees ```

simon.nizov
2019-04-18 08:02
@mboudreau I want to be able to make changes to my ?main branch? pact, without breaking the consumer build. My understanding is that this should be done by tagging the pact with some kind of indication, ideally derived from a feature toggle.

matt.fellows
2019-04-18 08:08
that?s the consumer side verification.

matt.fellows
2019-04-18 08:08
you definitely can?t point at another API endpoint during consumer verification - you _must_ point at the mock service. On the provider side verification you can do this

nodkane12
2019-04-18 08:17
Ah. There's nothing in the example about how to set up the provider side verification for js & mocha

matt.fellows
2019-04-18 08:24
which example?

matt.fellows
2019-04-18 08:27
the end-to-end example has one



nodkane12
2019-04-18 08:30
Ah, I was looking at the Node.JS Mocha example folder in the Github Repo


matt.fellows
2019-04-18 08:39
Np

matt.fellows
2019-04-18 08:39
Did that help? The framework you use is largely irrelevant

nodkane12
2019-04-18 08:52
In a sense, yes. I'd have liked to use mocha framework in that example, but it looks like that's a no-go.

nodkane12
2019-04-18 08:52
Thanks

matt.fellows
2019-04-18 08:55
It is mocha

matt.fellows
2019-04-18 08:57
What do you mean?

nodkane12
2019-04-18 08:59
I meant the framework example in the repo folder

nodkane12
2019-04-18 08:59
it seemed simpler

matt.fellows
2019-04-18 09:17
Oh ok. Yes the e2e is more fully features to show the capabilities. You won't need them all in most cases

nodkane12
2019-04-18 09:20
Cool, thanks again

matt.fellows
2019-04-18 11:34
Sorry was out at a family thing. Ping me if things aren't clear

murphy.meng
2019-04-18 13:01
@matt.fellows, does it make sense?

murphy.meng
2019-04-18 13:13
Can someone point me to examples of what provider tests SHOULD cover apart from validating the replay of contracts? I thought I read through all documents of pact general, pact go impl, pact python impl and pactman impl, but I did not find answer. For example, provider provides endpoint /user/some_name for GET and the response is json about the user. The consumer testing is apparently about whether the response contains all mandatory fields and if they are in proper format/content and write it to contract. What is left to provider tests? What the provider team should test out of the scope of contracts provided by its client? Why it does not do such testing in normal unit framework, but under pact?

chris.empson
2019-04-18 14:26
has joined #general

simon.nizov
2019-04-18 15:02
https://docs.pact.io/best_practices/consumer#use-pact-for-contract-testing-not-functional-testing-of-the-provider https://docs.pact.io/best_practices/consumer/contract_tests_not_functional_tests These two parts of the docs should answer your questions. Basically Pact provider verification is just an additional layer to your provider tests. You should continue writing functional unit and integration tests for you provider service as you did before.

albertot
2019-04-18 16:31
has joined #general

albertot
2019-04-18 17:15
I'm hoping to find a solution or workaround for my problem. The provider returns something like this: ``` "ratings": [ { "id": 12, "count": 4 "average": 3.75 }, { "id": 37, "count": 1 "average": 4 }, { "id": 143, "count": 0 "average": 0 }, { "id": 574, "count": 6 "average": 4.333333 }, ] ``` My matcher is ``` ratings: eachLike({ id: like(15), count: like(20), average: like(4.5) }) ``` When I validate the provider, I get `Expected a Float (like 4.5) but got a Fixnum (0)`. It looks like this is by design. Any way around it?

murphy.meng
2019-04-18 21:09
Exactly, exactly! These two references are totally on my side, thanks Simon.

murphy.meng
2019-04-18 21:14
I should rephrase my question to be, APART FROM consumer side tests, and scenarios that should be covered by functional testing, what should be covered in provider side testing? (My current confusing is, I can imagine NONE, note in the useful article https://docs.pact.io/best_practices/consumer/contract_tests_not_functional_tests it discussed consumer testing, rather than provider testing)

matt.fellows
2019-04-18 23:25
Hmm I'm not sure actually

matt.fellows
2019-04-18 23:26
As an aside, you don't need to nested `like` in the `eachLike` (superfluous) and this probably should have been asked in the js channel.

matt.fellows
2019-04-18 23:29
I think so. The mock service only talks http at this point and not any of the messaging protocols at this stage (we are experimenting with protobufs atm). For now, you can't use it to mock directly an async service

murphy.meng
2019-04-19 07:28
How consumer tests for asny api are performed then? like jvm and go impl?


matt.fellows
2019-04-19 07:45
And then look at the example tests in those repos (pact js too)

jadedevin13
2019-04-19 09:05
has joined #general

vivek.thangathurai
2019-04-19 11:21
has joined #general

vivek.thangathurai
2019-04-19 11:27
Hello

vivek.thangathurai
2019-04-19 11:29
I want to pass the tags to provider tests with @PactBroker(tags ="${pactbroker.tags}") as a system/environment varaible using gradle.. but even if I pass the variable to the test in gradle it is not being picked up by the provider.. it says `java.lang.RuntimeException: Could not resolve property "pactbroker.tags" in the system properties or environment variables and no default value is supplied`

vivek.thangathurai
2019-04-19 11:31
`systemProperty "pactbroker.tags", System.getProperty("pactbroker.tags")` passing the value to gradle task as -Dpactbroker.tags=latest,1.00

albertot
2019-04-19 13:16
I did ask this in the JS channel, but this is not a JS channel exclusively. I tried your hint of removing the `like`s inside and I still get the same errors. The provider validation fails any time a whole number is returned without a decimal component (that is, `0.0` or `4.0` in this case). I understand failing when I expect an integer and I receive a float. But failing when I expect a float and I receive an integer is an bug in my book (and in math books too). So far we have been impressed with Pact and want to adopt it, but this bug is a show-stopper for us.

albertot
2019-04-19 14:13
:point_up: s/JS channel/JS issue/

matt.fellows
2019-04-20 00:48
Can you please raise an issue? Seems worth investigating

matt.fellows
2019-04-20 00:49
The hint was just to DRY up your code, the outcome is the same (matchers Cascade)

mpglover
2019-04-22 02:11
has joined #general

vitaliy.grigoruk
2019-04-22 12:14
I guess you can do something like ?feature A is enabled? in providerState for interactions affected by a specific toggle

simon.nizov
2019-04-22 12:22
@vitaliy.grigoruk How will that make my provider verification process skip that updated pact?

mvpatel1982
2019-04-22 13:26
has joined #general

albertot
2019-04-22 14:53
Is there a particular repo I should raise this in? After some investigating, this is in the Ruby core. Would `pact-ruby` be the best project?

matt.fellows
2019-04-22 23:28
That would work I think

j
2019-04-23 02:41
has joined #general

mitchell.davis
2019-04-23 06:50
has joined #general

vitaliy.grigoruk
2019-04-23 09:23
it looks like I didn?t understand your question correctly, @simon.nizov.

al
2019-04-24 13:38
has joined #general

gavrie
2019-04-24 14:52
has joined #general

audun.halland
2019-04-24 19:08
has joined #general

audun.halland
2019-04-24 19:34
Hi all. I recently noticed the `pact-reference` Rust project, and got the impression that this will somehow maybe some day act as replacement for `pact-ruby`. Background is that I've been having some problems with `pact-js` and pact spec 3. So this has spawned my curiosity a bit and I'm just wondering how to be of any help contributing to the stabilization of that project. The roadmap states that it's Alpha. I did not find a (public) slack channel devoted to that project.

audun.halland
2019-04-24 19:35
I'm just a big fan of the pact framework, my team and project gets great value out of it, and I'm interested in helping if it's wanted.

matt.fellows
2019-04-24 22:28
Thank you and yes, help is always wanted.

matt.fellows
2019-04-24 22:29
The tldr is that we've been busy with lots of things and whilst this hasn't been forgotten it's probably pushed back in terms of priority

matt.fellows
2019-04-24 22:29
That being said, how can we help you help us? :laughing:

mboudreau
2019-04-25 02:51
@audun.halland ^ What he said. I'm personally committed in getting the rust binary done so we can stop having to spin up another binary in ruby, which is a pain, and then having to manage it all. Problem is time and that so many are already using what we have and we're constantly trying to fix issues and help those get started with Pact

uglyog
2019-04-25 04:32
@audun.halland I wrote the rust library to be a DLL that can be loaded into any language implementation. It is V3 compliant, and has the same features as Pact-JVM. It is ready to be used, but there may need to be some integration work to be done. The best way to help would be to try use it with another language (i.e. JS)

uglyog
2019-04-25 04:33
There is the #pact-rust channel

uglyog
2019-04-25 04:34
The roadmap has not been updated for a long time

audun.halland
2019-04-25 06:00
Thanks, I joined that channel. Can continue discussion there.

audun.halland
2019-04-25 06:12
I'm working with a node.js provider for the first time and then I noticed the problems with pact spec 3 with the ruby verfier CLI. So if pact-ruby is not going to be prioritized in the future, pact-node should probably use rust verifier-CLI/mock-server instead (ASAP?). But the rust DLL didn't appear very stable to me, hence the bug I reported about https pact broker. So two things I can contribute some time to: 1. Fix rust "DLL". 2. Rewrite pact-node to use that instead of ruby

matt.fellows
2019-04-25 08:09
I would suggest pact node stay as is (as it has utility separate to what the dll will provide) and it moves straight into Pact JS. We also don't really need another CLI for pact stuff and want to reduce the number of packages we need to maintain.

matt.fellows
2019-04-25 08:10
There are other gaps in the rust impl which I'll try to draw up later (and share my previous notes on the matter)

s1apped
2019-04-25 09:47
has joined #general

s1apped
2019-04-25 09:58
hello. Maybe you will be able to help. So I setup pact broker with jenkins and can-i-deploy and added webhook

s1apped
2019-04-25 09:58
contract_content_changed

s1apped
2019-04-25 09:58
but unfortunetally

s1apped
2019-04-25 09:59
provider build is being triggered everytime eventhough pact didn't change

bethskurrie
2019-04-25 09:59
Open the pact

bethskurrie
2019-04-25 10:00
In the browser. Click on the "view in api browser" button.

bethskurrie
2019-04-25 10:01
You'll find a relation in the api browser that says something like "diff previous distinct version". Click on the button to follow that relation.

bethskurrie
2019-04-25 10:01
You'll see what's changed.

matt.fellows
2019-04-25 10:03
@s1apped just check that if your consumer code is falling back on the test library (e.g. Pact JVM) to generate values for code, things like dates etc. might change - this will result in a contract changed event

s1apped
2019-04-25 10:04
I checked diff and it doesn't make sense it showed some old differences

s1apped
2019-04-25 10:04
I will investigate further than

s1apped
2019-04-25 10:04
thank you :slightly_smiling_face:

s1apped
2019-04-25 18:33
I made some investigation

s1apped
2019-04-25 18:33
there is no diff

s1apped
2019-04-25 18:34
i cleaned up everything and started from scratch

s1apped
2019-04-25 18:34
the pact file looks ok

s1apped
2019-04-25 18:34
the webhook and build is only triggered when

s1apped
2019-04-25 18:34
there is new commit on consumer side

s1apped
2019-04-25 18:35
when i run consumer build without a change nothing happens

s1apped
2019-04-25 18:35
to be hones I'm out of ideas..

joelbyler
2019-04-25 18:50
has joined #general

1490665859
2019-04-26 03:32
has joined #general

ashish.dubey91
2019-04-26 07:26
what?s the recommended way of doing provider verification when the provider may be aggregating responses from more upstream services (its providers?)?

bethskurrie
2019-04-26 07:27
this one is tricky to be honest

ashish.dubey91
2019-04-26 07:27
1. do you run instances of all the services in an environment and do a verification against them? 2. or run the provider against the mocks of the upstreams?

bethskurrie
2019-04-26 07:28
you can write pacts between the intermediate service and the downstreams and use them to verify the pact with the upstream... BUT it gets quite fiddly

bethskurrie
2019-04-26 07:29
tbh (and I say this as one of the main authors of pact) this is one of the hardest scenarios to use pact in.

ashish.dubey91
2019-04-26 07:29
yeah especially when we end up in a scenario, where we want to verify a pact that a consumer has written and to do that we have to write a pact between all services in the chain

ashish.dubey91
2019-04-26 07:30
I?m trying to figure out if we can ease this somehow for our teams

bethskurrie
2019-04-26 07:36
What languages are you using?

ashish.dubey91
2019-04-26 07:40
python mostly

ashish.dubey91
2019-04-26 07:40
and Java for one consumer

bethskurrie
2019-04-26 08:10
Which python impl?


bethskurrie
2019-04-26 08:52
So, here's one technique I've used, but it would require a little addition to the python code.

bethskurrie
2019-04-26 08:54
In the ruby code, you can create a pact request or response object outside of the dsl that is used to set up the mock. You make a fixture (not sure if the same term is used in python). Then, you use the same fixture to generate the downstream pact, and response to the upstream pact.

bethskurrie
2019-04-26 08:56
You have to "reify" the response object (turn it from the pact object with likes and matchers into a concrete example) to use it, and this bit of functionality isn't available yet in the python lib

ashish.dubey91
2019-04-26 09:01
do you have this as an example somewhere?

bethskurrie
2019-04-26 09:02
No, unfortunately it was for a client years ago.

bethskurrie
2019-04-26 09:02
If I get time, I'll see if I can recreate a simple example.

ashish.dubey91
2019-04-26 09:03
thanks a lot. I can imagine this a little bit, infact we tried something similar, but I want to sure it?s the same thing. I?ll share something from my end as well in a bit

ryan.wicken
2019-04-26 09:10
has joined #general

s1apped
2019-04-26 09:44
@bethskurrie @matt.fellows I created an issue and added some details


bethskurrie
2019-04-26 09:47
@s1apped do you have access to the logs?

bethskurrie
2019-04-26 09:47
If I put in some extra logging so that it indicated what it thought had changed would you be able to get to those logs?

s1apped
2019-04-26 09:47
I think I might be able to get it

s1apped
2019-04-26 09:48
I'm running the pact broker docker

bethskurrie
2019-04-26 09:50
Cool. I'll add the logging and let you know when it's out.

s1apped
2019-04-26 09:51
awesome

s1apped
2019-04-26 09:51
thank you

mokhtar.neifer
2019-04-26 10:32
has joined #general

joelbyler
2019-04-26 14:25
question, is it possible to use a standalone mock server to stand in and develop against?

joelbyler
2019-04-26 14:25
(in addition to running tests against)

yousafn
2019-04-26 14:46
It is, we run it in a docker container and load in a pact file. The container is then uploaded to ecr and run in ecs ( on AWS ) None of our dependencies are ready yet so this is the only way we can test our journies e2e through our ui

bethskurrie
2019-04-27 00:40
Pact peeps of all unit testing frameworks (just normal ones, not pact ones) - if you mark a test as pending, and it passes, does your test fail or pass? Please let me know in this thread.

bethskurrie
2019-04-27 00:40
In rspec, a pending test that passes, fails.

matt.fellows
2019-04-27 01:01
Skipped tests cause a suite to pass in most JS frameworks

matt.fellows
2019-04-27 01:11
What is a pending test that passes, exactly?

bethskurrie
2019-04-27 01:18
In rspec, you mark a test with "pending: true" in the metadata. It still runs, but if it fails, the test overall does not fail - it's like saying, I expect this to fail

kgrabowski
2019-04-27 09:02
has joined #general

joelbyler
2019-04-27 16:03
Ok, is there a good resource for learning how this can be done? The docker / aws part isn?t necessary. Just trying to do this locally for now. Also preferably with ruby.

joelbyler
2019-04-27 16:03
I see some instructions in the wiki for the ruby gem but I?m having trouble following. And it says no interactions match

joelbyler
2019-04-27 17:25
Oh, maybe the pact-mock_service gem?

yousafn
2019-04-27 19:40
Yeah chap, that is what we load into our containers. Pass it a pact file and it will mock the provider. You can use matchers to make the interactions less restrictive :ok_hand:

abubics
2019-04-28 03:52
In most frameworks I've used, pending tests don't get run :thinking_face:

bethskurrie
2019-04-28 03:53
interesting. rspec may be the outlier then.

bethskurrie
2019-04-28 03:53
you use "skip" or xdescribe if you don't want it to run at all.

abubics
2019-04-28 03:57
Ah... In that case, I think most frameworks don't have a distinction between pending and disabled :upside_down_face:

matt.fellows
2019-04-28 04:02
Yeah. It seems unusual, or at least, I?ve not come across it / needed it. I can see why a passing pending test would fail a suite in this case though

biaofu
2019-04-28 06:07
hi guys, in the past a few months, I saw several pots/discussions talked about "should it replaces e2e integration test with contract test?". We have some documents describes this topic, e.g. https://docs.pact.io/faq. I know the consideration to answer this question could be emanative, it depends on lots of uncertain factors, e.g. service environments, risk tolerance, even teams coordination. Some of my points are that both e2e integration tests and contract tests have their own pros & cons, usually, in common situations, I don't think one can or should be "replaced" with another. So, how do you guys personal feel about this question? Would like to hear any opinions from you. :slightly_smiling_face:

bethskurrie
2019-04-28 06:29
They replace a certain class of integration tests (eg the ones you do to make sure that you're using the API right). They don't replace the tests that ensure that the core business logic of your services is working.

bethskurrie
2019-04-28 06:30
Ideally, they should allow you to write fewer integration tests.

biaofu
2019-04-28 06:37
yes, the same opinion with you.

bethskurrie
2019-04-28 06:37
Do we say otherwise in the FAQ? Maybe it needs clarification.

biaofu
2019-04-28 06:43
I?m not so clearly understanding your ?otherwise? here, but we do mentioned the ?core business? in the FAQ, just not as straightforward as we chat here, haha

bethskurrie
2019-04-28 06:47
I'll have another look at the text.

biaofu
2019-04-28 06:48
Another thing people always talks about but never makes it clear is that when we talk about ?integration test?, whose integration tests are we pointing to? The consumer?s integration test or the provider?s integration test?

bethskurrie
2019-04-28 06:49
Either, I guess. Anything when the two systems are both up and running and calling each other.

biaofu
2019-04-28 07:17
let?s say, service A calls C constructing contract ?a2c?, service B calls C constructing contract ?b2c?, and whenever C is called, it will call its own dependence service D, then there is a contract ?c2d?. So, when we talk about ?should contract test for ?a2c? or ?b2c? replace their integration tests??, it?s not quite clear the ?integration test? is pointing to which services, A,B,C,D? Since the contracts ?a2c? and ?b2c? could have totally no overlap at all, then, we say, contract ?a2c? could replace some parts of ?the? integration test, let?s say it integration-test-a2c, the same, we have the integration-test-b2c, due to there is no overlap between these two collections of integration tests, both of them together construct a full collection of service C?s integration tests, which will call service D as well. So, in this cases, if we don?t point out whose integration test we are talking, it could be confusing. My understanding is, to a single service (it could be consumer or provider in different context), contract test is only Consumer concerned but Provider independent, while integration test is only Provider concerned but Consumer independent.

bethskurrie
2019-04-28 07:19
I'm afraid I got lost there!

biaofu
2019-04-28 07:19
I guess you will :sweat_smile:

simon.nizov
2019-04-28 08:20
@ashish.dubey91 @bethskurrie I would love to see those examples as well

joelbyler
2019-04-28 12:19
Thanks for the advice, I?m very new to this but excited to give it a go. Will try it out this week. :yay:

luchillo17
2019-04-28 16:39
has joined #general

luchillo17
2019-04-28 16:45
Hi, i'm trying Pact and i can't grasp yet how to test properly in the backend, say if i have a DB, should i just input the data the contract expects in my DB before the Pact contract verification?

hstene
2019-04-28 16:58
Yes, this is what states are for! :smile:


abubics
2019-04-28 23:56
ideally, stub out the DB, so you have fewer moving parts . . . but second choice is to seed the database :slightly_smiling_face:

abubics
2019-04-28 23:59
Diagrams to help this explanation :ok_hand: ``` A B \ / C | D ```

abubics
2019-04-29 00:01
there are 2 main categories of integrat*ed* tests . . . ones that make sure the real deployed services are talking to each other (smoke tests), and ones that make sure the "core business logic of your services is working", regardless of where they're deployed (integration)

abubics
2019-04-29 00:02
Pact doesn't intend to replace smoke tests, but it can/should mostly replace other integrated tests :slightly_smiling_face:

franklin.huynh
2019-04-29 01:06
Hi, I'm trying to apply can-i-deploy to our service using bitbucket pipeline. A bit of context, as our QA owns a container where we installed all the required packages/tools. In this, QA will easily enable/disable if it fails in the contract test. Our pipeline looks like this ``` branches: master: - parallel: - step: *unit-test - step: *security-test - step: *contract-test - step: *deploy-to-dev - step: *can-i-deploy-staging - step: *deploy-to-staging - step: *tag-staging - step: *can-i-deploy-production - step: *deploy-to-production - step: *tag-production ``` There is a 10 steps limitation in the pipeline that make me think about I should reduce the steps of contract test (there are 5 steps occupied in the above script). My question is do we have any best practise or recommendation to apply can-i-deploy?

biaofu
2019-04-29 02:17
@abubics, your opinion is quite clear, I like that. But I think the point, that to replace ?the other integrated tests which checking the core business logic?, is against to what @bethskurrie mentioned above, and our FAQ also.

biaofu
2019-04-29 02:29
Personally, I agree that Pact shouldn?t focus too much on the ?core business logic?, but only focus on ensuring Provider is responding to its Consumers correctly. To checking the core business logic, it?s the duty of those integration tests, no mater they are integrat*ed* (e2e) or not.

bethskurrie
2019-04-29 02:32
It's the duty of the provider's functional tests to make sure that its doing what it should. One mistake that often gets made is using the consumer as a test harness for the provider.

biaofu
2019-04-29 02:33
Yes, that?s definitely correct!:handshake:

bethskurrie
2019-04-29 02:33
Eg. It's not the consumer's job to make sure that when you do a post to a collection resource, that the new resource is properly created and then available in the collection

luchillo17
2019-04-29 03:35
I'm working with Neo4j, a graph based DB, i want to test with the DB to ensure the graph model is actually constructed correctly so i think i should seed the DB, hopefully it's faster (the DB is supposed to be 100x faster than RDBMS)

abubics
2019-04-29 03:54
yarr . . . contract tests are for the communication interface between systems (i.e. consumer and provider), not for actual business logic testing. That's what functional tests are for :ok_hand:

abubics
2019-04-29 03:56
so, I mean, you can :slightly_smiling_face: no one will stop you :stuck_out_tongue:

abubics
2019-04-29 03:57
but if you need a very large fixture, it's likely that your domain model is wonky

abubics
2019-04-29 03:58
if you want to assert things about content, rather than content shape, the contract is likely not what you're testing :slightly_smiling_face:

myao
2019-04-29 04:14
has joined #general

s1apped
2019-04-29 07:43
and contract didn't change

s1apped
2019-04-29 08:48
@bethskurrie I went through your response on github

s1apped
2019-04-29 08:48
If the pact's consumer version is tagged, then it looks for the latest version with each of the tags, and fires if the content has changed or if there was no previous version with that tag.

s1apped
2019-04-29 08:48
In my case consumer is tagged with branch name, there is a previous version

s1apped
2019-04-29 08:49
but contract didn't change

s1apped
2019-04-29 08:49
so if I understand correctly webhook shouldn't be triggered

andfadeev
2019-04-29 09:57
has joined #general

jonathan.ruckwood
2019-04-29 11:48
has joined #general

luchillo17
2019-04-29 16:10
I do want to test the content shape, but there's data that depends on other data, which is used in the query but not sent back to client, that's why i think i need to seed the DB

luchillo17
2019-04-29 16:11
Hey i know Pact is Consumer Contract Testing, is there a way to make it work as Producer Contract Testing?, like defining the Contracts from the Provider instead of the Consumer?

hstene
2019-04-29 16:41
I am not sure of what you are thinking of here? What is the end goal? What are you trying to test?

bheemreddy181
2019-04-29 17:29
Maybe like Generate a Schema from Provider API and validate each time the schema changes @luchillo17 ?

bheemreddy181
2019-04-29 17:32
@bethskurrie @matt.fellows similar to the above question - I felt like PACT does give a provision of breaking contracts if none of your consumers is using few fields from your API or not bothered if the type is changed? yet all ?

bheemreddy181
2019-04-29 17:33
What if I generated a schema from Provider side once I create my API and validate my API each time I do a change?

luchillo17
2019-04-29 17:39
I want the contract to be generated in the server & the client consumes that contract in their testing

luchillo17
2019-04-29 17:41
I want the server to dictate the shape of the data, generate the contract, upload it to the broker and then use it in the client, possibly even publishing the contract so external API's or third parties can develop with the contracts

bheemreddy181
2019-04-29 18:32
@luchillo17 what if you are changing the contract - that is something which is expected by the consumer then you generate it but the consumer expectations fails and you still want to release it

bheemreddy181
2019-04-29 18:33
the main reason of PACT is to have Integration to happen earlier get the feedback faster on each PR itself if the are changing some expectations of Consumer

bheemreddy181
2019-04-29 18:34
Syntactically - than Semantics of what the value is and how the values is generated

luchillo17
2019-04-29 18:35
I would expect the contract to change only when the API changes, and the Client would adapt to that change, our app is DB heavy so most business logic would go in the Back End

bheemreddy181
2019-04-29 18:37
How does you expect client to adapt the changes untill unless you know what client uses

bheemreddy181
2019-04-29 18:39
which might also lead to having just one version of the API unless needed

luchillo17
2019-04-29 18:40
Let me see if i understand correctly how PACT is supposed to work (as far as i've read): Client defines it's test along with the expected request & response, generating a Contract, then API would load the Contract in it's test and use that to assert the expected request & response If the client changes the expected request/response then the contract changes & the API test could fail, in such case the API is expected to make changes to comply with new contract Somethink like that?

bheemreddy181
2019-04-29 18:41
it is two way not only from the Client ( Consumer ) Side

bheemreddy181
2019-04-29 18:42
even if the providers changes the API - he would know he is breaking a consumers expectations on a particular or set of fields

bheemreddy181
2019-04-29 18:44

pascal.wilbrink
2019-04-29 20:33
has joined #general

pascal.wilbrink
2019-04-29 20:34
Hi all

biaofu
2019-04-30 01:56
hi @luchillo17, if you really want to define the contracts at provider side and use the contracts to test your provider service, then, you are probably duplicating the functional test, not contract test to the provider. Actually, the quintessence of contract test is ?customer driven?, if you can?t manage to achieve that due to some reality reasons, e.g. team communication, network boundary, Pact won?t bring you more benefits than functional tests. Or, another option is, maybe, you can look at Spring Cloud Contract, another implementation of contract test, which create the contracts from provider side.

kevin.meiresonne
2019-04-30 07:57
I'd say "consumer driven" rather than "customer driven"

biaofu
2019-04-30 08:24
yes, consumer driven :sweat_smile:

abubics
2019-04-30 08:27
when you say > data that depends on other data it sounds like you might be testing behaviour through concurrent calls :thinking_face: if that's not what you mean, please explain your use case a bit more :slightly_smiling_face:

bethskurrie
2019-04-30 10:00
Exactly

bethskurrie
2019-04-30 10:02
consumer contracts remove the need to version an API. API versioning is a "work around" because you don't want to break backwards compatibility, and you don't know who is using your API. It's the best technique for a public API. When you know all your consumers, and you know exactly what they're using, you know the impact of changing, and hence, you should be able to avoid versioning the API.

bheemreddy181
2019-04-30 12:28
@bethskurrie ^

bheemreddy181
2019-04-30 13:40
Completely agree :)

bheemreddy181
2019-04-30 13:41
What I meant is documentation driven contract testing

bheemreddy181
2019-04-30 13:41
Where you create a base schema and validate the change against it

bheemreddy181
2019-04-30 13:42
I think this would be again good for public api where you don?t know the consumers

luchillo17
2019-04-30 16:20
Hey @bheemreddy181 I've looked at the document you sent and it makes a lot of sense, i wanted the contract to be defined in the Producer (API) because my back end devs are way more knowledgeable about the business logic, guess i'll have them help the front guys with the tests. thanks.

bheemreddy181
2019-04-30 16:21
Cool - have a great contract testing

qatrera
2019-04-30 16:32
If I understood Contract testing correctly, we shouldn't use this kind of testing to test the business logic but to verify the interfaces of your application

qatrera
2019-04-30 16:32
to test your business logic you have unit/integration tests

luchillo17
2019-04-30 16:50
Yes, i just wanted to have the same guys that know the backend to design the contract for the interfaces

bheemreddy181
2019-04-30 17:18
@qatrera Unit and Functional Tests -- Shift left to decrease the level of Integration tests - The main intention of having PACT is to release micro-services independently

luchillo17
2019-04-30 19:11
Yeah sorry my english isn't the best, let me try with an example, to test 1 of the end points i need to have an user, have data in the DB, the user is related to a set of the data, and the data i need is related to that set, say for example a teacher who has courses and each course for that teacher has students, if i need the students for a teacher i have to go through the course, while ensuring students of other courses are not returned (Btw this is an example, not my actual application)

matt.fellows
2019-04-30 22:07
@luchillo17 we?re looking at how we introduce Swagger/provider-driven testing into our Pact broker offering (http://pactflow.io). Stay tuned :slightly_smiling_face:

evgone
2019-04-30 22:57
has joined #general

bheemreddy181
2019-04-30 23:20
@matt.fellows can you explain that ?

bheemreddy181
2019-04-30 23:21
Swagger or provider driven testing mean generating a schema from provider and keep testing against that each time there is a change ?

stipud
2019-05-01 00:17
has joined #general

biaofu
2019-05-01 02:53
I?m also doubting what the benefits it will bring from the Swagger/Provider-driven testing? Test which service? provider or consumer? If it helps to test the provider, then it would just be a functional (integration, maybe) testing at the provider side, if it helps to test the consumer, then the contract from Swagger could only be used as a stub to a mock service, then consumer can talk to such mock service to do an integration test, is that the purpose? If so, that?s what Spring Cloud Contract exactly doing.

biaofu
2019-05-01 02:53
That is not contract testing, but ?integration testing based on contract?.

matt.fellows
2019-05-01 03:05
I'll explain later, but rest assured we wouldn't suggest it if it wasn't possible to validate both sides of the contract (in this case the OAS spec)

bheemreddy181
2019-05-01 03:44
your inputs on this will be appreciated @bethskurrie - i am still learning so making basics strong

abubics
2019-05-01 04:15
So, in this example, you want to test one API endpoint (provider) that makes 3 db requests, and transforms them into a response?

abubics
2019-05-01 04:16
It's not the contract test's job to ensure data integrity between calls (in the "while ensuring students of other courses are not returned" example)

abubics
2019-05-01 04:16
That's more of a functional or unit test responsibility :slightly_smiling_face:

luchillo17
2019-05-01 18:24
Hmm has Pact some plugin to make it work with Apollo-Client?

uglyog
2019-05-01 23:27
There has been some discussion about whether you need something like Pact for GraphQL. But there is probably no direct support for it.

bethskurrie
2019-05-01 23:55
@luchillo17 re getting your back end and front end teams working together - absolutely! Pact is not meant to be a replacement for good communication between teams. It's meant to help facilitate it. Never stop talking! Tests don't replace talking.

joostvanwollingen
2019-05-02 11:45
has joined #general

luchillo17
2019-05-02 16:00
Thansk guys, this thread is an eye opener for me.

drewbailey5
2019-05-02 17:10
has joined #general

drewbailey5
2019-05-02 17:32
cross posting from #pact-go, Hello! has anyone ever worked with building query params to allow for the rails flavor of arrays in params? `names[]=ENV1&names[]=ENV2`

audun.halland
2019-05-02 18:32
I?ve used it with the client, and I?m able to create contracts with it. Requires no plugin.

audun.halland
2019-05-02 18:36
Although I had to turn off typenames from the query in order to make it work the way I wanted to

matt.fellows
2019-05-03 01:33
:slightly_smiling_face:

detert
2019-05-03 13:13
has joined #general

felipe.faust
2019-05-03 14:43
has joined #general

zach.the.hammer
2019-05-05 01:28
Congrats to @bethskurrie, @matt.fellows and the rest on the pactflow launch! I havent posted here in a while but have been seeing all the pactflow tweets- seems awesome

jonathanparkeremail
2019-05-05 03:39
has joined #general

simon.nizov
2019-05-05 08:53
Do you mean registering an interaction that has these types of query params?

matt.fellows
2019-05-05 10:35
Much thanks @zach.the.hammer - as you?ll have noted, we haven?t announced here properly yet, but it?s coming :slightly_smiling_face:. Appreciate this though!!

zach.the.hammer
2019-05-05 14:29
Ahhh ok. I just have been seeing the tweets

zach.the.hammer
2019-05-05 14:29
Hope i didnt jump the gun

matt.fellows
2019-05-05 20:55
Not at all. I think publicly tweeting about something probably counts for an announcement of sorts :grinning:

s1apped
2019-05-06 07:19
@bethskurrie I run pact broker in debug mode and did some more troubleshooting. I wonder if you can could take a look what I found and if it's not a problem point me to right direction since the log message doesn't make much sense to me unless I'm missing something..

bethskurrie
2019-05-06 07:19
Hi Matthew. I had a quick look at your logs the other day, but haven't had a chance to debug the code.

bethskurrie
2019-05-06 07:20
It does seem like it's doing something unexpected.

s1apped
2019-05-06 07:25
Hi. thanks :slightly_smiling_face: let me know if I could be of any help

simon.nizov
2019-05-06 12:10
Quoting from https://medium.com/@dius_au/closing-the-loop-with-pact-verifications-a7d590ab2f5c > The Pact Broker is smart enough to work out whether the pact content has changed or not, so if a pact is published with the same content as a previous one, it will inherit the same verification results???we call this being ?pre-verified? For some reason my verification results aren?t inherited from previous builds like described. They don?t automatically appear in the matrix on lines of new-but-unchanged pact versions, resulting in ?holes? in the matrix on the provider side. The results appear only after I?ve manually triggered the provider build. I don?t have the webhook enabled yet, is that the issue?

matt.fellows
2019-05-06 12:30
It shouldn?t do. If the contract itself hasn?t changed and has previously been verified, then new consumer versions should also be safe.

matt.fellows
2019-05-06 12:31
There was a thread in pact broker about this issue recently that might be worth having a look at, where @s1apped was running into issues. Might be worth getting across just in case


matt.fellows
2019-05-06 12:58
That?s the issue that was a result, but a lot of conetxt was in the convo

294simon
2019-05-06 13:20
has joined #general

simon.nizov
2019-05-06 13:25
Followed Beth?s suggestion to check `diff-previous-distinct` - didn?t even know this exists. Turns out my consumer?s test suite includes a couple of dynamically generated ID?s in one of the pact interactions, hence the ?change? in the pact. Thanks! :smile:

simon.nizov
2019-05-06 13:25
This is a nice ?gotcha? I think. Is it documented anywhere?

matt.fellows
2019-05-06 13:27
awesome to hear you got to the bottom

matt.fellows
2019-05-06 13:27
Umm, it probably is, but if you didn?t find itt readily I?m sure others wouldn?t have either

christopher.f.almanza
2019-05-06 20:08
has joined #general

christopher.f.almanza
2019-05-06 20:10
Hey guys

christopher.f.almanza
2019-05-06 20:13
Is there any documentation or threads about polymorphic endpoints?

christopher.f.almanza
2019-05-06 20:14
Maybe that's not the correct words. I suppose an example would be better: a `GET /favorites` where you have 2 or 3 different entities that you can favorite


matt.fellows
2019-05-06 21:14
Responded just now. TL;DR - provider states

christopher.f.almanza
2019-05-06 21:15
@matt.fellows Hmm, maybe the example I gave was a bit misleading.

christopher.f.almanza
2019-05-06 21:16
What I meant to say was that both Books and Movies have completely different JSON properties

christopher.f.almanza
2019-05-06 21:16
Would provider states still be the solution? I can think of making provider states like: - `when it returns books` - `when it returns movies`

christopher.f.almanza
2019-05-06 21:17
But can I really trust that when it returns both books and movies, the schema will still be good...

christopher.f.almanza
2019-05-06 21:17
Not sure what to do here

matt.fellows
2019-05-06 21:19
sorry yes, I?ve updated the SO to reflect that

matt.fellows
2019-05-06 21:19
And yes, I believe they would

christopher.f.almanza
2019-05-06 21:20
thank you!

matt.fellows
2019-05-06 21:20
Another alternative (which is possibly more brittle) is that you expect the specific payload response which has one of every example

matt.fellows
2019-05-06 21:21
it means you can?t use a top-level matcher to say _all_ of the objects look like _this_, but instead the response needs to be more exacting. This means you can be sure your code can handle both simultaneously

christopher.f.almanza
2019-05-06 21:21
kind of harcoding the exact response instead of `somethingLike()` ?

matt.fellows
2019-05-06 21:21
exactly

christopher.f.almanza
2019-05-06 21:21
That also makes sense

christopher.f.almanza
2019-05-06 21:21
I'll go for the first approach since it's easier to explain to teammates

matt.fellows
2019-05-06 21:21
you can still use the like matchers at the field level, but in your case you?d need exactly 2 objects in the favourites array (assuming only two types)

matt.fellows
2019-05-06 21:21
i think so

vipin.gaba
2019-05-07 05:25
has joined #general

rune
2019-05-07 07:29
has joined #general

stephane.colson
2019-05-07 09:14
has joined #general

kevin.meiresonne
2019-05-07 12:20
Hi all, Recently I got the following request: "Given we have a UI (Consumer) and an API (Provider), which are deployed/released independently. A new feature in the Consumer requires calling a new endpoint on the API. However, because the release schedules of the Consumer and Provider are vastly different, they want to release the Consumer before the Provider. The Consumer would then check at runtime if its Provider already exposes the new endpoint. Once it does, it would expose the new feature, if not, it would hide it." Although I kind of understand this request, I don't see how we could fit this into the Pact "workflow", that would disallow shipping the Consumer since its contract with the Provider would not be fulfilled (because Provider changes would be released later). Did someone ever come across a similar request?

detert
2019-05-07 12:55
Hi all, what is the best practice to transfer pact files from my `https://github.com/pact-foundation/pact-mock_service` to `https://github.com/pact-foundation/pact_broker`? What I understand that `POST /pact` writes the pact file somewhere in the mock service, but what is the best way to publish that file to the broker?

simon.nizov
2019-05-07 12:56
What language are you using?

detert
2019-05-07 12:57
php currently

detert
2019-05-07 12:57
But a general example with curl or something will help as well

simon.nizov
2019-05-07 12:59
Generally speaking, after running your consumer test suite, a pact json file should be created. You can then use: https://github.com/pact-foundation/pact_broker-client ?to publish that pact file to the broker

simon.nizov
2019-05-07 13:00
In some implementations there are other ways of publishing the pact, not sure about PHP

detert
2019-05-07 13:01
What I do not understand at this point: I run the consumer test with the pact-mock-service. I think that the mock-service should provide the pact file which I have to transfer to the pact broker. Is that correct?

nick.karamaniolas
2019-05-07 13:05
has joined #general

qatrera
2019-05-07 13:08
If the tests run successfully the pact file would be autogenerated locally (I am assuming there is a configuration in the PHP Pact version to set the local path to store the files). After that, you have to share this file with the Pact Broker. I'm not sure about the Pact tooling in PHP but I guess that a `scp` to your Pact Broker server should work

detert
2019-05-07 13:22
Well, I understand the idea. However I have no idea how to retrieve the pact file. The only way I found so far is POST /pact to the pact-mock-service, but that writes the pact file on disk. That does not sound very promising, as I have to grep that file from disk and send it to the pact-broker. Maybe I do miss something important here.

simon.nizov
2019-05-07 13:25
You are going to need to get it from the disk anyway, as part of your CI process.

simon.nizov
2019-05-07 13:25
Regarding the PHP side, you should ask in #pact-php

detert
2019-05-07 13:26
Alright. I hoped that there is a way to fetch the pact file via GET request

detert
2019-05-07 13:26
Thank you very much for your help. Both of you

matt.fellows
2019-05-07 13:40
The pact broker is completely API driven, so you can definitely use curl etc to fetch it



matt.fellows
2019-05-07 13:42
Basically there are a tonne of options and it's fairly trivial work

matt.fellows
2019-05-07 13:44
Hmm will have to think about this. A bit like a feature toggle

detert
2019-05-07 13:45
Well I struggle with the mock service. I am not able to retrieve the pact file nor find it in the docker container

detert
2019-05-07 13:46
the pact-broker is the next step I think

matt.fellows
2019-05-07 13:48
Why are you dealing with the mock service directly? Doesn't php provide an interface over it? It should basically be hidden to you

detert
2019-05-07 13:50
The documentation states "This library contains a wrapper for the Ruby Standalone Mock Service.", that is "https://github.com/pact-foundation/pact-mock_service" and so I started the available docker container "https://github.com/pact-foundation/pact-mock-service-docker". I guess that is as told

matt.fellows
2019-05-07 13:54
Where in the php docs does it say you need to install the mock service yourself? And if so, you shouldn't have to interact with it directly

matt.fellows
2019-05-07 13:55
It is the wrapper for it, that's the whole point! :laughing:

detert
2019-05-07 13:58
Well that might be the mistake. In that case, I do not really understand the section "Start and Stop the Mock Server"

detert
2019-05-07 13:59
But as you write this, maybe I just have to try `$server = new MockServer($config);` and ` $server->start();`

detert
2019-05-07 14:36
Alright that works well. Thank you :slightly_smiling_face:

kevin.meiresonne
2019-05-07 14:48
Yeah, it is pretty much

bheemreddy181
2019-05-07 16:20
Team , Here is the use case - if my consumer is consuming a field as Int and the provider now wants to do the change the UUID type - So can some one help me with the workflow using pact like who should go first ?

detert
2019-05-07 16:38
As far as I understood the documentation: Should the consumer care about the id format at all?

bheemreddy181
2019-05-07 18:16
they should in this particular case

bheemreddy181
2019-05-07 18:20
Given if the consumer is assuming that it is always Integer but provider wants it to change the same to UUID

matt.fellows
2019-05-07 21:58
I would follow the flexible schema strategy. The provider should first add the new field and deploy it (without removing existing field, it should have a ney key) The consumer should then transition to using the new field The provider can then remove the old

matt.fellows
2019-05-07 21:58
Contracts aside, this is how you do it.

matt.fellows
2019-05-07 21:59
Haha np

matt.fellows
2019-05-07 22:00
It all sounded too hard. Perhaps we need a note in there to say the it manages it for you. Or just remove it altogether as it's implementaion detail

ivan.cherkashnev
2019-05-07 23:07
has joined #general

bheemreddy181
2019-05-08 00:17
doesn't consumer start consuming both types and once provider changes to UUID type then modify tests to accept only UUID type ?

matt.fellows
2019-05-08 00:22
Well, once the provider is in production with the new field, the consumer can safely transition straight to the new field - no need for it to consume both. But there may be important context I?m missing here, and if it makes sense to have both then I don?t see an issue with that

bheemreddy181
2019-05-08 02:43
Naming the field would be pain again here

matt.fellows
2019-05-08 02:48
what do you mean? Because you?d like to use the same field name?

bheemreddy181
2019-05-08 03:04
@bethskurrie your thoughts on this ?

biaofu
2019-05-08 03:26
some thoughts from mine: given provider already has the pact test against the contract between that consumer, usually, this kind of contract testing should always runs on some lower environment. Let?s say, provider has multiple environments, env-dev, env-test, env-contract, env-pre-production, env-production, env-dev for provider development, env-test for provider functional test, env-contract for running pact test, env-pre-production for internal share with other consumers, and lastly, env-production for real production. Then, provider could firstly complete their change and functional test in dev and test env, then, deploy to contract env to run pact test, and obviously, failed, then communicate with consumer team about the new change, the two teams need discuss when their change would be deployed together, this is most important, depends on the teams, neither Pact nor any kinds of testing.

biaofu
2019-05-08 03:29
and in real practice, another better way is that provider could have more envs, which contains two different versions of the provider( Int and UUID), then, it?s more easier for provider and consumers to switch their works independently.

bethskurrie
2019-05-08 06:45
Bheem, it depends if you want to take Matt's recommended approach (which I would also recommend) or whether you want to make a breaking change. I'd recommend changing the id field to "uuid" so that you can have both at the same time. Much easier to handle.

bethskurrie
2019-05-08 06:48
If you really want to change the field, you'll need to deploy to prod a version of the consumer that knows how to handle both the int and the string id.

bethskurrie
2019-05-08 07:10
> What if I generated a schema from Provider side once I create my API and validate my API each time I do a change? If you generate a swagger document, you can verify your pact against it using Atlassian swagger validator tool. You can ask about it in the #swagger-validator channel

detert
2019-05-08 07:25
Well. The statement "This library contains a wrapper for the Ruby Standalone Mock Service." confused me, because I assumed that I need to start that service myself. What is missing is a simple example that creates a pact files and publishes that pact file to the broker, however I found a solution for that for the first trial run

stein
2019-05-08 08:04
At sainsburys we do what Matt suggests. We prefer to evolve the schema by adding new fields against versioning (most of the time) which typically involves multiple deployments - for us it's important to provide a backwards compatibility guarantee to consumers - you don't want to be synchronising releases across consumer/provider. It gets a bit trickier when you have mobile app consumers - users might have old versions of the app and you'd need to force upgrade to roll out the old field. We have duplicate fields running in prod and we are fine with that. It just takes some diligence to keep on top of it.

biaofu
2019-05-08 08:20
yes, that?s a good approach

cmcgowan-smyth
2019-05-08 09:07
has joined #general

braddle
2019-05-08 10:08
has joined #general

bheemreddy181
2019-05-08 13:51
Yes @matt.fellows Same field name , sorry i missed your message

noel.yap_slack.pact.i
2019-05-08 16:41
has joined #general

matt.fellows
2019-05-08 22:14
I would recommend against the re-using field approach because of the need to couple deploys between systems that use it. The evolutionary approach is the generally accepted way to do this sort of change. In my experience, changing a field name / definition is rarely an urgent thing that needs to be rushed

james.prescott
2019-05-09 09:09
has joined #general

james.hattersley-dyke
2019-05-09 11:11
has joined #general

mindy.or
2019-05-09 16:44
has joined #general

anton.taranovskyi
2019-05-10 08:15
has joined #general

james.hattersley-dyke
2019-05-10 11:10
Not sure if this has been asked before if someone could point me in the right direction of an answer. Is it possible to do partial response matching in the `willRespondWith: { field1, field3} `. The api actually returns 3 fields, but I'm only interested in 1 and 3... I've had my provider pacts fail because of this... is this possible or do I have to specify the whole response but using `like(...)` for the fields I'm not interested in?

matt.fellows
2019-05-10 11:39
yes it?s been asked and yes you can definitely do that

matt.fellows
2019-05-10 11:39
in fact, that is the _right_ way of writing Pact tests. You should only test and specify the fields you actually use - not all of the possible fields of the Provider


james.hattersley-dyke
2019-05-10 11:44
cool, what's does this have a name? I've read all the docs on flexible matching etc?

james.hattersley-dyke
2019-05-10 11:44
are there any repos with examples of it?

matt.fellows
2019-05-10 11:46
ummm, I?m not sure. You just specify the subset of fields you need in the consumer tests and on the provider side, if there are more fields they are simply ignored

matt.fellows
2019-05-10 11:46
You could fairly easily modify any of the pact js examples to return more fields and they should continue to pass

james.hattersley-dyke
2019-05-10 11:47
ah right, I'll take another look then, I was pretty sure the provider tests failed because it returned more then the consumer was asking for...

matt.fellows
2019-05-10 11:48
if it did, there is either a serious bug in Pact or something else misconfigured

james.carman
2019-05-10 11:48
Maybe it?s a different failure

matt.fellows
2019-05-10 11:49
If you have the pact-js repo about, just add some more fieldss to https://github.com/pact-foundation/pact-js/blob/master/examples/e2e/data/animalData.json and run the tests

james.hattersley-dyke
2019-05-10 11:49
i'll have another look - most likely I'm doing something wrong

james.carman
2019-05-10 11:49
Be sure you?re asserting types , not values

matt.fellows
2019-05-10 11:49
:point_up:

james.hattersley-dyke
2019-05-10 11:49
yeah I will, cheers chaps

james.hattersley-dyke
2019-05-10 11:49
I've only been playing with Pact a week so likely user error :slightly_smiling_face:

james.carman
2019-05-10 11:49
The values provided are for the mocks

james.carman
2019-05-10 11:50
That was confusing to me at first

matt.fellows
2019-05-10 11:52
?user error? is usually ?poor docs? - so now is the time to articulate all of the things we didn?t make clear before it becomes ?normal?

matt.fellows
2019-05-10 11:52
thanks for sharing / asking, many will just move on - this is good feedback

james.hattersley-dyke
2019-05-10 11:53
cool, ok - i'll take another look at my tests and see if I'm doing something wrong

james.hattersley-dyke
2019-05-10 11:53
I'm using a nodeJS consumer calling a Spring Boot provider..

erkan.deveci
2019-05-10 20:43
has joined #general

brwhaley
2019-05-11 01:25
has joined #general

elvis.uagbor
2019-05-11 23:02
has joined #general

s1apped
2019-05-13 07:02
Hi @bethskurrie did you have time to look into this issue?:)

amaano.dev
2019-05-13 09:14
has joined #general

mark.smith
2019-05-13 13:07
has joined #general

phall
2019-05-13 17:19
has joined #general

scott.riley111
2019-05-13 17:33
has joined #general

kristofer.landgren
2019-05-14 07:39
has joined #general

asite-rshah
2019-05-14 09:45
if pact provider side build is failure then how to push latest pact file to pact brocker ?

oswald.quek
2019-05-14 09:48
hello. for our consumer builds I've upgraded the `pact-jvm-consumer-junit_2.12` library to version 3.6.7. This seems to have the effect of not publishing "null" values. for example, we have a pact at https://github.com/alphagov/pay-publicapi/blob/master/src/test/resources/pacts/publicapi-connector-get-payment-with-gateway-transaction-id.json#L63-L64 but what actually now gets published is ```"settlement_summary": {}``` This is :ok_hand: except that the provider tests now fail because our provider endpoint actually returns ``` "settlement_summary": { "capture_submit_time": null, "captured_date": null }``` so the matching fails. however they're actually equivalent. is there a way to relax this matching? from https://docs.pact.io/getting_started/matching/gotchas, it seems the behaviour now doesn't follow Postel's Law: ```Be liberal in what you accept - when verifying a pact in the provider project, the response body and headers may contain fields that were not defined in the expectations, on the assumption that any extra field will be ignored by your consumer. This allows a provider to evolve without breaking existing consumers.```

oswald.quek
2019-05-14 09:54
I suppose I could always fix my provider to never include null values

oswald.quek
2019-05-14 09:56
actually that's what I'll do. no response required!

matt.fellows
2019-05-14 10:11
I'm confused, the pact file should he pushed after a consumer build, not a providers

matt.fellows
2019-05-14 10:12
Can you pls elaborate?

bethskurrie
2019-05-14 10:13
@oswald.quek that change in behaviour sounds like a bug. Can you raise it please?


bethskurrie
2019-05-14 10:41
Thanks.

rafael.anachoreta
2019-05-14 13:44
Hey! I?m interested in opening a new feature request, but I?m not entirely sure how to proceed. This is something that I can see being added to potentially every pact implementation, so I?m not sure where to open an issue for it. Details can be found on this thread: https://pact-foundation.slack.com/archives/C9VBGLUM9/p1549448375093500?thread_ts=1549377207.091900&cid=C9VBGLUM9 Can anyone point me on the right direction? Thanks! :slightly_smiling_face:

christophe.leray
2019-05-14 15:42
has joined #general

blyman
2019-05-14 18:52
has joined #general

tyoder
2019-05-14 19:00
has joined #general

konrad.winkler
2019-05-14 19:16
has joined #general

eran.bergman
2019-05-14 22:05
has joined #general

jhoag
2019-05-14 22:52
has joined #general

bheemreddy181
2019-05-15 03:19
Does Publish_Verification_results when contract is verified should happen only when the verification is triggered from Consumer end - because we run the verification against master of provider ? @matt.fellows

matt.fellows
2019-05-15 03:47
No, verification results are published only on the provider side when the provider tests are run, only when the pacts are fetched from the broker and only when the relevant flag is set to do so

matt.fellows
2019-05-15 03:47
can you elaborate?

bheemreddy181
2019-05-15 03:49
If the pact is verified from the provider PR this will result in ambiguity I feel because the Provider PR will verify the results and the consumer when says can I deploy he will get a true but provider didn?t merge the PR yet

bheemreddy181
2019-05-15 03:54
@matt.fellows ^

matt.fellows
2019-05-15 04:00
Well, that?s where tags come in Bheem

matt.fellows
2019-05-15 04:01
You should set it up so that features aren?t tagged ?master? (or whatever tagging scheme you go with). When you release, you query can I deploy using tags, rather than latest (which could be any branch/feature)


bheemreddy181
2019-05-15 04:02
Page is broken

matt.fellows
2019-05-15 04:03
Ah no, my stupid keyboard (repeats)


the.trav
2019-05-15 04:58
has joined #general

the.trav
2019-05-15 05:00
@matthew.balvanz and Co, thanks for pact-python. I just got it going in less than 10 minutes. It's super fast and I didn't have to change my test framework :thumbsup:

matt.fellows
2019-05-15 05:04
Thanks for the feedback @the.trav!

davidmolinero.com
2019-05-15 08:06
has joined #general

davidmolinero.com
2019-05-15 09:07
Hello, in which languages is V3 PACT specification for async messaging working fully E2E?

bethskurrie
2019-05-15 09:07
js

bethskurrie
2019-05-15 09:07
jvm

bethskurrie
2019-05-15 09:08
ruby consumer

bethskurrie
2019-05-15 09:08
I think that's all

davidmolinero.com
2019-05-15 09:08
even the bit of publishing the verification results back to the broker in js & jvm?

davidmolinero.com
2019-05-15 09:11
I've tried without too much success in ruby using this library https://github.com/reevoo/pact-messages/ but it is using V2 under the covers and I am struggling to get the verifications results published to the covers

bethskurrie
2019-05-15 09:11
it's not the same one

bethskurrie
2019-05-15 09:11
not an official version.

davidmolinero.com
2019-05-15 09:12
yes I know, I became aware of it after doing a spike

bethskurrie
2019-05-15 09:12
in js the verification publishing is the same codepath as the http verificaiton publishing.

bethskurrie
2019-05-15 09:12
so yes, it should work.

bethskurrie
2019-05-15 09:12
@matt.fellows?

davidmolinero.com
2019-05-15 09:13
I also took at the code for the js implementation and I saw some references to directories for fetching the json contracts so I am not sure if it will work with the broker

bethskurrie
2019-05-15 09:13
What languages do you want? The ruby one is actually implemented end to end, however, there isn't a DSL to expose it verification step because nobody uses Ruby anymore

davidmolinero.com
2019-05-15 09:14
we would like to use it with python & ruby at the moment (I know in python it is not supported)

bethskurrie
2019-05-15 09:14
JS message pact definitely works with the broker.

matt.fellows
2019-05-15 09:15
Yep. Pact JS and Pact Go definitely implement the messaging interface. I believe Pact PHP does also

matt.fellows
2019-05-15 09:15
Verifications should work consistently across HTTP or messaging

jon.pascoe
2019-05-15 09:15
I disagree that ?nobody uses ruby anymore? :stuck_out_tongue:

davidmolinero.com
2019-05-15 09:15
most likely we will workaround it using HTTP under the covers for the time being...

davidmolinero.com
2019-05-15 09:16
I'll take a look T the JS implementation then

davidmolinero.com
2019-05-15 09:16
thank you

bethskurrie
2019-05-15 09:16
I use Ruby! But I am assured by all around me that it is effectively COBOL.

davidmolinero.com
2019-05-15 09:17
most of ruby folks are moving to elixir nowadays :slightly_smiling_face:

bethskurrie
2019-05-15 09:18
I have heard that.

heymega
2019-05-15 09:19
I'm just looking at PactFlow and I'm a little confused Is PactFlow just a managed broker? If so, how does it differ from the existing broker we've come to know and love?

matt.fellows
2019-05-15 09:19
Hey @heymega, let?s chat over in #pact-broker if that?s OK?

jon.pascoe
2019-05-15 09:20
Stay strong @bethskurrie - Ruby FTW

heymega
2019-05-15 09:20
Sure!

bethskurrie
2019-05-15 09:20
Well, the broker is written in ruby, and that's not going anywhere.

james.hattersley-dyke
2019-05-15 12:45
if a provider has multiple consumers (I've not got this far yet) but does running `can-i-deploy --pacticipant my-provider` verify all the pacts with all consumers?

matt.fellows
2019-05-15 13:00
by default it will, yes

james.hattersley-dyke
2019-05-15 13:04
brilliant, I've only got 1 consumer and 1 provider right now so wasn't sure.

james.hattersley-dyke
2019-05-15 13:07
What happens then, when the provider team think 'oh these fields might be useful let's add them..' and release a new version of their API with no one consuming it? I'm assuming this _shouldn't_ happen given we're supposed to be following Consumer driven design?

bart.schotten
2019-05-15 13:09
Adding fields should always be allowed

james.carman
2019-05-15 13:10
Yep, new stuff should not impact your existing consumer pacts.

james.carman
2019-05-15 13:11
That?s why it?s very important not to do ?schema? type tests in your consumers and only focus on exactly what you need or care about

james.carman
2019-05-15 13:11
No ?this and only this? type tests.

james.hattersley-dyke
2019-05-15 13:11
right, cool. I'm preparing a demo from a spike I've worked on so swotting up on likely questions...

james.carman
2019-05-15 13:12
I gave a talk a while back and did the same thing. These folks were super helpful!

james.hattersley-dyke
2019-05-15 13:13
would you mind looking over my slides when I'm done - Make sure I'm talking sense?

james.carman
2019-05-15 13:14
Sure. I?m giving a talk at our company today (not on pact in particular), so I?m busy this morning, but I?d be glad to give you a second pair of eyes. Fair warning, I would not consider myself an ?expert? by any means (there are far smarter folks here than me). :slightly_smiling_face:

james.hattersley-dyke
2019-05-15 13:14
so, the api team add a load of new fields to a particular response but no-one is using them, providers build don't generate new contracts, right? It's just a new version of the API and no changes to contracts?

james.carman
2019-05-15 13:14
Providers don?t generate new ?pacts?, is what you mean?

james.hattersley-dyke
2019-05-15 13:15
yeah exactly that

james.carman
2019-05-15 13:15
Providers don?t generate pacts

james.carman
2019-05-15 13:15
Only consumers

james.hattersley-dyke
2019-05-15 13:15
yeah - thought so

james.carman
2019-05-15 13:15
Providers *verify* the pacts generated by the consumers

james.hattersley-dyke
2019-05-15 13:15
yep

james.carman
2019-05-15 13:15
hence the ?consumer-driven? part of it.

james.carman
2019-05-15 13:15
It?s a bit of a mind shift (it was for me)

james.hattersley-dyke
2019-05-15 13:15
there's a lot of moving parts and the docs are great, but yeah... mind shift like you say

james.carman
2019-05-15 13:16
I believe Spring Cloud Contract does take the opposite approach, IIRC

james.carman
2019-05-15 13:16
The provider publishes its contract and consumers test against it.

james.hattersley-dyke
2019-05-15 13:16
what blockers did you guys find to getting this part of the dev process?

james.hattersley-dyke
2019-05-15 13:16
ahh was maybe gonna look at Spring Contracts

james.carman
2019-05-15 13:17
The big roadblock for us was hosting the thing. We aren?t a ruby shop and our ops folks weren?t jazzed about hosting it. Luckily, the fine folks here do have a hosted offering! Problem solved. We?re happily pact brokering now.

james.carman
2019-05-15 13:17
this is not a paid endorsement

james.carman
2019-05-15 13:17
:slightly_smiling_face:

james.carman
2019-05-15 13:17
Just a happy customer

james.hattersley-dyke
2019-05-15 13:17
haha

james.hattersley-dyke
2019-05-15 13:18
I imagine we'll end up going down the broker container route

james.hattersley-dyke
2019-05-15 13:18
although I'll totally push for hosted

james.hattersley-dyke
2019-05-15 13:18
it's so much easier

bethskurrie
2019-05-15 23:48
I do recommend the hosted version (as I'm part of the team that runs it!) but there is a docker container for the OSS version, so you don't need to know Ruby.

james.carman
2019-05-16 00:24
I don?t think it was about knowing it per se, but caring and feeding for a ruby app isn?t something our folks do.

james.carman
2019-05-16 00:27
Our engineers have taken a liking to running the broker on their machines. I find it unnecessary, but they find it comforting I suppose

james.carman
2019-05-16 00:28
Whatever floats their boat

bethskurrie
2019-05-16 00:28
Really? Tell me how that works.

james.carman
2019-05-16 00:28
They just run it so they can see their stuff publish I guess

james.carman
2019-05-16 00:29
:man-shrugging:

bethskurrie
2019-05-16 00:29
I'm confused! But hey, whatever works for them.

james.carman
2019-05-16 00:29
This particular group is writing the consumer and the provider, so I guess they wanted to be able to verify

bethskurrie
2019-05-16 00:29
Oh, I just use the local files when I'm doing that.

bethskurrie
2019-05-16 00:29
No broker required.

bethskurrie
2019-05-16 00:30
But I guess it saves having a completely different task. Can just make the broker location configurable.

james.carman
2019-05-16 00:30
I?m going to create a maven profile that sets up properties for local brokers

james.carman
2019-05-16 00:31
It might be nice for us to share our configuration, in case it helps other people

bethskurrie
2019-05-16 00:31
Surw

bethskurrie
2019-05-16 00:31
Sure, even

james.carman
2019-05-16 00:32
It took me a while to get all the ducks in a row

luchillo17
2019-05-16 01:34
Hey little question, when using create react app, i was looking to the docs and i see they separate the tests for Pact from regular ones, why's that?

tjones
2019-05-16 01:34
Which docs is this?

matt.fellows
2019-05-16 03:42
I have been thinking about the concept of ?sandboxes? (or something similar) for a little bit. Probably not an easy thing to do. Often times people want to test out webhooks, tagging approaches etc. and not impact the main broker. I wonder if what you?re describing above also feeds into this sort of thinking?

matt.fellows
2019-05-16 03:43
i.e. each team member could create a sandbox to muck around in, and potentially even have scoped to their user (or a group of users)

luchillo17
2019-05-16 03:43
Here: https://docs.pact.io/implementation_guides/javascript Specifically the pactTest script which uses a custom regex for the match of test files: ``` { scripts: { ... "pactTest": "export NODE_ENV=pactTest && jest --testRegex \"/*(.test.pact.js)\" --runInBand --setupFiles ./pactSetup.js --setupTestFrameworkScriptFile ./pactTestWrapper.js" } } ```

matt.fellows
2019-05-16 03:53
It?s completely up to you as to where/how you structure your tests. I tend to separate my unit tests from my contract tests from my perf ? etc.

matt.fellows
2019-05-16 03:53
I can?t recall why these were setup that way (I believe this came in via a PR so possibly residue from a project where it came from)

matt.fellows
2019-05-16 03:53
I wouldn?t read into it too much!

david.darrell
2019-05-16 06:04
has joined #general

david.darrell
2019-05-16 06:25
@christophe.leray hi Chris - thanks for invite

vk.regs
2019-05-16 10:44
I am trying to stub some api using pact stub (I use pact file from pact broker by URL). By pact stub cannot match my api URL with stub. Could somebody help.

vk.regs
2019-05-16 10:45
*Error from Pact stub*: 10:39:01 [INFO] comparing to expected Request ( method: GET, path: /api/user/tracking, query: None, headers: Some({"Accept": "text/plain"}), body: Missing ) 10:39:01 [DEBUG] pact_matching: body: '' 10:39:01 [DEBUG] pact_matching: matching_rules: MatchingRules { rules: {"path": Category { name: "path", rules: {"": RuleList { rules: [Regex("(?i)(\\/api\\/user\\/tracking)")], rule_logic: And }} }} } 10:39:01 [DEBUG] pact_matching: generators: Generators { categories: {} } 10:39:01 [DEBUG] pact_matching::matchers: String -> String: comparing '/api/user/tracking' to '/api/user/tracking' using Regex("(?i)(\\/api\\/user\\/tracking)") 10:39:01 [DEBUG] pact_matching: expected content type = 'text/plain', actual content type = 'text/plain' 10:39:01 [DEBUG] pact_matching: --> Mismatches: [PathMismatch { expected: "/api/user/tracking", actual: "/api/user/tracking", mismatch: "\'(?i)(\\/api\\/user\\/tracking)\' is not a valid regular expression - regex parse error:\n (?i)(\\/api\\/user\\/tracking)\n ^^\nerror: unrecognized escape sequence" }] 10:39:01 [WARN] No matching request found, sending 404 Not Found 10:39:01 [INFO] <=== Sending Response ( status: 404, headers: None, body: Missing ) 10:39:01 [DEBUG] pact_stub_server::pact_support: body: '' 10:39:01 [DEBUG] pact_stub_server::pact_support: matching_rules: MatchingRules { rules: {} } 10:39:01 [DEBUG] pact_stub_server::pact_support: generators: Generators { categories: {} } 10:39:01 [DEBUG] hyper::proto::h1::io: flushed 114 bytes 10:39:01 [DEBUG] tokio_reactor: dropping I/O source: 1 *Pact file from pact Broker*: { "consumer": { "name": "SearchHistory" }, "provider": { "name": "Settings" }, "interactions": [{ "description": "Get Tracking Status", "request": { "method": "get", "path": "/api/user/tracking", "headers": { "Accept": "text/plain" }, "matchingRules": { "$.path": { "match": "regex", "regex": "(?i)(\\/api\\/user\\/tracking)" } } }, "response": { "status": 200, "headers": { "Content-Type": "text/plain; charset=utf-8" }, "body": "true", "matchingRules": { "$.body": { "match": "regex", "regex": "(?i)(true)" } } } } ], "metadata": { "pactSpecification": { "version": "2.0.0" } } }

matt.fellows
2019-05-16 11:01
the error appears to be in those logs

shalygai.a
2019-05-16 11:46
has joined #general

vk.regs
2019-05-16 13:06
As I understand Pact stab cannot parse regex from pact file. Is issue of regexp or pact stab?

matt.fellows
2019-05-16 13:14
What have you tested to see which of those answers is most likely? Looks like maybe the regex is wrong but perhaps it's valid for the code that generated it. What's the consumer language that generated it?

vk.regs
2019-05-16 13:17
C# .net

vk.regs
2019-05-16 13:18
[Fact] public async Task SearchHistoryAndSettingsController_TrackingStatus_ReturnedTrue() { const string path = "/api/user/tracking"; _mockProviderService.UponReceiving("Get Tracking Status") .With(new ProviderServiceRequest { Method = HttpVerb.Get, Path = Match.Regex(path, $"(?i)({path})"), Headers = new Dictionary<string, object> { { "Accept", "text/plain" } }, }) .WillRespondWith(new ProviderServiceResponse { Status = StatusCodes.Status200OK, Headers = new Dictionary<string, object> { { "Content-Type", "text/plain; charset=utf-8" } }, Body = Match.Regex("true", "(?i)(true)") }); var request = new AccessHistoryItemRequest() { Unique = "testUnique" }; await _settingsHelper.AccessHistoryRepository.AddAccessHistory(request).ConfigureAwait(false); } }

vk.regs
2019-05-16 13:18
looks like issue with double \

vk.regs
2019-05-16 13:18
"regex": "(?i)(\\/api\\/user\\/tracking)"

matt.fellows
2019-05-16 13:19
Yeah

matt.fellows
2019-05-16 13:20
Also why bother with that path matcher at all? Is the path dynamic?

vk.regs
2019-05-16 15:20
with need to match path and ignore case

koji
2019-05-16 15:52
has joined #general

edwin.tye
2019-05-16 21:21
has joined #general

mickehl
2019-05-17 08:39
has joined #general

matt.fellows
2019-05-17 09:07
why is your client code sending messages to paths with different cases? This seems unusuall

matt.fellows
2019-05-17 09:08
As in, why do you need a regex at all - does the path the client send ever actually change?

vk.regs
2019-05-17 13:12
This is requirement from dev that we should ignore case because sometimes dev change case for api and test became failed, may be it is not good. Also in some cases we use regex for example for body matching (it will be the same error) - it is usual case.

christopher.f.almanza
2019-05-17 14:04
Are query params mandatory on Pact?

christopher.f.almanza
2019-05-17 14:05
I mean, in order for my endpoint to receive optional query params, do I need to make 2 provider states?

james.hattersley-dyke
2019-05-17 14:46
does the API do different things in response to these params?

christopher.f.almanza
2019-05-17 15:21
functionally speaking, yes. it will sort or limit the results (pagination)

christopher.f.almanza
2019-05-17 15:21
but from the contract perspective, it shouldn't

christopher.f.almanza
2019-05-17 15:21
the json response structure is the same

christopher.f.almanza
2019-05-17 15:21
I'm asking causse the docs doesn't explicitly mentions whether query params can be optional

christopher.f.almanza
2019-05-17 15:22
it just explain why response json props can't (which makes sense)

mboudreau
2019-05-17 23:43
They can be 2 different interactions, one without and one with, to test both scenarios

matt.fellows
2019-05-18 03:05
The general rule we follow here is postel?s law - be conservative in what you send and liberal and what you receive.

matt.fellows
2019-05-18 03:07
In the case of query strings, I can?t recall the specific rule, but if you specify query strings in the actual request, but don?t specify them in the Pact test setup, when the verification happens later on they won?t be sent through. I?m not 100% sure if this will cause a failure in the consumer test though, because you are actually providing more detail than you?ve expected.

matt.fellows
2019-05-18 03:07
But as Michel mentions, you might need to tests. If all of your requests always contain a query string, then you won?t need to test without it

przemek.sech
2019-05-20 00:10
has joined #general

monch1962
2019-05-20 04:05
has joined #general

gordon.barrs
2019-05-20 08:53
has joined #general

vk.regs
2019-05-20 10:12
Looks like it is pact stub issue. Is it possible to fix it?

matt.fellows
2019-05-20 10:36
Just raise an issue on the GitHub repo and somebody will take a look

christopher.f.almanza
2019-05-20 17:46
I can assume a conclusion can be to have a request with the query params, and one without the query params


mboudreau
2019-05-20 23:28
yep, then you test both interactions to make sure they work and are valid :slightly_smiling_face:

sankalan13
2019-05-21 05:16
has joined #general

jinal
2019-05-21 05:33
has joined #general

vadimk0133
2019-05-21 10:21
has joined #general

dimapasko
2019-05-21 14:55
has joined #general

anabalfun
2019-05-22 09:12
has joined #general

martynnevers
2019-05-22 09:34
has joined #general

tylerkron
2019-05-22 18:20
has joined #general

przemek.sech
2019-05-23 06:47
Hi @matt.fellows, This is Przemek from Ansarada. I'm about to purchase a small (5) team plan. Although CC is an acceptable payment method, we (finance) would prefer regular invoicing. Do you provide such a payment method?

matt.fellows
2019-05-23 06:49
Hi @przemek.sech at this stage we can only accept online payments via credit card I?m afraid

matt.fellows
2019-05-23 06:49
We are looking at it down the track - but we don?t have the team to support it just yet

przemek.sech
2019-05-23 06:49
I like `at this stage` :slightly_smiling_face:

przemek.sech
2019-05-23 06:50
When you have such a capability we'd like to change. At this stage CC is ok

matt.fellows
2019-05-23 06:51
no problem, I can?t give you any timelines yet but I can say that we?ve had a few customers ask the same (to be honest, most companies don?t like paying with credit cards as ubiquitous as it is!)

przemek.sech
2019-05-23 06:59
@matt.fellows I need a hand. I cannot create the account as ansarada subdomain is already taken, by our trial

bethskurrie
2019-05-23 07:00
If you sign up with a different domain, I can swap it over for you afterwards.

matt.fellows
2019-05-23 07:02
I?m chatting with him offline Beth, thanks

bethskurrie
2019-05-23 07:03
:+1:

botalov.andrey
2019-05-23 12:08
has joined #general

sebastian.kowalski85
2019-05-23 13:33
has joined #general

miiiiauu
2019-05-24 15:57
has joined #general

florian
2019-05-24 19:47
Hi I am running into problems while trying to build pact-jvm The error message is: No value has been specified for property 'destinationDir'.

florian
2019-05-24 19:47
Sorry here is the full error message:

florian
2019-05-24 19:47
* What went wrong: A problem was found with the configuration of task ':pact-jvm-provider-lein_2.12:compileClojure'. > No value has been specified for property 'destinationDir'.

florian
2019-05-24 19:47
Has anyone faced this before?

uglyog
2019-05-27 03:36
This is an issue after upgrading Gradle. If you try using Gradle 4.10 and JDK 1.8 it will work.

void.alexey
2019-05-27 22:03
has joined #general

wei.feng
2019-05-27 22:43
has joined #general

diandra
2019-05-28 00:15
has joined #general

simone.dicola
2019-05-28 08:32
has joined #general

daniel.tattan.birch
2019-05-28 15:03
has joined #general

pact.io
2019-05-28 16:31
has joined #general


pdunn
2019-05-29 06:15
has joined #general

zaharovrv
2019-05-29 13:16
has joined #general

oswald.quek
2019-05-29 13:40
Hello, are there any jvm examples of asynchronous contract testing (for message queues)?


oswald.quek
2019-05-29 15:51
thanks, will have a look!

ben
2019-05-29 19:04
has joined #general

cocosanti
2019-05-29 21:58
has joined #general

dperez
2019-05-30 01:57
has joined #general

dperez
2019-05-30 04:26
Hi, I'm looking implementations in .Net, so far I found pact-net https://github.com/pact-foundation/pact-net But it looks they are Version 2 compliant, and we are looking to do Contract Test on our messaging infrastructure (Introduced in Version 3) as well our GraphQL endpoints. (All of this in .Net environment) Is somebody dealing with a similar scenario, I will really appreciate any help. I have searched all available source like stackOverFlow tag pact but no luck. Again thanks.

matt.fellows
2019-05-30 04:27
There is a PR on that project to implement message pact. It?s worth jumping on there and seeing how far along it has progressed and how far away it is from mainline

matt.fellows
2019-05-30 04:27
I believe a few people here are using it

matt.fellows
2019-05-30 04:27
jump into #pact-net for more

dperez
2019-05-30 04:27
Thanks a lot @matt.fellows

matt.fellows
2019-05-30 04:27
np

neil
2019-05-30 04:40
@dperez The `message-pact` branch is what you want to look at. You could build a nuget package locally from there and use it if you like.

dperez
2019-05-30 04:41
great help, thanks a lot, will try it

neil
2019-05-30 04:41
The PR is really just a conversation placeholder at the moment.

russell.blandamer
2019-05-30 10:42
has joined #general

pat.vongphrachanh
2019-05-30 13:54
has joined #general

acooper106
2019-05-30 15:56
our pact broker server keeps crashing on its own. Are there any logs that we can check?

laverya
2019-05-30 17:31
has joined #general


bethskurrie
2019-05-30 23:55
There are so many factors when it comes to deploying an application that aren't actually to do with the application itself, that I'm not sure we'll be able to give you any specific advise on what might be the problem.

bethskurrie
2019-05-30 23:58
Pactflow (the hosted Pact Broker) runs in a "highly available architecture", and the fact that it is "highly available" is not much to do with the underlying Ruby application, and mostly to do with the way it is run and deployed (multiple ec2 instances, no downtime deployments, monitoring, auto scaling etc).

bethskurrie
2019-05-31 00:02
What version are you running? There are some versions that have quite intensive data processing before I optimised the "matrix" query. The latest versions do not have this issue.

gopinathlangote11
2019-05-31 08:00
Ok.

matt.fellows
2019-05-31 12:55
@bernardo.guerreiro Thanks for your great post and kind words, these truly mean a lot to us maintainers https://medium.com/dazn-tech/pact-contract-testing-dealing-with-authentication-on-the-provider-51fd46fdaa78 :pray:

matt.fellows
2019-05-31 12:56
And thanks for asking for what you need, without feedback it?s hard to make Pact more awesome!

phall
2019-05-31 13:18
I don?t think :pray: is part of the url :simple_smile:. It?s https://medium.com/dazn-tech/pact-contract-testing-dealing-with-authentication-on-the-provider-51fd46fdaa78, and is a great read. Thanks for sharing!

matt.fellows
2019-05-31 13:23
thx, yes corrected.

matt.fellows
2019-05-31 13:23
my thank you hands ruined it!

acooper106
2019-05-31 13:45
please add Oruganti,Venkata Rao <venkata_oruganti@vanguard.com>; Pickering,Jason <jason_pickering@vanguard.com> to slack channel

acooper106
2019-05-31 13:47
Chigurupati,Vanaja <vanaja_chigurupati@vanguard.com>

acooper106
2019-05-31 13:51
Patel,Rakesh <rakesh_patel@vanguard.com>

yousafn
2019-05-31 14:41
@bernardo.guerreiro great article, thanks for your reply on my issue too, I?ll try out your suggestions. My initial idea to get me over the hump was just overwrite all the headers with the authenticated headers in the request filter as that has access to the body and path.

bernardo.guerreiro
2019-05-31 16:10
No worries Matt! I meant every word, as you guys really are a great community :slightly_smiling_face:

bernardo.guerreiro
2019-05-31 16:59
thanks @yousafn . but the request filter doesn't have access to the states does it? So you wouldn't be able to do for example: if (state === 'authenticated') ADD HEADER; else DO NOTHING.

bernardo.guerreiro
2019-05-31 16:59
meaning you'd only be able to test the happy path, not the 403?

acooper106
2019-05-31 17:03
ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-linux]

yousafn
2019-05-31 17:03
I think it does - the req logs are from inside the request filter and the created/creating log comes from inside the state handler. req.path /_pactSetup req.body { consumer: 'consumer-service', state: 'Is authenticated', states: [ 'Is authenticated' ], params: {} } creating AWS signed headers created AWS signed headers req.path /path/that/the/pact/test/is/calling req.body undefined It would be a compromise at being only able to test happy paths. I?m pretty confident that if we don?t send the with headers, the request will fail with a 403. I will try out your blog suggestions when I next get your computer time, as your solution looks much slicker,

yousafn
2019-05-31 17:04
Btw are you at dazn in Leeds?

bernardo.guerreiro
2019-05-31 17:05
oh then if it does, then it's kinda the same. you just defer the state handling to the request filter, in this case haha, and don't send the header when you want a 403

bernardo.guerreiro
2019-05-31 17:05
both would work really !

bernardo.guerreiro
2019-05-31 17:05
nope, I'm in the London branch, although we sync regularly with the other offices. By the way, thanks for all the contributions to the community, you've done some really cool stuff :slightly_smiling_face:

bernardo.guerreiro
2019-05-31 17:06
(join DAZN in Leeds! :P)

yousafn
2019-05-31 17:27
A few of my mates work there, I moved onto a consultancy after Sky and my pals moved over ( rich McIntyre, Costa G and Mo al nuami), I was asked but I wanted to branch out from just testing into a consultancy based role. You never know what the future holds. If you get up to Leeds with work, give me a shout and we can grab a beer!

acooper106
2019-05-31 17:30
docker 2.0.1 or 1.17.2

bernardo.guerreiro
2019-05-31 17:32
Ah yeah! Costa is a blast , we went to a conference in February together :slightly_smiling_face:, and I know Mo too! I know Rich, but haven't really interacted too much with him Sure , sounds good! :slightly_smiling_face:

yousafn
2019-05-31 17:35
Costa is mad Hahahaha, we worked together for about three months before I left Sky. Mo I worked with for about 18 months. Miss them both! I?ll let you know I get on and I?ll be sure to post back my solution

ckaptan
2019-05-31 18:02
has joined #general

acooper106
2019-05-31 18:17
pg 1.1.4

acooper106
2019-05-31 18:18
17:48:48 2019-05-31 13:48:48,059 P4358 [INFO] *************Start Pact Broker Server************* ? 17:48:48 2019-05-31 13:48:48,059 P4358 [INFO] % Total % Received % Xferd Average Speed Time Time Time Current ? 17:48:48 2019-05-31 13:48:48,059 P4358 [INFO] Dload Upload Total Spent Left Speed ? 17:48:48 2019-05-31 13:48:48,059 P4358 [INFO] ? 17:48:48 2019-05-31 13:48:48,059 P4358 [INFO] 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 ? 17:48:48 2019-05-31 13:48:48,059 P4358 [INFO] 100 11 100 11 0 0 1059 0 --:--:-- --:--:-- --:--:-- 1100 ? 17:48:48 2019-05-31 13:48:48,060 P4358 [INFO] /usr/lib64/ruby/gems/2.6.0/gems/sequel-5.20.0/lib/sequel/adapters/postgres.rb:206:in `initialize': PG::ConnectionBad: timeout expired (Sequel::DatabaseConnectionError)

yousafn
2019-06-01 00:56
has anyone had any luck using the `pact-stub-service` which lives with `pact-mock_service`, in getting it to be flexible in matching query parameters? One of my dev?s was attempting this at work and got nowhere, so I started to take a look. I can get `pact-js` to use the matchers properly, but `pact-stub-service` ignores these and leaves me with a rigid mock that will only accept a single query param. I have stuck a full description of my issue here - https://github.com/pact-foundation/pact-mock_service/issues/80#issuecomment-497898603 along with a reproducible example in a repo (see issue comment for link and steps to run)

bethskurrie
2019-06-01 01:07
That shouldn't be the case.

bethskurrie
2019-06-01 01:07
It's the same matching code.

bethskurrie
2019-06-01 01:10
Ah.... yes, I know what you're talking about. It's because the v2 spec doesn't support a query hash in the serialisation.

bethskurrie
2019-06-01 01:10
This has bitten me in a few places.

bethskurrie
2019-06-01 01:10
I'll have a think about what I can do about it.

bethskurrie
2019-06-01 01:11
When v2 was written, the matching info wasn't even included in the pact, because the stub wasn't invented, so we didn't think we'd need it.

yousafn
2019-06-01 01:12
doh :disappointed: our dev did mention about the spec versions. let me try setting the pact version to 3 in the pact provider options and i?ll see what happens. If you can point me in the right direction of the code, I will happily have a stab at a change. No rush on this, the wiremock stuff will get us over the hump for now whilst we have a think

bethskurrie
2019-06-01 01:12
Only the "reified" (concrete) example was stored.

bethskurrie
2019-06-01 01:12
I don't think writing v3 pacts works yet, only reading them. But you can try.

yousafn
2019-06-01 01:17
ahh yeah, just tried it, the only diff in the pact was the version number, ` "version": "3.0.0"` cheers for the answer though, it has saved me chasing my tail! Looking forward to hearing your suggestions and what we can do in the future to support this (if this is indeed a case that pact wants to support)

bethskurrie
2019-06-01 01:17
I want it to work

bethskurrie
2019-06-01 01:18
because using the stub server for larger scale integration tests is one of its purposes

bethskurrie
2019-06-01 01:18
I'll see if I can re-parse the query string back into the hash to apply the matching rules.

yousafn
2019-06-01 01:19
we adore it for that very purpose :heart: Thanks duck, appreciate it. Feel free to leave me some breadcrumbs to work with, and I will have a go (or give it to one of my insanely clever devs and see what he can come up with) as I know you are insanely busy with the pactflow work

bethskurrie
2019-06-01 01:20
we are! I can point you to the code if someone is brave enough to wade in.

yousafn
2019-06-01 01:21
Well I?ve got 3 days off work next week, playing nurse for my wife who is having an op, so I imagine she will be sleeping alot, which means lots of laptop time for me

bethskurrie
2019-06-01 01:21
party time!

bethskurrie
2019-06-01 01:22
I'll put some notes on the issue

yousafn
2019-06-01 01:23
thank you very much mucker, right I should probably hit the sack as it is an ungodly hour here but I will catch up with your notes tomorrow or when you get round to it, again no rush on our side!

matt.fellows
2019-06-01 03:23
thanks for getting involved (and good luck with your wife next week!)

bethskurrie
2019-06-01 03:23
I was wondering how on earth you were chatting to us at this time of your day!

thakkarjinal29
2019-06-01 09:55
has joined #general

thakkarjinal29
2019-06-01 11:27
@bernardo.guerreiro this is indeed a brilliant post, exactly what I was looking for! Only thing is my provider is a django app. I don?t think the `requestFilter` has been implemented in pact-python yet. @matt.fellows is this feature in pipeline for pact-python? Would be so awesome if it is!

matt.fellows
2019-06-01 13:14
I'm not sure if it's in Python yet, but the best way is to get an issue raised on the repo and some votes - community is what drives this stuff

matt.fellows
2019-06-01 13:14
Love that the world is with a small place and little projects like this can bring ppl together!

matt.fellows
2019-06-01 13:15
I'll look into Pact JS to see how we might be able to simplify the workflow

matt.fellows
2019-06-01 13:15
I would still use the state handlers but then setup local state to instruct the request filter how to behave. Otherwise the request filter could get quite large in and if itself

matt.fellows
2019-06-01 13:15
I.e. use them together

yusuke1.sato9.reg
2019-06-03 06:49
has joined #general

sankalan13
2019-06-03 09:20
Hey guys. We have our provider in python django and our consumer in Angular in a separate repo. We are running our provider verifier using the pact ruby standalone. We are having some problem with authentication. Our provider states sets up the user in the backend directly. This can cause 3 cases: 1) We hardcode our passwords and emails and basic auth and use the --custom-headers in provider verifier for each type of tests. (our tests pass but its difficult to scale the hardcoding. This can cause a lot more issues later on) 2) We remove auth altogether and then test the contracts without auth, then test auth separately. (I fairly like this idea, very low effort and easily doable. But it changes the production state of my backend which we should avoid if we can) 3) We write a custom middle ware that generates a random email and password and the related basic auth token and inject the email and password in my provider states setup and the basic auth in my provider verifier. (we need to figure this one out but its interesting and scalable. I think the --custom-middleware flag in pact-ruby standalone would be the place to insert the custom middleware. You have used something as requestFilters to solve this in js. Is there something similar in pact-ruby-standalone? If not, which of the above three would you suggest we use during implementation?

bethskurrie
2019-06-03 09:22
All are perfectly acceptable. I say, which ever one you can all agree on!

bethskurrie
2019-06-03 09:25
The contract testing part is most useful for stuff that is likely to change. The auth is not likely to change, so the benefit of including it is low. And there are generally things you have to test outside a contract anyway, so if you're comfortable in testing that in another place, I don't think it's bad to turn it off for the contract tests

bethskurrie
2019-06-03 09:26
You generally have to modify the provider in some way to do the verifications, like stub a downstream service. The trade-offs are usually worth it.

bethskurrie
2019-06-03 09:29
You could write your own proxy that adds the credentials dynamically by the way. Point the verification at the proxy instead of your real service. Most frameworks have a reverse proxy library that allows you to modify the request on the way through.

bethskurrie
2019-06-03 09:30
Or, your own middleware.

hanumanth.abhilash
2019-06-03 09:54
has joined #general

sankalan13
2019-06-03 10:00
Oh this one is interesting. Will explore this more. Thanks Beth!!

sankalan13
2019-06-03 10:03
Haha thanks Beth, I can see your suggestions have a pattern, the one you like came first. I'm also inclined towards switching off the auth and testing that in another place. :smile:

uri.goldstein
2019-06-03 12:36
has joined #general

uri.goldstein
2019-06-03 12:40
Hello.

uri.goldstein
2019-06-03 12:41
I'm considering Pact for a .net project only the web service are good old fashioned SOAP services. Does PactNet support these, or is it strictly JSON at the moment?

bheemreddy181
2019-06-03 15:12
mock auth to return true you mean on provider ?

matt.fellows
2019-06-03 22:21
Not to my knowledge, but you might be bests checking in #pact-net or on the repo issues.

bethskurrie
2019-06-03 23:13
@ckaptan a delete request with a body is not supported by the ruby implementation. It is a very unusual usecase! @uglyog would it be supported by pact-jvm?

bethskurrie
2019-06-03 23:18
You can do that.

acooper106
2019-06-03 23:20
looks like we were having internal issues before.. Now i'm geting this error when I start the broker. Does this look familiar?

acooper106
2019-06-03 23:20
```22:01:09 2019-06-03 18:01:09,670 [DEBUG] Command 06_start_server_pact_broker output: *************Start Pact Broker Server************* % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 14 100 14 0 0 3 ? 22:01:09 2019-06-03 18:01:09,671 [DEBUG] No services specified ? 22:01:09 2019-06-03 18:01:09,686 [INFO] ConfigSets completed ? 22:01:09 2019-06-03 18:01:09,686 [DEBUG] Not clearing reboot trigger as scheduling support is not available```

bethskurrie
2019-06-03 23:22
Hi @acooper106. Your workmates can join the pact foundation slack channel by going to http://slack.pact.io

acooper106
2019-06-03 23:22
this is the command that I'm running rackup -p 8080 -o $(curl http://169.254.169.254/latest/meta-data/local-ipv4) -D >> pactbroker-service-output.txt

bethskurrie
2019-06-03 23:23
The output that starts `Command 06_start_server_pact_broker output` does not come from the pact broker. It most likely comes from what ever you are using to run the docker container.

bethskurrie
2019-06-03 23:23
``initialize': PG::ConnectionBad: timeout expired (Sequel::DatabaseConnectionError)` This says that your broker cannot connect to the database.

acooper106
2019-06-03 23:25
those are my logs but i'm using the rackup command to start the server

acooper106
2019-06-03 23:25
i fixed the DB connect error

bethskurrie
2019-06-03 23:25
Are you using the docker image?

acooper106
2019-06-03 23:25
yes

bethskurrie
2019-06-03 23:26
you don't need to call rack up then

acooper106
2019-06-03 23:26
docker is installed i believe version 2.0.1

bethskurrie
2019-06-03 23:26
it will start for you automatically

bethskurrie
2019-06-03 23:26
you just run the docker image.

acooper106
2019-06-03 23:26
its doesn't usually start. what command it that to run docker

bethskurrie
2019-06-03 23:27
I'm afraid these are questions you need to ask your ops team.

acooper106
2019-06-03 23:28
i was following the docs to install pact broker

bethskurrie
2019-06-03 23:28
I don't know what architecture, environment or tools you're using to deploy your docker container.

acooper106
2019-06-03 23:28
i believe the last i checked it said to run rackup

acooper106
2019-06-03 23:28
from the example directory

bethskurrie
2019-06-03 23:28
that's if you're running a custom installation

bethskurrie
2019-06-03 23:28
not the docker container.

bethskurrie
2019-06-03 23:28
if you have dius/pact-broker or pactfoundation/pact-broker, you just run the docker container.

acooper106
2019-06-03 23:29
then im not using docker container. I have ruby installed and the i install docker and the pact broker

acooper106
2019-06-03 23:29
do you have doc on this? i believe the doc i was follow said run rackup

bethskurrie
2019-06-03 23:30
Can I suggest that you use the docker container? Running the ruby application directly is something that only experienced ruby developers would be qualified to do. I wouldn't even do it.

bethskurrie
2019-06-03 23:30
No wonder it's crashing!

acooper106
2019-06-03 23:31
i have only seen one doc for the installation


acooper106
2019-06-03 23:31
i'm not sure of any other options

bethskurrie
2019-06-03 23:32
Under "Usage" there is a "container solutions" section https://github.com/pact-foundation/pact_broker#container-solutions

bethskurrie
2019-06-03 23:32
You are trying to "roll your own" which is a technically difficult exercise!

acooper106
2019-06-03 23:33
oo yes i remember now

acooper106
2019-06-03 23:33
we dont have docker in house

acooper106
2019-06-03 23:33
so that why we built it this way

bethskurrie
2019-06-03 23:34
From the line `http://169.254.169.254/latest/meta-data/local-ipv4)` it looks like you're trying to run it on an AWS EC2 instance. Is that the case?

acooper106
2019-06-03 23:37
yes

bethskurrie
2019-06-03 23:43
If you're already using AWS, I would recommend using AWS ECS to run the pactfoundation/pact-broker image. You can find the documentation here https://aws.amazon.com/getting-started/tutorials/deploy-docker-containers/

acooper106
2019-06-03 23:46
ok i will look into this and pass this along to my team.

bethskurrie
2019-06-03 23:46
You will need to ask you own ops people to assist you with the deployment.

acooper106
2019-06-03 23:46
can you speak to our current issuea little more as to why its crashing?

bethskurrie
2019-06-03 23:47
I'm afraid I really don't have enough information to help you.

bethskurrie
2019-06-03 23:47
I can tell you that nobody else has reported these issues, so it is likely to be environment specific.

acooper106
2019-06-03 23:47
ok its hard to identify if its my broker configuration of some other internal issue

acooper106
2019-06-03 23:48
ok what about the most recent one during the start command

bethskurrie
2019-06-03 23:48
If you are running the application directly, without passenger, nginx or puma (which you would get from the docker container), then I'm not surprised it's crashing though. That's not the way to run a production application.

bethskurrie
2019-06-03 23:49
The way you're running it is only suitable for someone playing around with an instance on their local machine - not something that needs to be available 24/7 to support CI.

bethskurrie
2019-06-03 23:50
This is why we've built http://pactflow.io - it takes a lot of engineering to make a service highly available. It's not just to do with the underlying Ruby application.

acooper106
2019-06-03 23:51
ok the doc didn't explain it this way

acooper106
2019-06-03 23:52
to me and our team it seemed like this was an equal option to the docker container

bethskurrie
2019-06-03 23:52
> For production usage, use a web application server like Phusion Passenger or Nginx to serve the Pact Broker application. You'll need to read up on the documentation for these yourself as it is beyond the scope of this documentation. See the wiki for instructions on using a reverse proxy with SSL.


bethskurrie
2019-06-03 23:54
The docs clearly state that you need to use Phusion or similar to run the application in production.

bethskurrie
2019-06-03 23:55
It is beyond the scope of the Pact Broker documentation to explain how to use these. Again, I advise you to contact the ops team at your company.

acooper106
2019-06-03 23:56
like docker container is better but if you dont have it is ok to set it up this way. ok seems like if we dont have docker containers then we can continue this way but we are missing some pieces to make this reliable. ok I'm not sure if we missed that before. Are you sure that this hasn't changed since we first built the broker

bethskurrie
2019-06-03 23:56
No, it has not changed.

acooper106
2019-06-03 23:56
we did consult the ops team when we brought this in and built it on aws

acooper106
2019-06-03 23:57
thats why i'm not sure how we missed it

bethskurrie
2019-06-03 23:57
These instructions are quite old.

acooper106
2019-06-03 23:57
it has been running on aws for a while now and just started seeing major issues

matt.fellows
2019-06-03 23:58
Hi @acooper106, all of the issues you have described are unfortunately outside of our control.

bethskurrie
2019-06-03 23:58
> What version are you running? There are some versions that have quite intensive data processing before I optimised the "matrix" query. The latest versions do not have this issue.

acooper106
2019-06-03 23:59
ok seems like we either need docker container or "Phusion Passenger or Nginx"

bethskurrie
2019-06-03 23:59
I didn't see an answer to this question.

acooper106
2019-06-03 23:59
how to i tell which version of the broker do i have

matt.fellows
2019-06-04 00:00
Running the Pact Broker isn?t a hugely onerous task, but it does take some effort to maintain latest versions, keep it HA etc. I would suggest you have somebody with good operations knowledge look over the design and implementation (if not ownership) to ensure the ongoing stability and performance.

bethskurrie
2019-06-04 00:01
To get the version, go to `/hal-browser/browser.html#` in your broker, and look at the `x-pact-broker-version` response header

acooper106
2019-06-04 00:03
for the last 1-2 years that has been me. I'm technically out of the country now working on getting the broker back up and running

acooper106
2019-06-04 00:03
x-pact-broker-version: 2.32.0

bethskurrie
2019-06-04 00:03
That's the latest version at least.

acooper106
2019-06-04 00:04
i feel like most of our issues are internal tho

acooper106
2019-06-04 00:05
but it felt like we would get updates randomly as well

bethskurrie
2019-06-04 00:05
I'm afraid I have to go. My final advice is to use the pactfoundation/pact-broker image on ECS. The way you are currently running it is not advised, and I'm surprised it's run ok for this long.

acooper106
2019-06-04 00:07
we are using the pactfoundation/pact-broker

acooper106
2019-06-04 00:07
i believe you mean the docker image

bethskurrie
2019-06-04 00:07
ECS is a service for running docker. Yes, use the docker image.

acooper106
2019-06-04 00:08
ok

uglyog
2019-06-04 00:12
Not directly. The mock server will accept it, but any http client libraries may not.

matt.fellows
2019-06-04 00:25
So on a related note - we?ve thought about creating an AWS cloudformation template for this purpose (possibly available via AWS marketplace to make this easier). It would be a bit of effort, but if we created such a thing - would this be something you would consider using instead of rolling your own?

acooper106
2019-06-04 00:26
i have the setup from "rolling my own" in a CF scripts

acooper106
2019-06-04 00:26
its built into our pipeline for maybe 100 teams now

bethskurrie
2019-06-04 00:29
It could just be crashing from the increase in load over time. That's a lot of teams. A single ruby process can only take so much load.

acooper106
2019-06-04 00:30
we have the broker on an aws EC2 instance using the CF templates, auto scaling and load balancer etc. i belive that even at this point i can bring this back up for users but I'll be looking into the aws docker container next. I'm not sure if what you

acooper106
2019-06-04 00:30
now that maybe true

acooper106
2019-06-04 00:30
because it was just happen randomly

acooper106
2019-06-04 00:30
i didn't actually do any analysis on scaling

acooper106
2019-06-04 00:31
but this is autmatically built into everyones build process

bethskurrie
2019-06-04 00:31
Scaling is difficult to do without a lot of fine tuning. Even our ops experts take some time to get it right.

matt.fellows
2019-06-04 00:37
> i have the setup from ?rolling my own? in a CF scripts Sure, but as mentioned, there are lots of little things that make rolling this out a challenge at scale.

matt.fellows
2019-06-04 00:38
To be honest though, if you?ve gotten as far asa 100 teams using it daily, it sounds like you need somebody to actually get their hands dirty to properly help you.

matt.fellows
2019-06-04 00:38
It?s going to be hard (and also very time consuming for us doing this in our spare time) to support your specific needs

acooper106
2019-06-04 00:39
possibly or i just need the aws docker container

matt.fellows
2019-06-04 00:39
:man-shrugging: maybe

acooper106
2019-06-04 00:39
i believe my questions were answered.

matt.fellows
2019-06-04 00:40
excellent!

acooper106
2019-06-04 00:40
thanks for all your help. all of this is good info. and i'll pass it along to my team

acooper106
2019-06-04 00:43
at first i just think they weren't ready for the docker container. but now we have the usage and a strong case for it

neil
2019-06-04 00:57
Hey. Nah no support for SOAP or XML.

richard.jones
2019-06-04 06:37
does anyone know of a stash/bitbucket merge check hook that will check pact verification status (so it?s checked like a build status)?

bethskurrie
2019-06-04 07:09
Can you publish results to a sha like you can with github?

simon.nizov
2019-06-04 08:16
Is there a good practice for provider verification when my provider talks to a 3rd party API (like google maps)? How do I stub that 3rd party API? There?s no pact so `pact-stub-service` isn?t relevant. I tried looking for some kind of standalone VCR stub server but couldn?t find anything worthwhile.

detert
2019-06-04 08:19
If your provider talks to a 3rd party, isn't he a consumer in that case. Wouldn't you use the PactMockService in that case? However if you run the provider verifyAll() tests, maybe you do not want to stub anything ...

simon.nizov
2019-06-04 08:21
No, I mean during the verification stage of a pact between a consumer and a provider, my provider is calling *another service*, which is not under my control, so pact is not an option.

detert
2019-06-04 08:25
Well I know. In that test case he is a provider and a consumer at the same time. And for the consumer part you have to decide if you want to mock/stub the 3rd party or if you use the real API. In my opinion you could could create a pact contract with the 3rd party provider, or you use a simple mock service like http://www.mock-server.com/ or http://wiremock.org/

detert
2019-06-04 08:28
Does that make sense?

simon.nizov
2019-06-04 08:39
Yup, that?s what I was thinking of. Does MockServer have a python client?

simon.nizov
2019-06-04 08:40
WireMock needs Java which is a problem for our use case

alessio.paciello
2019-06-04 08:41
Good morning! Is there a way, in Java, to write verification tests (for the same `consumer-provider` couple) in different test classes? We found no way without using the `@PactFilter` annotation , but doing this we would not fail while a consumer is actually declaring a new interaction


detert
2019-06-04 08:42
mock-server can be configured with json and/or HTTP requests

simon.nizov
2019-06-04 08:44
Yep, but I was hoping to not use pact only for its mocking capability. The Pact docs also suggest that this is not the use case for pact but oh well..

simon.nizov
2019-06-04 08:45
Ideally I would want to use VCR to record my interactions against the 3rd party API. Then in the pact verification I would want some kind tool that can read those VCR recordings and run a stub server with them which my provider would call instead of the real API.

detert
2019-06-04 08:48
Well, I am not using it like that currently (I am really new to this stuff and currently implementing my first consumer / provider tests with ci and all that) However we have way too many 3rd party provider and my idea was to create pact contracts for each of them to be able to run nightly tests for each contract. In that case I would use the pact mock services in cases like yours. However I have no experiences doing that

detert
2019-06-04 11:28
Do you use https://github.com/pact-foundation/pact-mock_service? Maybe you can set --pact-file-write-mode=merge

alessio.paciello
2019-06-04 12:37
Nope I am using the java SpringPactRunner

detert
2019-06-04 13:20
Alright, I have no idea how that works, sorry

ckaptan
2019-06-04 13:40
Thanks, @bethskurrie. I look for more conventional solutions.

bheemreddy181
2019-06-04 13:59
Cool :sunglasses:

dperez
2019-06-04 15:45
hi @neil or @matt.fellows , is there any specific steps I need to follow to build pact-net from a particular branch I cloned?, specifically the message-pact branch. I'm able to build the solution and run the messaging tests and everything works fine inside the solution. Basically I want to build the project to have a nuget package I can include on one of my own projects but not sure how to get it.

gomathi.velayutham
2019-06-04 16:52
has joined #general

rob.clarken
2019-06-04 22:32
has joined #general

richard.jones
2019-06-04 22:42
Ahah! Yes, thanks for the clue!!

richard.jones
2019-06-04 22:43
(now I just need the full commit hash, but I reckon we can solve that)


bethskurrie
2019-06-04 22:45
It was close at one stage, but the person implementing the XML matchers went silent.

richard.jones
2019-06-04 22:47
cool thanks. I also just found https://github.com/pact-foundation/pact_broker/wiki/Pacticipant-version-numbers which I?ll use as a ref to convince folks here to use the full hash as the version

richard.jones
2019-06-04 22:47
it?s not as *readable* though, but we can use tags for that

bethskurrie
2019-06-04 22:48
@detert pact isn't a great fit for 3rd party providers. Unless you can set up the 'provider states` programmatically, it becomes difficult to do the verification step.


bethskurrie
2019-06-04 22:50
@simon.nizov I like the idea of somehow using the VCR recordings to create a mock.

matt.fellows
2019-06-04 23:21
This is one of those cases where you?re talking to the ?dirty outside world?. Depending on those third parties, your level of confidence in the APIs changing could be different (e.g. with AWS I?d have pretty high trust). VCR could be a good option there. But if you have little trust in the system, you may need to continually ensure things work for reals, in which case you have no choice but to actually integrate

yousafn
2019-06-05 00:19
wiremock has a recorder mode and can be used in docker https://github.com/rodolpheche/wiremock-docker but also check out https://github.com/buger/goreplay

yousafn
2019-06-05 00:20
there is a tool that can generate pact files from wiremock mappings but i haven?t got round to trying it out yet


yousafn
2019-06-05 00:23
i tend to run a set of api tests against public api?s and providers i don?t trust (within previous companies where noone talked to each other) on a cron job every hour - found it better to be proactive than reactive

bethskurrie
2019-06-05 00:25
:+1:

neil
2019-06-05 01:12
You can build a nuget package by running the following commands from PowerShell: - Create a release build from VS - `.\Build\Download-Standalone-Core.ps1` If you get a ?The request was aborted: Could not create SSL/TLS secure channel.? error, also run `[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12` - `.\Build\Publish-Release.ps1 -ReleaseVersionNumber "PACTNET_VERSION"` - `.\Build\Publish-StandaloneCore-Releases.ps1 -ReleaseVersionNumber "PACTNET_VERSION"` Replace PACTNET_VERSION with the version number you want. Once all the commands have been run you should see the packages in ./Build dir

neil
2019-06-05 01:13
Alternatively you can use the packages generated from the build https://ci.appveyor.com/project/SEEKJobs/pact-net/builds/22130704/artifacts

neil
2019-06-05 01:13
I do need to merge master back into message-pact, so there will be a new one soon


dperez
2019-06-05 03:07
thanks a lot! @neil you are a life saver

detert
2019-06-05 05:19
@bethskurrie Good point. I missed that

bethskurrie
2019-06-05 05:21
the sweet spot for pact is internal APIs where the consumer teams and provider teams know each other and are collaborating over an API

nick_horne_90
2019-06-05 08:23
has joined #general

elvir.arslanovic
2019-06-05 09:33
has joined #general

taranovskyi.anton
2019-06-05 10:45
has joined #general

nick_horne_90
2019-06-05 14:37
Hi, does anyone know whats happened to the pact-jvm-provider-gradle that used to be here: https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-gradle ?


uglyog
2019-06-05 23:26
Big refactor for version 4.0.x. You can still find the old structure on the v3.6.x branch

perhuman
2019-06-06 02:52
has joined #general

uri.goldstein
2019-06-06 06:52
Thanks @neil and @bethskurrie. I'm thinking of implementing it myself. Can you estimate how much work is involved in getting it done? Will it be in the core Ruby codebase?

bethskurrie
2019-06-06 06:55
Yes, you'll need to do ruby in afraid.

bethskurrie
2019-06-06 06:56
It was super close, and I don't know why it lost momentum.

bethskurrie
2019-06-06 06:56
If you google "pact xml ruby" you should find the repo

bethskurrie
2019-06-06 06:56
In fact, I think there's a channel

bethskurrie
2019-06-06 06:56
#pact-ruby-xml

nick_horne_90
2019-06-06 07:32
Great thanks

uri.goldstein
2019-06-06 07:47
Many thanks @bethskurrie . I don't know Ruby but I want to give it a look. I'll go look for the code and join the channel.


bethskurrie
2019-06-06 07:55
Yes

uri.goldstein
2019-06-06 08:09
Tx :+1:

uri.goldstein
2019-06-06 08:10
Hey, this is you: https://github.com/peer85/pact-xml/commits/master :slightly_smiling_face:

bethskurrie
2019-06-06 08:10
Yes

bethskurrie
2019-06-06 08:11
I did the initial framework to explain how it needed to be written.

bethskurrie
2019-06-06 08:11
But I didn't implement the matching logic.

bethskurrie
2019-06-06 08:11
Not using xml myself!

uri.goldstein
2019-06-06 08:12
Right. Sorry. Got confused.

uri.goldstein
2019-06-06 08:14
Seems like all 3 forks have no commits beyond your initial work.

bethskurrie
2019-06-06 08:14
There's definitely one with work! Have a look at any pr to the original

steveland
2019-06-06 14:20
has joined #general

void.alexey
2019-06-06 16:36
Hi, I am thinking about adding PACT to our company engineering flow. There is no issues when we have «consumer» and «provider». But I also faced use case, that makes me think I am on the wrong way: - assume we have some service API (developed by us); - it will be consumed by another company and it is developed exactly for them to integrate with us (they are the only consumers); - they do not use PACT; - we provide Swagger/Blueprint/etc. Is it OK to implement own generic ?consumer? to write the contract pacts and after that also use it at the same place (code base) to verify ?provider??

russell.blandamer
2019-06-06 17:18
If you are not developing the ?real? consumer, then you have no control over what the it will request from you. Creating a ?fake? consumer in order to perform Pact testing won?t prevent the ?real? consumer from breaking the contract with your provider. IMHO Pact isn?t an appropriate tool in this situation: the whole point is that it?s driven by the consumer.

russell.blandamer
2019-06-06 17:18
Disclaimer: I have been using Pact for like three weeks: I?m not an expert.


antonello
2019-06-06 18:05
You could - in theory - have a pact broker that both you and your client use.

antonello
2019-06-06 18:07
But your client would have to commit to write and maintain consumer tests and publish them to that pact broker.

antonello
2019-06-06 18:08
The standard advice is to not use pact for public APIs, but it you?re building an API for just one client, then it may work out ok for you.

void.alexey
2019-06-06 19:00
My initial goal is: verify and keep up to date API spec we share with client + be able to confirm that changes on provider won?t break current client interactions with us

void.alexey
2019-06-06 19:02
So from these points I came up with idea about using pact + Atlassian tool for swagger spec verification

bethskurrie
2019-06-07 00:43
@void.alexey if your consumer is not actually generating a pact from their own consumer tests, Pact is not going to help you much. In this case, you're best off providing them a swagger document, and then making sure (either by generating the swagger from the code, or via a swagger verification tool like dredd) that your swagger document and provider are in sync.

bethskurrie
2019-06-07 00:43
Peeps - the long awaited "Feature support table" is available here: https://docs.pact.io/feature_support Thanks to @tjones for making me get off my ass and write it.

tjones
2019-06-07 00:45
I love it!

acooper106
2019-06-07 01:21
/usr/lib64/ruby/gems/2.6.0/gems/sequel-5.21.0/lib/sequel/adapters/postgres.rb:206:in `initialize': PG::ConnectionBad: timeout expired (Sequel::DatabaseConnectionError)looks like this has returned. is this issue on my side?i updated the version of ruby https://koshigoe.github.io/ruby/2019/02/06/ruby-2.6.1-bundler-1.17.2.html

bethskurrie
2019-06-07 01:21
Yes, it is an issue on your side. Your ruby process cannot connect to the database.

acooper106
2019-06-07 01:22
hmm ok sometimes its does and sometimes its doesnt

bethskurrie
2019-06-07 01:22
Sounds like you have some kind of intermittent network issue.

acooper106
2019-06-07 01:23
and from that article looks like that combination of bundler and ruby had issues so i upgraded to 2.6.2

bethskurrie
2019-06-07 01:23
Again, you need your own ops people to help you with this.

bethskurrie
2019-06-07 01:23
Again, I recommend you use the docker image.

bethskurrie
2019-06-07 01:23
I have not tested the broker on ruby 2.6

bethskurrie
2019-06-07 01:24
It has been well tested on the version of ruby that is in the docker image.

void.alexey
2019-06-07 04:31
Thank you. Dredd is a good fit, but their golang hooks seems to be not so easy to use, compared to pact provider states :(

dennis.woditsch
2019-06-07 11:12
has joined #general

yousafn
2019-06-07 11:56
That is quality, good work team. There are a few features that I would love to get into pact-js when time allows :slightly_smiling_face:

yousafn
2019-06-07 11:56
Is it worth having the titles of the repo?s as links to the github repos for ease of convenience

bethskurrie
2019-06-07 11:57
I can add links, good idea.

bethskurrie
2019-06-07 11:59
Overall, I found dredd not as flexible as pact, but better than not verifying at all.

sgoodarzy
2019-06-07 21:28
has joined #general

hboddupalli
2019-06-07 21:31
has joined #general

sgoodarzy
2019-06-07 21:34
Hello @everyone I'm very new to pact so I'm gonna say beforehand that I'm sorry if my question is stupid. In the publisher/subscriber communication model , if service A is publishing messages to service B which one is consumer and which one is provider ?

matt.fellows
2019-06-08 02:28
Not stupid! Service B is the consumer. It is the one that consumes the message, so it must be able to handle what is published.

luchillo17
2019-06-08 20:22
Hey guys do you know why pact can't find our provider if we have it running? maybe because it's apollo? the object above are the options passed to the verifier, any idea?

yousafn
2019-06-08 21:42
Maybe try localhost rather than 0.0.0.0

luchillo17
2019-06-08 21:48
@bethskurrie Ok after debugging we found something interesting, we're passing the host url, but as you see in the image, the host url used in the verifier command is not using what we sent it, i think it might be a bug

pact.io
2019-06-08 22:06
the broker stores your pact contracts. the provider is your service under test

yousafn
2019-06-08 22:23
it always reads as that, see my image. The issue is it can?t hit your provider, on 0.0.0.0. Your error states nothing found on port 3001, so it is reading your providerBaseUrl correctly

yousafn
2019-06-08 22:24
my providerBaseUrl in the screenshot is actually `https://petstore.swagger.io`

yousafn
2019-06-08 22:24
but the verifier shows it as `--provider-base-url 'http://localhost:53146'`

yousafn
2019-06-08 22:25
try `localhost:3001` instead of `0.0.0.0:3001`. Can you curl your service on `0.0.0.0` ?

matt.fellows
2019-06-08 22:39
@luchillo17 this is normal, the node process proxies your API to be able to do state handling and request filters

matt.fellows
2019-06-08 22:57
You probably need to or fix your provider got name with `http://`

luchillo17
2019-06-09 00:26
Yep indeed i found out later it was being proxied, and had to split my host config in 2 variables, one for the server and another with `http://localhost` for the other, now it works. Thanks @yousafn @pact.io @matt.fellows

matt.fellows
2019-06-09 00:31
You?re welcome. Could you please raise an issue on pact-js for this? We should probably provide better validation to indicate that problem

luchillo17
2019-06-09 00:36
Sure

luchillo17
2019-06-09 00:41
Hmm i think it should be in pact-node since it's the server side right?

matt.fellows
2019-06-09 00:43
Raise it in Pact JS and we?ll worry about the implementation. Pact Node shouldn?t really be a client facing thing for the most part

matt.fellows
2019-06-09 00:43
But thanks for thinking that way

matt.fellows
2019-06-09 00:43
It might end up in Pact Node

luchillo17
2019-06-09 00:43
I mean i looked through my lock file and pact-js was nowhere to be seen, but ok, i'll raise it there

matt.fellows
2019-06-09 00:45
Oh I see. sure, pact node is fine

matt.fellows
2019-06-09 00:46
hmm really? The fact that your code is going through that proxy (i.e. your host name is changed) tells me you must be using pact js

matt.fellows
2019-06-09 00:47
the dependency will be `@pact-foundation/pact`

luchillo17
2019-06-09 00:47
Yes i'm using that one

matt.fellows
2019-06-09 00:47
that?s pact js

luchillo17
2019-06-09 00:47
In it's dependencies i saw pact-node

luchillo17
2019-06-09 00:47
Ah ok


vetisanvasile
2019-06-10 12:48
has joined #general

vetisanvasile
2019-06-10 13:05
hi

anddreiu
2019-06-10 13:11
has joined #general

matt.fellows
2019-06-10 13:16
:wave:

vetisanvasile
2019-06-10 13:37
I would like to ask if I could post here a question that I posted on stackoverflow but remained without an answered

yousafn
2019-06-10 17:20
@vetisanvasile - ask away, plenty of friendly people here, or post a link to your SO question :call_me_hand:

trent.grover
2019-06-10 19:14
has joined #general

acooper106
2019-06-10 19:15
my team believes that the docker image does not work with our integration of id vault (i'm not sure why they would say that I would have to look into this more). However they would like to continue with the current setup. And are wondering how the container would solve our stability issues and are asking the question below:

acooper106
2019-06-10 19:16
1. Can we ask Beth if we are able to run broker on multiple nodes? Ideally would like to have multiple instances running broker app which points to 1 RDS We only have one node behind the ELB . Does pact support HA where we can have N nodes running connected to the same DB ?

acooper106
2019-06-10 19:17
i believe you mentioned this earlier. that "Pactflow (the hosted Pact Broker) runs in a "highly available architecture", and the fact that it is "highly available" is not much to do with the underlying Ruby application, and mostly to do with the way it is run and deployed (multiple ec2 instances, no downtime deployments, monitoring, auto scaling etc)."

acooper106
2019-06-10 19:17
so does this mean that my current configuration is already leveraging this design out of the box

acooper106
2019-06-10 19:19
or were you saying that if we use the aws ECS container then we would get this HA configuration out of the box

matt.fellows
2019-06-10 21:27
Yes, it can be run on multiple nodes behind a load balancer. It's a stateless design as per modern API design, so no need for sticky sessions etc

matt.fellows
2019-06-10 21:38
If you could reshare your q here, we'll make sure it gets updates if it's answered here

yousafn
2019-06-10 23:21
Hey up, I had an initial stab at this yesterday Hopefully I?m going in the right direction https://github.com/pact-foundation/pact-support/pull/69 Ps. Wife is a-ok after the op!

matt.fellows
2019-06-10 23:23
> Ps. Wife is a-ok after the op! That?s awesome news!

vetisanvasile
2019-06-11 06:09
oky, so a bit of background first Ia have two applications (one - tConsumer that requires some data from wProvider) And I have to set up an automation framework to write the provider part for pact. My automation framework is a standalone maven app (like new Java Project -> maven...so on)

vetisanvasile
2019-06-11 06:09
I need to execute a @State for my provider in order to set up some data


n.chachampis
2019-06-11 06:37
has joined #general

yousafn
2019-06-11 12:19
good post written by the team at atlassian about spec-first API dev, with swagger and pact https://www.atlassian.com/blog/technology/spec-first-api-development

colin.moorehill
2019-06-11 15:43
has joined #general

matt.fellows
2019-06-11 21:05
They?re doing some cool stuff out there. I?ll reach out to James to see if there is anyway we can continue to collaborate. Ben Sayers and Mauri did a great talk a few years back too, and we?ve been in pretty good dialogue since

aniela.cole
2019-06-11 23:04
has joined #general

calvin.mcstein
2019-06-11 23:04
has joined #general

gabrielle.gasse
2019-06-11 23:05
has joined #general

calvin.mcstein
2019-06-11 23:14
:wave: good folks, I have a noobie question. Can pact tests be implemented in a language (ex: pact-js) regardless of whether the application has been (ex: spring boot). I'm evaluating if this can be tool-agnostic and I'm leaning towards a javascript implementation.

bethskurrie
2019-06-11 23:17
You typically need the consumer side to have an implementation in a matching language. The provider side, you can be more agnostic about the language, though it helps to have a matching one because the tooling can be managed with your normal language tools.

bethskurrie
2019-06-11 23:17
You can use pact jvm for a spring boot app.

bethskurrie
2019-06-11 23:18
The consume and provider languages don't need to match.

calvin.mcstein
2019-06-11 23:32
yep, that makes sense. Thanks @bethskurrie

matt.fellows
2019-06-12 01:34
@uglyog are you able to help?

matt.fellows
2019-06-12 01:35
Sorry @vetisanvasile I probably can?t easily help with the maven issue, but I?ll take a quick look

matt.fellows
2019-06-12 01:41
From what I can tell, the `@State` annotation is not supported for the Maven plugin


richard.jones
2019-06-12 02:28
Just reading the ?Effective Pact Setup Guide? under ?Configure pact to be verified when provider changes? AFAICT the provider verification (for a new provider version) will just verify the latest pacts from the consumer. Assuming that there?s a feature branch and a prod pact registered, the provider?s verification will probably only check that feature pact, and not prod. All good for the feature branch - it?s status is updated to reflect potential changes in the provider, yay! You can force the checking of prod pacts by having a separate, explicit prod check (which is probably a good idea so that build can *fail* if the prod pacts fail). All good. Except what if there?s more than one feature branch in flight for a consumer? How do we ensure all *in-flight feature pacts* are checked when the provider changes?

bethskurrie
2019-06-12 02:29
You win all the points for working out what one of the upcoming features is :wink:

bethskurrie
2019-06-12 02:30
At the moment, you need to explictly add the tag of the "work in progress" pacts to your verification. But these will be pulled in automatically very soon as "pending" pacts (ones that don't fail the provider build).

bethskurrie
2019-06-12 02:32
Some teams use matching tag names for the consumer/provider branches. So, consumer publishes 'feat-x' pact, from branch 'feat-x'. Provider has makes a matching branch called 'feat-x'. The default pact verification step dynamically verifies the consumer tag matching the current git branch name, and master.

richard.jones
2019-06-12 02:40
Ahh yep. Honestly, we probably won?t implement proper tagging before pending is implemented :slightly_smiling_face:

bethskurrie
2019-06-12 02:52
You guys!

bethskurrie
2019-06-12 02:52
Well, points for perseverance.

tjones
2019-06-12 02:59
We've solved this in the past by taking "latest" as work-in-progress, and only explicitly tagging prod

bethskurrie
2019-06-12 02:59
That's a simple and reasonable first step.

tjones
2019-06-12 03:00
that strategy might mean that you're not testing all pacts (because the latest might be a feature branch, if you're doing feature branches), but if you do a can-i-deploy before you deploy, it doesn't matter

richard.jones
2019-06-12 03:00
yeah, I?m not sure that solves the problem of having multiple features in flight

richard.jones
2019-06-12 03:01
webhooks only fire on pact content changes too, so another what-if has come up in our discussions. Let?s say this sequence happens: 1. consumer publishes feature pact, broker marks as pending 2. provider verifies pending pacts, result in the feature pact marked not-pending 3. provider makes a change which breaks the pact, but their checks only run against consumer master and pending pacts 4. provider releases to prod 5. consumer can merge and release their feature, and as far as I can tell because there?s no change to their pact, there?s no provider verification and the feature is now broken.

bethskurrie
2019-06-12 03:01
It doesn't really, but at least it stops you deploying anything broken.

bethskurrie
2019-06-12 03:02
> provider verifies pending pacts, result in the feature pact marked not-pending

bethskurrie
2019-06-12 03:02
It depends on which branch of the provider.

tjones
2019-06-12 03:02
^ Exactly. This is what I care about

bethskurrie
2019-06-12 03:02
Are we assuming you're using branches/tags for your provider, or not?

tjones
2019-06-12 03:03
Also, having multiple features in flight is going to cause other problems, not just with Pact. How do you solve those?

richard.jones
2019-06-12 03:03
I?m not entirely sure how provider tagging works yet :sweat_smile:

bethskurrie
2019-06-12 03:03
Let's say no then.

bethskurrie
2019-06-12 03:04
At step 5, the pact changed webhook will fire because you've now merged that content into master.

bethskurrie
2019-06-12 03:04
It will fire because the content has a new tag.

bethskurrie
2019-06-12 03:04
Oh, you're not using tags...

richard.jones
2019-06-12 03:05
oh, the tags are included in the pact contents for contract_content_changed!!

bethskurrie
2019-06-12 03:06
unintentionally, yes. there was a pr that I merged without really considering the impact. The logic is this: for each of the tags that the consumer version has been given, check to see if the content is different from the previous latest version with that tag.

bethskurrie
2019-06-12 03:06
Think of a series of tagged versions forming a 'pseudo branch'.

richard.jones
2019-06-12 03:06
We were reading the webhooks docs to see if that was the case, and concluded that the tags didn?t come into its ?triggered when the content of the contract has changed?

richard.jones
2019-06-12 03:07
If tags trigger a new contract_content_changed then all my (current, lol) problems are solved :slightly_smiling_face:

bethskurrie
2019-06-12 03:07
in your case, it will trigger because you have no tags, and the content is different from the previous latest pact.

richard.jones
2019-06-12 03:08
but in my scenario the content of the pact doesn?t change from the version published in step 1

bethskurrie
2019-06-12 03:08
You don't have "feature" pacts, you only have "latest", because you don't have tags.

bethskurrie
2019-06-12 03:09
the can-deploy check is the thing that stops you deploying a broken integration.

bethskurrie
2019-06-12 03:09
and this is where you really need tagging.

richard.jones
2019-06-12 03:09
This is all assuming that we do implement tagging. So for ?feature pact? I mean ?a pact tagged as feature-x?. My apologies that wasn?t clear.

bethskurrie
2019-06-12 03:09
though, I guess if you have one broker for production, and one for dev, then you might get away with it.

bethskurrie
2019-06-12 03:10
`can-i-deploy --pacticipant Foo --version X` will make sure that version X is compatible with the latest versions of all the other apps that Foo has a pact with.

richard.jones
2019-06-12 03:10
But the sticking point for us was that tag changes (with otherwise identical pact content) didn?t appear to trigger a webhook verification

bethskurrie
2019-06-12 03:11
but you're not using tags?

richard.jones
2019-06-12 03:13
We?re going to be using them, but in order to do so I need to convince people here to use them, which means I need to be able to explain how the workflow changes, and I was just doing that and the person I was explaining it to came up with the what-if that I posted. I couldn?t see how, at step 5, can-i-deploy won?t have an out of date passing verification to work from. The feature pact won?t have been re-verified when the provider merges their breaking change. But if I understand you correctly, the pact *will* be re-verified (even though it?s the same content) because when the consumer merges it, it?s now tagged with a different branch name (?master? instead of ?feature-x?) and that causes the webhook to fire.

bethskurrie
2019-06-12 03:14
yes

richard.jones
2019-06-12 03:14
\o/

richard.jones
2019-06-12 03:14
thank you again

bethskurrie
2019-06-12 03:15
np

richard.jones
2019-06-12 03:19
Lots of communication, and sometimes feature toggles. It doesn?t happen often.


bethskurrie
2019-06-12 03:48
I've just written an article on using can-i-deploy https://github.com/pact-foundation/pact_broker/wiki/can-i-deploy @richard.jones would love your feedback (and anyone else's feedback too). I'll move it to http://docs.pact.io when I've worked out where to put it.

richard.jones
2019-06-12 03:49
oooh! reading it now :slightly_smiling_face:

bethskurrie
2019-06-12 03:52
@tjones you're our resident copywriter, I'd love your feedback too when you have time.

richard.jones
2019-06-12 03:52
that?s a fantastic explanation, thanks Beth!

bethskurrie
2019-06-12 03:52
Does the reason for provider tags make sense now?

richard.jones
2019-06-12 03:55
yep!

bethskurrie
2019-06-12 03:56
win

bethskurrie
2019-06-12 03:57
So the "stage" tags (test, dev, prod) are used for can-i-deploy, while the branch tags (master, feat-x) are used for managing feature development.

bethskurrie
2019-06-12 03:58
I did some work on splitting them out into separate underlying relationships (stage and branch), but I lost momentum on it.

bethskurrie
2019-06-12 03:59
I was thinking of changing the stage tags into "deployment" resources with extra details, and then I just overthought it and ground to a halt!

tjones
2019-06-12 03:59
I think we don't want Pact to be opinionated about how you're doing your branching (if at all)

bethskurrie
2019-06-12 04:00
yeah, that was one of my other thoughts - tags are quite unopinionated.

tjones
2019-06-12 04:00
for example, I prefer not to do feature branches. I think the ideal Pact tagging structure then becomes just "where is this deployed?"

tjones
2019-06-12 04:00
Well, it's nice to have guides for different styles of working

tjones
2019-06-12 04:01
There's an AWS article about how to get git-flow working in their CI/CD products. It starts with a note that is like "full disclosure, we encourage our teams not to work this way. But, if you want to - here's how you can do it"

bethskurrie
2019-06-12 04:01
ha

bethskurrie
2019-06-12 04:19
@richard.jones are you across the "passing the URL of the changed pact to the provider pact verification job using webhook template parameters" technique?

richard.jones
2019-06-12 04:39
I have noted that in our planning, yep. I?m not sure how easy it?ll be to implement in practise across all our teams.

anddreiu
2019-06-12 06:28
Hi @matt.fellows. So there is no way to run a class annotated with @RunWith(PactRunner.class) using mvn pact:verify? In that class we would have @State and some other code which we would like to invoke when verifying the pact (for example, we are altering the request body) in a method annotated with @TargetRequestFilter

matt.fellows
2019-06-12 06:41
It doesn't seem like it. Hopefully when Ron gets a moment he can contribute to the discussion

anddreiu
2019-06-12 06:43
I have also tried to run it with maven surefire plugin, using mvn test command, but this way it's not able to connect to a pact broker using https - not sure how to solve this

anddreiu
2019-06-12 06:45
this is a little bit strange, because using the IDE it is able to connect to the pact broker (I am using the annotation for PactBroker, having also authentication), but when running as maven, it does not

matt.fellows
2019-06-12 06:57
Sure. I'm not a Java dev so hard for me to comment as to why it's the case. If you're running in your ide but not using maven that might be telling. All I'm saying is the docs don't suggest it's possible

poojashukla9219
2019-06-12 07:37
has joined #general

thavamani.raja
2019-06-12 08:41
has joined #general

anddreiu
2019-06-12 10:37
I just want to let you know that I have managed to solve the maven https issue using parameters for trustStore when running the maven command: -Djavax.net.ssl.trustStore=/path/to/file/cacerts -Djavax.net.ssl.trustStorePassword=password

iamtarasshevchenko
2019-06-12 11:21
has joined #general

matt.fellows
2019-06-12 12:02
Right, so you must be using a self-signed certificate somewhere

anddreiu
2019-06-12 12:02
yes, exactly

matt.fellows
2019-06-12 12:03
:thumbsup:

jrubial
2019-06-12 12:27
has joined #general

codrut.gusoi
2019-06-12 12:40
has joined #general

vetisanvasile
2019-06-12 12:50
@matt.fellows I also think that currently there is no way to execute @State from maven plugin. Thanks for the answer

codrut.gusoi
2019-06-12 12:53
:wave: Hello everyobdy. Any chance someone could help me out with writing a message contract test for clojure? I see there is an example here https://github.com/DiUS/pact-jvm/blob/master/consumer/pact-jvm-consumer-junit/src/test/clojure/au/com/dius/pact/consumer/example_clojure_consumer_pact_test.clj but that file uses HTTP. What would `config (-> (MockProviderConfig/createDefault))` need to be replaced with for it to work with `MessagePactBuilder`? I see `ConsumerPactRunnerKt` tries to run a mock server.

matt.fellows
2019-06-12 12:58
:+1: sorry :persevere:

thomas.scheuchzer2
2019-06-12 13:17
has joined #general

acooper106
2019-06-12 13:28
I was really asking if its with our current setup or it only configured that way within the container?

enrique
2019-06-12 15:00
has joined #general

detert
2019-06-12 15:17
Which regex would you use, if you describe a field lastName or firstName? Is `.+` too generic?

detert
2019-06-12 15:19
Or would you use `Pact::SomethingLike('John')` for example?

mounikachirasani
2019-06-12 15:38
has joined #general

enrique
2019-06-12 15:42
If any string is a valid `lastName` then I would use exactly that

enrique
2019-06-12 15:43
If you have some validation requirements I would describe them as a regular expression

enrique
2019-06-12 15:43
And I meant validation requirements from the consumer side, the consumer side really cares about the format.

detert
2019-06-12 15:48
Well the consumer does not really care. It might be something like "John Martin" as well

detert
2019-06-12 15:49
Maybe UTF-8 is important. Maybe

codrut.gusoi
2019-06-12 17:05
I got it working by doing: ``` (ns message-consumer.core-test (:require [clojure.test :refer :all] [message-consumer.core :refer :all]) (:import [au.com.dius.pact.consumer MessagePactBuilder] [au.com.dius.pact.consumer.dsl PactDslJsonBody] [au.com.dius.pact.model PactSpecVersion])) (defn process-message "I do cool stuff" [message] (str "Got: " (.toString message))) (deftest clojure-message-consumer-pact-test (let [builder (-> (MessagePactBuilder/consumer "message-consumer") (.hasPactWith "message-provider")) content (-> (new PactDslJsonBody) (.stringValue "Important" "Data")) pact (-> builder (.given "Some condition") (.expectsToReceive "an important message") (.withMetadata {"contentType" "application/json"}) (.withContent content) (.toPact))] (let [interaction (-> pact (.getInteractions) (first)) message-body (-> interaction (.getContents) (.valueAsString))] ;; This is where the fun begins! (let [result (process-message message-body)] (is (= result "Got: {\"Important\":\"Data\"}"))) (.write pact "./pacts/" PactSpecVersion/V3)))) ```

codrut.gusoi
2019-06-12 17:05
Is there a better way?

phall
2019-06-12 20:28
Hi all, we?re developing a micro service architecture, with communication via REST. One area we?re having difficultly with is multiple consumers requiring similar provider states. e.g. Two consumers each want a similar response when a resource exists at a URL. ConsumerOne writes a provider state ?resource exists?, ConsumerTwo writes the same state as ?resource found?. The two consumers do not (and should not) know about each other. Should the provider accept all the various permutations of the same state? Or should there be a shared library, or external process to manage these states?

matt.fellows
2019-06-12 22:11
I?d get them to standardise on the state if possible. Maybe the two consumers don?t know about each other, but the provider should know about its consumers and there should always be a conversation between the consumer/provider before a pact is ?accepted?.

matt.fellows
2019-06-12 22:12
If I was the provider team, I?d ?reject? the pact and tell them to use the other already existent state

matt.fellows
2019-06-12 22:12
We?re working on making the known states available in the Broker (http://pactflow.io) to make this sort of thing easier for consumers to discover

uglyog
2019-06-12 22:56
I've added an additional answer on SO

richard.jones
2019-06-13 00:34
Looks good, thanks!

bethskurrie
2019-06-13 04:18
:pray::skin-tone-3: :pray::skin-tone-3: :pray::skin-tone-3: Hey all! There have been quite a few PRs coming through lately, and I just wanted to thank everyone who has contributed to any of the Pact code or docs. Maintaining and developing on such a large number of codebases and across so many languages (there are 46 repos in pact-foundation alone!) is a big task, and your assistance is greatly appreciated. :pray::skin-tone-3: :pray::skin-tone-3: :pray::skin-tone-3:

bethskurrie
2019-06-13 04:19
Side note, `Pact.like("John")` is shorter.

matt.fellows
2019-06-13 04:27
:point_up: this ++

matt.fellows
2019-06-13 04:27
Thank you. Special call out to @yousafn who I know I?m neglecting in GitHub but know that I _will_ get to your queries/efforts :smile:

detert
2019-06-13 05:52
:smiley::+1:

gerwin.vaatstra
2019-06-13 07:05
has joined #general

yousafn
2019-06-13 08:27
It?s our small way of saying thank you to you all, for doing all this for free, in your spare time. As Beth states, 46 repos, let alone 1 is a mammoth task, alongside your full times jobs, and the release of pact-flow. Don?t worry about getting back to me quickly - you?ve got bigger fish to fry, and we will work around stuff in the day job, but feedback where we can do help improve pact for everyone. Just glad to be able to help out, find it very empowering and it embodies all the good in FOSS. Just make sure you don?t burn yourselves out guys :heart::heart::heart:

yousafn
2019-06-13 08:28
Your NOT neglecting me homie, trust me! You?ve don?t owe us users anything but you give us everything. Much respect

matt.fellows
2019-06-13 11:25
It?s a great feeling, seeing somebody raise an issue for the first time or send a PR.

matt.fellows
2019-06-13 11:25
?OMG somebody is using my _thing_!?

anna.lakstigala
2019-06-13 12:34
has joined #general

neonmd
2019-06-13 15:19
has joined #general

vivek.125
2019-06-13 19:43
has joined #general

vivek.125
2019-06-13 19:43
~hi, how can i get the request reponse logs when running a provider?~

kalinets
2019-06-13 20:01
has joined #general

canomn
2019-06-13 21:05
has joined #general

canomn
2019-06-13 21:19
Hey pact peeps, I'm interested in implementing contract tests at my company, but am a bit unsure of how to get started. Our project consists of two teams, a frontend team, using angular (typescript) and a backend team, using .NET (C#). where do contract tests fit in this situation? what team owns them?

yousafn
2019-06-13 22:15
your consumer will create pacts and publish them to a pact broker. I assume your front-end is calling the backend C# service. your provider (the backend) can then verify that they meet those pacts, and publish the verification results to the broker. Everyone can use can-i-deploy, to find out if they can deploy their services to a particular env. it?s often called consumer driven contract testing, because your consumers provide a contract, as to what they are consuming, from the provider, however in reality, it?s collaborative, the provider should have a vested interest in the contracts, so ownership should be shared, if that makes sense try the pact nirvana guide with steps 1/2, see how you go, and then you can begin to roll it out, as you get buy it. https://docs.pact.io/best_practices/pact_nirvana

yousafn
2019-06-13 22:25
Hah, yes THIS! I built a slack reporter for cypress, as my first open source thing, and someone posted the first issue and I was so happy (even if they had an issue) that the first line of my reply was ``` Hey buddy, thanks for using my plugin! woop woop! ``` I?ve now got 25 odd stars across my few repos and it?s a great feeling. When I?m not playing with computers, I?m tinkering with old cars, and I have written countless guides to help others with engine conversions and the like, so it?s natural to do the same with tech. Wish I had started earlier in my career, but it?s never too late.

matt.fellows
2019-06-14 01:01
start with a consumer contract in your Typescript application for a single API endpoint and a happy scenario (e.g. `GET /users/` should return a list of users and a `200` response). Then publish to a Pact Broker (e.g. hosted at http://pactflow.io or otherwise) and then get your provider team to verify the contract

matt.fellows
2019-06-14 01:02
The contract is owned by the consumer team, but as Yousef says - it?s a collaborative thing. So step 1 is get the two teams talking to each other and agreeing on building the prototype, and measuring the outcomes of the experiment

cjadav
2019-06-14 05:38
has joined #general

anddreiu
2019-06-14 13:34
hi guys. I have added a question on github: https://github.com/DiUS/pact-jvm/issues/893 Did anyone else see this problem? maybe I am doing something wrong and I don't know why the verification reports don't contain all the interactions from my pact file

mui_ume
2019-06-16 11:54
has joined #general

bethskurrie
2019-06-16 22:05
@anddreiu please ask on #pact-jvm

bethskurrie
2019-06-16 22:10
Peeps. We're discussing the issue that some people are having with integers not matching floats/doubles when doing type based matching in pact-js (and other implementations that use the ruby impl under the hood). The ruby implementation has never treated these as equivalent, however, it turns out that the pact-jvm implementation has. Pact specification fail. Anyway, We're discussing adding a flag to make integers/floats match during verification time, and wondering if that should actually be the default behaviour. It would be technically breaking backwards compatibility, but maybe that's ok... thoughts?


matt.fellows
2019-06-16 22:24
I'm leaning towards just making it the default behaviour. Another better option would be to allow the two new matchers on int/floats (i.e. precise matching) and keep the existing matcher as a general "number". No need for flags, but granted it confuses the spec implementation

abubics
2019-06-16 23:27
I would've expected JSON numbers (i.e. decimal) to be the default, and integers only if explicitly specified. But I don't have anything to break right now . . . :sweat_smile:

uglyog
2019-06-16 23:50
Just a note (based on some testing I have done) JSON parsers can return a different type depending on the format of the number. Decimal may not be the default.

bethskurrie
2019-06-16 23:51
ruby has bigdecimal for very large floating point numbers, but float for smaller ones

matt.fellows
2019-06-16 23:57

matt.fellows
2019-06-16 23:58
but I have similar experiences to Ron. For example, in NodeJS a whole number decimal (e.g. 7.0) will be rounded to 7. So even if you wanted a float, you would have to specify something else (which is a bit confusing)

matt.fellows
2019-06-17 00:00
NodeJS floating point information loss

uglyog
2019-06-17 00:00
And different parsers in different languages can do something different.

matt.fellows
2019-06-17 00:00
mmm


uglyog
2019-06-17 00:01
Scala always returned floats, Groovy would return Integer or BigNumber.

matt.fellows
2019-06-17 00:01
> JSON has no standard way to represent complex numbers, so there is no way to test for them in JSON Schema.

giancarlo.dipaolanton
2019-06-17 00:21
has joined #general

abubics
2019-06-17 00:37
A cool* thing I found using Jackson (in Kotlin): JSON numbers could be configured to come through as `Int`/`BigInt` and `Double`/`BigDecimal`, but it would still always throw precision away if the fractional part was all zeroes

mui_ume
2019-06-17 06:00
Hi Do you have any boilerplate project for me to get started on using pact with react native app as the front end client talking to services at the backend

mui_ume
2019-06-17 06:00
I like to use Javascript thanks

matt.fellows
2019-06-17 06:27
Are the existing JS examples not relevant? React native is just JS and react so nothing different

yousafn
2019-06-17 06:50
We use decimaljs at work in JavaScript on our consumer side but send them in strings, so that precision is maintained, ( as it goes through to 2 java rest services and then encoded in a soap message ) - our java services use Jackson

mui_ume
2019-06-17 06:51
Can I have my pact test repo separated from My react native app source code ?

bethskurrie
2019-06-17 06:52
What problem are you trying to get around?

bethskurrie
2019-06-17 06:52
Typically they're in the same codebase as the tests are run along with the other unit tests.

yousafn
2019-06-17 06:52
We had an argument when our provider changed their format in the specs to number, for fields that could contain integers or floats, when we had previously agreed on string, so they changed it back . PayPal use string in their api spec

matt.fellows
2019-06-17 06:54
Yep, it?s a good idea if you don?t want to lose precision over the wire

bethskurrie
2019-06-17 06:54
mm. typically people use strings or integer cents because of the whole precision thing.

bethskurrie
2019-06-17 06:54
sad!

bethskurrie
2019-06-17 06:54
stupid computers.

mui_ume
2019-06-17 06:56
I?m trying to setup the pact test with react native app And I am putting the API call http request and response Those response in Json format

mui_ume
2019-06-17 06:57
Looking at the example I?m quite confused

bethskurrie
2019-06-17 06:57
How does that relate to putting the pact tests in another codebase?

abubics
2019-06-17 06:58
it's the only thing I know is handled pretty well in XML :troll:

abubics
2019-06-17 06:59
Also, integer cents falls down in some finance cases . . . where they have fractional cents, because they like inventing new ways to hurt themselves :upside_down_face:

mui_ume
2019-06-17 07:00
If I use the same codebase Do I create a subfolder called test and put all my spec js file there And do a npm install at the package.json

mui_ume
2019-06-17 07:01
Do you have a simple example how to add a pact test and any npm package to Install ?

matt.fellows
2019-06-17 07:11
What is confusing about the examples on the pact js repository?

matt.fellows
2019-06-17 07:12
they collectively cover a lot of scenarios. I can have them updated if they are confusing

matt.fellows
2019-06-17 07:12
the jest/mocha examples are pretty basic

matt.fellows
2019-06-17 07:12
And yes, I typically have tests within the codebase in a subfolder that groups them together

mui_ume
2019-06-17 07:13
Ok if that is needed I will talk to the developer to add the subfolder there I need to get started and will take a look at the jest /mocha example

yousafn
2019-06-17 07:40
Tests need to be in your root dir with react ( usually src) but can be in any folder. Ideally call your tests .pact.js to seperate from unit tests but you want them in the same codebase so you are testing your codes api clients

yousafn
2019-06-17 07:42
Create react app?s jest config excludes any test files outside of the rootDir by design and cannot be overridden unless you eject from the CRA default ( but then you have to manage all your deps separately ) collaborating with your dev is best, as you want them to treat the pact tests as unit tests and be part of their dev workflow :ok_hand:

mui_ume
2019-06-17 07:44
Thank you Will start working on that

fili.projetto
2019-06-17 10:14
has joined #general

mui_ume
2019-06-17 10:41
Hi, I just have a look at https://github.com/pact-foundation/pact-js. I still do not quite understand how to integrate this into my react native app folder


mui_ume
2019-06-17 10:44
currently the react-native app does not have any jests' __test__ folder

mui_ume
2019-06-17 10:45
is there a simple example, just to see how pact is setup for a react native app? without any irrelevant folder and files?

matt.fellows
2019-06-17 10:46
Not in the pact js repository. We'd happily accept an example if someone is willing to share

mui_ume
2019-06-17 10:46
I also does not quite understand the content of pactSetup.js, I added to my react native app folder, there is alot of syntax error in my VS code, so I don't know what is not needed

matt.fellows
2019-06-17 10:48
Have you written any unit tests for a react native app before?

mui_ume
2019-06-17 10:48
no. I am in QA. I did on end to end testing only. I am familar with appium

mui_ume
2019-06-17 10:49
but now I want to setup pact

matt.fellows
2019-06-17 10:52
Think of Pact as just another unit testing framework. There is nothing specific to react native required to do this testing. My suggestion is to pair with a developer who's written unit tests and get their input on setting it up and then you can write the tests independently

matt.fellows
2019-06-17 10:53
May I ask, is this something you're investigating or has somebody else asked you to do?

mui_ume
2019-06-17 11:06
My own accord I feel the need for pact To complement unit testing and end to end testing As I see it?s benefits that pact will bring to the team

mui_ume
2019-06-17 11:06
I will study jest myself first and see how to go from there

matt.fellows
2019-06-17 11:16
That's awesome!

matt.fellows
2019-06-17 11:18
See if you can get a basic unit test in, and then add in Pact

matt.fellows
2019-06-17 11:18
You might want to jump in #pact-js to get more specific support

mui_ume
2019-06-17 11:34
thanks for directing Matt

phall
2019-06-17 13:26
Fantastic! That sounds like a plan.

drambhia
2019-06-17 15:12
has joined #general

harryzhu2011
2019-06-17 23:58
has joined #general

agarwalatrisha1212
2019-06-18 03:15
has joined #general

arturs.savickis
2019-06-18 03:24
has joined #general

tuan.ho
2019-06-18 03:26
has joined #general

dalsidhu99
2019-06-18 10:50
has joined #general

goncalo
2019-06-18 12:51
has joined #general

christopher.f.almanza
2019-06-18 20:12
Do `@pact-foundation/pact-js` support registering a `GET` interaction that contains a Request body?

bxj231
2019-06-18 21:07
has joined #general

matt.fellows
2019-06-18 21:13
It may, but that is a bit strange (not an RFC standard)

clang1
2019-06-18 22:52
has joined #general

abubics
2019-06-18 23:34
Also, heaps of libraries don't support it, so it has portability issues.

mboudreau
2019-06-18 23:41
@christopher.f.almanza why are you doing such a thing?

mboudreau
2019-06-18 23:41
let me guess, trying to get around a CORS issue? :stuck_out_tongue:

abubics
2019-06-18 23:47
The times I thought I wanted to do that, it was often for a complex query that query params couldn't represent well

abubics
2019-06-18 23:48
but then I changed my resource model (and mental model) to represent searches as resources, so POST made even more sense

david.j.smith
2019-06-18 23:50
Default to doubles, it?s the only accurate thing to do. :slightly_smiling_face: Could add to the spec (who knows maybe we?ll even support it one day!) or have implementation specific matchers to add precision, but it wouldn?t work across language boundaries as there?s no guarantee that, say, Scala and Ruby would have those same ?extra? matchers implemented. Still handy for services talking to each other that are built in the same language. Scala-Pact has a whole different matching approach that none of the others support, and I think Pact-JVM has about a million matchers we don?t have - no problem in general - you just have to be careful interfacing with Pact files coming from other sources and stick to the spec at the boundaries of your estate.

christopher.f.almanza
2019-06-19 14:31
Hey guys! We just had a GET endpoint that expected a body. I know this is non-standard and hacky and just bad design, but I needed to give some solid reason about why it shouldn't be like that. I couldn't find the RFC at that moment Luckily, the backend engineer found the RFC for both `fetch` and `XMLHttpRequest`, where it specified that there should be no body on a GET request body, so the endpoint is now using query params as it should

james.reynolds
2019-06-19 14:44
has joined #general

james.hattersley-dyke
2019-06-19 15:30
Hi, might be a daft question I don't know. But someone on my team was asking if we could make Pact part of our service-template because each service by default exposes a /version and a /health endpoint which returns JSON - I'm think it wouldn't add a great deal of value to contract test these because it'd essentially be the same codebase being consumer and provider. What do people think?

james.carman
2019-06-19 15:38
That doesn?t sound like a big value-add to me. We have the same sort of thing, but it?s provided by the Spring Boot Actuator. We don?t do pacts for it

james.hattersley-dyke
2019-06-19 16:34
yeah I'm thinking it's kinda pointless. The only benefit would be that pact tests are there as a starting point right off the bat.

craig.pothier
2019-06-19 19:15
has joined #general

craig.pothier
2019-06-19 19:50
hello, super new to Pact. I've went through a lot of docs, and post but I am having a difficult time understanding how to use this with Lambda functions. I saw the examples on the pact-js github repo and but cant figure something out. I have 2 microservices. They are both lambda, lets call them lambda 1 and lambda 2. Lambda 1 directly invokes lambda 2 and waits for response from the lambda function. To me its almost like Rest API call with request and response but I cant figure out how to do this with Pact and lambda. Anyone have any ideas around this? I think the pact server mock would not work in this case right?

matt.fellows
2019-06-19 22:21
I?m surprised this hasn?t come up earlier

matt.fellows
2019-06-19 22:21
In short, the ?messaging? feature of Pact doesn?t support request/response style messages

matt.fellows
2019-06-19 22:21
cc: @bethskurrie because we were talking about this the other day

matt.fellows
2019-06-19 22:22
That would be the main benefit I see also. You could do it, but it seems like needless overhead. The other would be that the documentation in the broker (if you?re using one) would make it clear to all that those endpoints exist

matt.fellows
2019-06-19 22:23
Funny that I?ve never really had to do that in the wild, most of my lambda invocations are either a) async (fire and forget) or b) behind an API Gateway

matt.fellows
2019-06-19 22:23
If you would kindly raise a feature request on the Pact JS repository that will help it get the attention it deserves


craig.pothier
2019-06-19 22:44
Can you think of any work arounds for this? Should I create my own AWS lambda mock on the consumer side to do this?

craig.pothier
2019-06-19 22:44
Also, thanks for the response above.

craig.pothier
2019-06-19 22:45
Im also unsure what the point of the consumer mock is. It seems weird to me. Is it much faster than writing the pact file by hand? i know im obviously missing something

matt.fellows
2019-06-19 23:13
So in a normal integration test, you would test that your code is able to send messages and handle the response from the system you?re testing against. This implicitly tests a bunch of things, but importantly you can feel comfortable that _your consumer code_ is able to send messages in the right format, and handle the response properly.

matt.fellows
2019-06-19 23:13
(seems obvious)

matt.fellows
2019-06-19 23:16
But now that we aren?t going to be testing the actual provider service directly, we need a way to do two things: 1. Test that your consumer code is able to send messages in the correct format, and properly handle the response (probably into some internal model) 2. Capture the contract as a side effect of this, so we can share it with the provider If you write the pact file by hand, you can?t guarantee (1). You also can?t be sure that (2) doesn?t drift from reality (because your code isn?t being executed). At this point, you might as well just use a static document (like Swagger/JSON Schema), but you can?t convince yourself that your code (and the providers? code) is compatible with it

craig.pothier
2019-06-19 23:18
gotcha!! makes sense. Thanks a bunch for that. Its helpful for me to understand

matt.fellows
2019-06-19 23:24
I _think_ you might be able to do it by writing two separate message tests: one on the consumer side and one from the provider side. But I can see challenges with that approach. Alternatively, you could create a small wrapper that allows you to write an HTTP-style Pact, but filter out the http stuff

matt.fellows
2019-06-19 23:24
@uglyog how do you do this in Pact JVM?

uglyog
2019-06-19 23:31
Invoke lambda is just an HTTP POST request via the AWS lambda service, so either do it as a regular HTTP request/response, or test it at a higher level (as you mentioned) as two message flows

uglyog
2019-06-19 23:32
Looks like we need to bump up our thinking about synchronous messages

matt.fellows
2019-06-19 23:33
yep

matt.fellows
2019-06-19 23:35
Invoking Lambda in the HTTP Post sense is clever, albeit most libraries abstract away that level of detail so would make the testing obscure and detract from some of the nice abstractions lambda gives you. +1 to req/res messages!

bethskurrie
2019-06-19 23:35
We're just going to have to do something messy with the pact spec version

matt.fellows
2019-06-19 23:35
We have all of the infrastructure in place, we lack :timer_clock:

bethskurrie
2019-06-19 23:35
Technically, it should be easy

matt.fellows
2019-06-19 23:35
mmm

abubics
2019-06-20 00:19
If your consumer uses structured data from the health endpoint for something meaningful (e.g. showing status of upstream services, or whatever) then you should have contract tests :slightly_smiling_face: if not, then it doesn't need to be in the contract

alat
2019-06-20 09:48
has joined #general

craig.pothier
2019-06-20 14:18
@uglyog do you happen to have any examples of how you accomplish executing lambda over http post?

closenet.uk
2019-06-20 14:44
has joined #general

uglyog
2019-06-20 22:24
No, I haven?t done it myself. I was only saying it is possible to do.

oswald.quek
2019-06-21 11:12
For a pact with multiple provider states (https://github.com/pact-foundation/pact-specification/tree/version-3#allow-multiple-provider-states-with-parameters), is it possible to specify the ordering in which they are applied at the provider contract testing side?

kevin.meiresonne
2019-06-21 11:14
What's your use case for requiring this? Your provider should be able to deal with any interaction independently, regardless of the order in which they are executed

bethskurrie
2019-06-21 11:18
If you need to rely on the ordering, then either pact is not the right tool for your use case, or you're not using it the way it's meant to be used.

oswald.quek
2019-06-21 11:19
the use case is that a consumer needs to get a Payment from our system, but some fields won't be populated until some confirmatory action has taken place. so it'd be nice to specify the test cases for *Get Payment from Provider* _Provider states_: 1) a payment exists *Get Payment from Provider with bank reference* _Provider states_: 1) a payment exists 2) the payment has a reference and unique id from bank

oswald.quek
2019-06-21 11:19
there are obvious workarounds but i was just wondering whether it were possible to order states

oswald.quek
2019-06-21 11:20
it'd be nice to reuse the "1) a payment exists"

bethskurrie
2019-06-21 11:20
Each interaction is meant to be executed independently of all the others, so that you don't get into the situation where the success of one interaction depends on the success a previous one.

bethskurrie
2019-06-21 11:20
The provider state should set up everything that's needed before hand

kevin.meiresonne
2019-06-21 11:20
it's up to your provider state to setup all that's needed for that interaction. You could have some helper classes to check if "Payment exists", and just call those in each provider state that needs them

kevin.meiresonne
2019-06-21 11:21
you don't want to end up in a situation where changing/removing one interaction can break other interactions

oswald.quek
2019-06-21 11:23
that's potentially an issue but I then wonder why allow multiple provider states in a pact then

oswald.quek
2019-06-21 11:24
cool that's ok

oswald.quek
2019-06-21 11:24
pact is still the right tool, i just need to use one state to set up everything

kevin.meiresonne
2019-06-21 11:24
well, that's easy: you can have multiple outcomes to a single call. Typically you cover those with multiple states

oswald.quek
2019-06-21 11:24
i was thinking about re-using code for the state setup at the provider end

bethskurrie
2019-06-21 11:24
You can reuse it under the hood.

bethskurrie
2019-06-21 11:25
I always create a "test data builder" that I call out to from the provider state handler code

kevin.meiresonne
2019-06-21 11:26
Indeed, so do we

oswald.quek
2019-06-21 11:26
i don't follow. there is only one response in a pact, never multiple responses.

james.carman
2019-06-21 11:27
@oswald.quek are you verifying your pacts against a live, running system?

oswald.quek
2019-06-21 11:27
no, of course not!

james.carman
2019-06-21 11:27
ok, just making sure :slightly_smiling_face:

oswald.quek
2019-06-21 11:27
:slightly_smiling_face:


james.carman
2019-06-21 11:28
The way I typically handle the data setup is very similar to (and is implemented by) training a mock object.

bethskurrie
2019-06-21 11:28
Damn, I didn't need all that code slack!

james.carman
2019-06-21 11:29
So, you?re saying you want to basically use multiple state setups at the same time (with parameters)?

bethskurrie
2019-06-21 11:29
In v3 you can have multiple provider states.

bethskurrie
2019-06-21 11:30
To help break up the test data set up, and be more specific.

bethskurrie
2019-06-21 11:30
I think Kevin is talking about testing different scenarios by having a different provider state per interaction.

bethskurrie
2019-06-21 11:31
In v3 you can do this.

bethskurrie
2019-06-21 11:32
But it's not fully supported in the ruby impl yet, simply because time.

bethskurrie
2019-06-21 11:32
I think I know someone who could help add it though.

james.carman
2019-06-21 11:33
okay, reading it back now. The main thing is that the ordering is needed.

james.carman
2019-06-21 11:33
?is it possible to specify the ordering in which they are applied?

bethskurrie
2019-06-21 11:33
Oooh!

bethskurrie
2019-06-21 11:34
Right. I misunderstood.

james.carman
2019-06-21 11:34
No, you answered about the ordering. I misunderstood :slightly_smiling_face:

bethskurrie
2019-06-21 11:34
They should be applied in the order in which they were defined. Are they not?

james.carman
2019-06-21 11:34
Or, more likely, didn?t pay attention

james.carman
2019-06-21 11:35
I like the idea of having a larger state setup method and letting it reuse the other bits under the hood, as you suggested.

oswald.quek
2019-06-21 11:35
>To help break up the test data set up, and be more specific I think this was what i was trying to achieve. For example I want to achieve a state of "account with id x exists and a payment with id y exists". At the moment I'd have ``` "providerStates": [ { "name": "account and a payment exists", "params": { "account_id": "x, "payment_id": "y" } } ]``` but I wouldn't be able to separate that out into ```"providerStates": [ { "name": "account exists", "params": { "account_id": "x } }, { "name": "payment exists", "params": { "payment_id": "y" } } ]``` because the payment needs to have an associated account with it

bethskurrie
2019-06-21 11:36
Sorry @oswald.quek I thought you were talking about interaction order, not provider state order.

james.carman
2019-06-21 11:36
@oswald.quek you?re putting this stuff in a database?

oswald.quek
2019-06-21 11:36
oh i just looked at all this just now! :smile:

james.carman
2019-06-21 11:36
hence the referential integrity issues?

bethskurrie
2019-06-21 11:37
@oswald.quek what verifier language are you using?

oswald.quek
2019-06-21 11:37
at the provider side, java

oswald.quek
2019-06-21 11:38
i assumed provider states are applied randomly but now i need to double check

james.carman
2019-06-21 11:38
I would think, since it?s a list, that if it?s not ordered properly, that?s a bug

bethskurrie
2019-06-21 11:38
OK, I totally understand the issue now, and it's something I'd wondered about but hadn't had someone ask about it

bethskurrie
2019-06-21 11:38
We need to be able to pass all the states at once into the provider state handler not one at a time

bethskurrie
2019-06-21 11:39
Is that the issue/solution?

james.carman
2019-06-21 11:39
No, he wants to set up multiple states

oswald.quek
2019-06-21 11:39
yes

james.carman
2019-06-21 11:39
But, the states refer to each other, so they need to be set up in a specific order

james.carman
2019-06-21 11:40
For (what appears to be) referential integrity constraints

james.carman
2019-06-21 11:40
So, the account needs to be in the account table before the payment can be inserted into the payment table with a foreign key to the account table

bethskurrie
2019-06-21 11:40
Yes, but there was one giant provider state setter upper that took the entire list at once, it could decide how to set up the data.

james.carman
2019-06-21 11:40
I believe I have that ordering right :slightly_smiling_face:

james.carman
2019-06-21 11:41
Right, if there was an uber state setter upper, that?d work too

bethskurrie
2019-06-21 11:41
I think the problem is that each state is set up separately, and they lose context.

james.carman
2019-06-21 11:41
you?d just pass in a larger structure of data and it?d know how to do the right thing

bethskurrie
2019-06-21 11:41
Yes.

james.carman
2019-06-21 11:42
@oswald.quek was just hoping to reuse/compose these states from the outside I believe

oswald.quek
2019-06-21 11:42
yup

james.carman
2019-06-21 11:42
Rather than having to work with the provider team to add new state setter upper mechanisms

bethskurrie
2019-06-21 11:42
Perhaps we can have a flag for it, so that you could either do them one at a time (existing behaviour) or have an all in one handler (if toggled on).

bethskurrie
2019-06-21 11:43
Hm. Tricky.

james.carman
2019-06-21 11:43
in this case, the states don?t require data from one another. The account id is fully specified in the pact

oswald.quek
2019-06-21 11:43
it's not that big an issue though :smile: i was just wondering if it were possible.

james.carman
2019-06-21 11:43
I guess the big question is, ?are the state definitions executed in order during verification by the provider??

james.carman
2019-06-21 11:44
Does that sum it up?

bethskurrie
2019-06-21 11:44
Yes

james.carman
2019-06-21 11:44
I don?t think that?s a terrible idea, to support that

bethskurrie
2019-06-21 11:44
They are executed in order of definition

james.carman
2019-06-21 11:44
Yeah, that would be the most intuitive outcome

james.carman
2019-06-21 11:44
So, sounds like you can do what you want, @oswald.quek

oswald.quek
2019-06-21 11:45
yup i can confirm they aren't executed in order of definiton

oswald.quek
2019-06-21 11:45
i've just tested it

james.carman
2019-06-21 11:45
Then that?s a bug

bethskurrie
2019-06-21 11:45
@uglyog?

james.carman
2019-06-21 11:45
I?d ping the #pact-jvm channel

bethskurrie
2019-06-21 11:45
This is news to me. Ruby impl does them in order of definition.

oswald.quek
2019-06-21 11:46
ah :slightly_smiling_face:

oswald.quek
2019-06-21 11:46
i'll raise a github issue too

viktor
2019-06-21 11:46
has joined #general

bethskurrie
2019-06-21 11:46
Sorry, we should stop spamming general. I hadn't realised we'd gone off the thread.

oswald.quek
2019-06-21 11:46
i didn't realise there was a #pact-jvm channel! my bad

james.carman
2019-06-21 11:46
There?s certainly something off, then


james.carman
2019-06-21 11:47
The model for the pact indeed stores them as an ordered list. Perhaps it reads them first into a set or something and converts to a list, which would jumble them

james.carman
2019-06-21 11:47
Likely a very simple fix

bethskurrie
2019-06-21 11:47
:thinking_face:

bethskurrie
2019-06-21 11:47
Ron will know.

james.carman
2019-06-21 11:47
indeed

bethskurrie
2019-06-21 11:50
We used to have a German textbook at school where one of the phrases was "mecki weiss alles".

bethskurrie
2019-06-21 11:50
Ron weiss alles!

rakesh_patel
2019-06-21 13:37
has joined #general

rakesh_patel
2019-06-21 14:28
@bethskurrie I am taking over from Allegra from Vanguard

rakesh_patel
2019-06-21 14:30
Does anyone know of the default log file location for broker? wanted to investigate why our broker app went down

nathan2oo3
2019-06-21 14:55
has joined #general

jemmawells
2019-06-21 15:54
has joined #general

craig.pothier
2019-06-21 16:23
Can someone help me troubleshoot some code?

craig.pothier
2019-06-21 16:24
trying to get verify the results from a lambda invoke to a PACT file

craig.pothier
2019-06-21 16:27
the lambda returns results that I then compare against the generated PACT file. The error is as follows: ``` Actual: {"statusCode":200,"body":{"platform":"test","targetId":"default","version":"4.2.2.3259","upgradeUrl":"http://test.com/test.img","upgradeNow":true}} Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown -{ - "statusCode": 200, - "body": { - "platform": "test", - "targetId": "default", - "version": "4.2.2.3259", - "upgradeUrl": "http://test.com/test.img", - "updateNow": true - } -} +{"statusCode":200,"body":{"platform":"test","targetId":"default","version":"4.2.2.3259","upgradeUrl":"http://test.com/test.img","upgradeNow":true}} Description of differences -------------------------------------- * Expected a Hash (like {"statusCode"=>200, "body"=>{"platform"=>"test", "targetId"=>"default", "version"=>"4.2.2.3259", "upgradeUrl"=>"http://test.com/test.img", "updateNow"=>true}}) but got a String ("{\"statusCode\":200,\"body\":{\"platform\":\"test\",\"targetId\":\"default\",\"version\":\"4.2.2.3259\",\"upgradeUrl\":\"http://test.com/test.img\",\"upgradeNow\":true}}") at $```

craig.pothier
2019-06-21 16:27
I can share the code if it helps too

phall
2019-06-21 17:23
Just from reading the error message, it seems to be expecting an object, but is receiving a string. i.e. the difference between ``` { "statusCode": 200 } ``` and ``` "{ \"statusCode\": 200 }" ``` As to the fix? It?s very much dependent on your code. It may be as easy as parsing the string to JSON, but that?s just speculation.

cristiano
2019-06-21 17:31
has joined #general

craig.pothier
2019-06-21 18:08
yeah, i've been trying to deal with that. Im pasting the code here in case someone sees something that i dont. import { MessageProviderPact} from '@pact-foundation/pact'; import * as path from 'path'; import * as AWS from 'aws-sdk'; const lambda = new AWS.Lambda({ region: 'us-west-1' }); async function calllambda() { const params: any = { FunctionName: 'softwareUpdate-stage-getSoftwareVersion', InvocationType: 'RequestResponse', LogType: 'Tail', Payload: '{ "platform": "test", "groupUuid": "d658c575-b359-41bc-829e-7b00aef6fafd", "serialNumber": "KQ6931091B3B7", "extension": "254266" }' }; try { const response = await lambda.invoke(params).promise(); const responsePayload: string = JSON.stringify(response['Payload']); return JSON.parse(responsePayload); } catch(err) { console.log(err) return err } } describe("Message provider tests", () => { const p = new MessageProviderPact({ messageProviders: { "a request to save an event": () => calllambda() }, logLevel: "warn", provider: "services.softwareUpdate", providerVersion: "1.0.0", consumer: "services.checkin", pactUrls: [path.resolve(process.cwd(), "./src/tests/pacts", "services.checkin-services.softwareupdate.json")], tags: ["latest"], }) describe("send an event", () => { it("sends a valid event", () => { return p.verify() }) }) })```

yousafn
2019-06-21 19:50
You are expecting updateNow but your receiving upgradeNow

craig.pothier
2019-06-21 19:52
wow

craig.pothier
2019-06-21 19:52
haha

craig.pothier
2019-06-21 19:53
thank you!

yousafn
2019-06-21 19:55
Also you may not need return json.parse(responsePayload) and just return the stringified payload. Not sure where in your code, it specifies updateNow, unless that?s in a diff file?

craig.pothier
2019-06-21 19:55
it comes from the PACT file that was generated from the consumer side

yousafn
2019-06-21 19:55
I?ve been testing lambdas, but they are invoked via api gateway

yousafn
2019-06-21 19:55
Ahhh right! Hopefully it?s just that then :raised_hands:

craig.pothier
2019-06-21 19:56
yeah, i wish our application would be invoking them through the API gateway. Current version of PACT doesnt play nicely with lambdas that are invoked in request/response format

yousafn
2019-06-21 19:59
Ahhhh that?s the verifier code, Peter might be correct with regards to the hash/string thing, if you update your pact file to have upgradeNow in it and that doesn?t match then you probably don?t need json.parse and just return the json.stringify, and then work out who is wrong with regards to updateNow/upgradeNow. Best of luck homie

craig.pothier
2019-06-21 20:01
thank you very much

yousafn
2019-06-21 20:02
Any time mate, let us know how you get on :)

dar
2019-06-21 23:45
has joined #general

dar
2019-06-21 23:54
Lack of research: Has anybody succeeded in implementing pact for SOAP Api? Where could I go looking for such?

bethskurrie
2019-06-21 23:54
pact-jvm supports XML matching

bethskurrie
2019-06-21 23:55
no other impls do yet

dar
2019-06-21 23:55
oh :disappointed: Ok, I still can learn things...

dar
2019-06-21 23:57
Thanks!!!

matt.fellows
2019-06-22 03:27
What language are you using?

thakkarjinal29
2019-06-22 12:02
Hello, was wondering if someone could help me with how can to tag a provider. I want to tag my provider with the feature branch it?s been developed on. I checked the `pact-provider-verifier` doc, but I could not find it there. I know that we can make a `PUT` request on the pact-broker and set the tag, but was looking to do this during the verification process. Thanks!

thakkarjinal29
2019-06-22 12:54
Ahh.. missed the `pact-broker create-version-tag`! Got it!

thakkarjinal29
2019-06-22 14:22
I am trying to create webhook via `pact-broker create-webhook` and getting an error saying `require': cannot load such file -- pact/hal/entity (LoadError)` Here?s the entire command ``` pact-broker create-webhook "https://circleci.com/api/v1.1/project/bitbucket/xyz/xyz/tree/JT-AUT-92-pact-poc?circle-token=<token>" -X POST -H Content-Type=application/json -d build_parameters[CIRCLE_JOB]=my_job --consumer con --provider pro --broker-base-url https://x.pact.dius.com.au --broker-token <token> --provider-verification-published -v ```

thakkarjinal29
2019-06-22 14:23
Here?s the complete stacktrace: ``` /Users/jinal/.rvm/rubies/ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- pact/hal/entity (LoadError) from /Users/jinal/.rvm/rubies/ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /Users/jinal/.rvm/gems/ruby-2.2.5/gems/pact_broker-client-1.18.0/lib/pact_broker/client/hal/link.rb:61:in `wrap_response' from /Users/jinal/.rvm/gems/ruby-2.2.5/gems/pact_broker-client-1.18.0/lib/pact_broker/client/hal/link.rb:49:in `post' from /Users/jinal/.rvm/gems/ruby-2.2.5/gems/pact_broker-client-1.18.0/lib/pact_broker/client/webhooks/create.rb:41:in `create_webhook_with_consumer_and_provider' from /Users/jinal/.rvm/gems/ruby-2.2.5/gems/pact_broker-client-1.18.0/lib/pact_broker/client/webhooks/create.rb:30:in `call' from /Users/jinal/.rvm/gems/ruby-2.2.5/gems/pact_broker-client-1.18.0/lib/pact_broker/client/webhooks/create.rb:17:in `call' from /Users/jinal/.rvm/gems/ruby-2.2.5/gems/pact_broker-client-1.18.0/lib/pact_broker/client/cli/broker.rb:165:in `create_webhook' from /Users/jinal/.rvm/gems/ruby-2.2.5/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' from /Users/jinal/.rvm/gems/ruby-2.2.5/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' from /Users/jinal/.rvm/gems/ruby-2.2.5/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' from /Users/jinal/.rvm/gems/ruby-2.2.5/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' from /Users/jinal/.rvm/gems/ruby-2.2.5/gems/pact_broker-client-1.18.0/lib/pact_broker/client/cli/custom_thor.rb:15:in `start' from /Users/jinal/.rvm/gems/ruby-2.2.5/gems/pact_broker-client-1.18.0/bin/pact-broker:4:in `<top (required)>' from /Users/jinal/.rvm/gems/ruby-2.2.5/bin/pact-broker:23:in `load' from /Users/jinal/.rvm/gems/ruby-2.2.5/bin/pact-broker:23:in `<main>' from /Users/jinal/.rvm/gems/ruby-2.2.5/bin/ruby_executable_hooks:15:in `eval' from /Users/jinal/.rvm/gems/ruby-2.2.5/bin/ruby_executable_hooks:15:in `<main>' ```

thakkarjinal29
2019-06-22 14:24
Also (sorry for back to back messages), is there a way to use `Dynamic variable substitution` for webhooks using `pact-broker create-webhook` ?

pact.io
2019-06-22 16:08
I wanna try to implement a new matcher to pact-php. For example the minmax matcher. As far as I understand it is something like ``` "matchingRules": { "body": { "$.values": { "matchers": [{"match": "type", "min": "1", "max": "1"}] }, } } ``` However the json file or the payload send to the ruby mock server seems to have some other format. I don't really understand how that works and what I should do. Do you have an example for the json file and the message that shall be send to POST /interactions?

shefeeque85
2019-06-22 18:53
has joined #general

matt.fellows
2019-06-23 00:03
The Ruby mock service doesn't support this yet I'm afraid

matt.fellows
2019-06-23 00:03
That is a v3 specification matcher, which Ruby does not yet support

luchillo17
2019-06-23 00:48
Hey guys anyone has any idea why my Pact tests fails only in desktop PCs?

mboudreau
2019-06-23 01:15
It's trying to use the Linux binary in windows, that's why. Did someone commit the node_modules folder?

luchillo17
2019-06-23 01:16
No, node modules is ignored by default on project creation, so no. I think most likely is because i'm using WSL.

mboudreau
2019-06-23 01:18
Yep, that's exactly why. Wsl is really crap cause it identifies as Linux, but doesn't work like Linux :/

luchillo17
2019-06-23 01:32
I'm running with powershell & worked like a charm.

luchillo17
2019-06-23 01:32
Thanks, shame i had to install node again.

mboudreau
2019-06-23 02:38
Yeah, I tried getting it working with wsl, but there's nothing in there to say that it's running inside wsl as far as I can tell unless Microsoft changed something. When I first implemented it, wsl just got out

mboudreau
2019-06-23 02:40
I'm not a windows expert myself (Linux guy) but if you can find a variable in wsl that we can use to identify it, that'd be great

pact.io
2019-06-23 07:32
Alright. I understand that. Do you know which of the points mentioned in the below list are worth implementing currently? https://github.com/pact-foundation/pact-php/issues/29#issuecomment-504624662

thakkarjinal29
2019-06-23 12:42
Could someone help with this please?

thakkarjinal29
2019-06-23 12:42
Does anyone have any idea about this one?

jemma.wells
2019-06-23 20:04
has joined #general

abubics
2019-06-23 23:52
You might start getting replies now :slightly_smiling_face: The local time for most of the maintainers is almost 10am now, and your messages were all around midnight over the weekend :stuck_out_tongue:

thakkarjinal29
2019-06-24 05:13
Hehe thanks, will wait :slightly_smiling_face:

mstalmasek
2019-06-24 09:54
has joined #general

sankalan13
2019-06-24 11:50
@bethskurrie @matt.fellows please help. :slightly_smiling_face:

bethskurrie
2019-06-24 11:51
Yes, you just put them in.

bethskurrie
2019-06-24 11:53
There's no trick. You just put `${pactbroker.pactUrl}` or whatever into the body or params where you want it to be substituted.

steve637
2019-06-24 12:09
has joined #general

sankalan13
2019-06-24 14:05
Thanks @bethskurrie will try this out. :slightly_smiling_face: @thakkarjinal29 FYI :slightly_smiling_face:

shefeeque85
2019-06-24 16:25
Hello...Just trying my luck here..Iam doing a poc to implement pact in my project..

shefeeque85
2019-06-24 16:25
I have the following classes:- public class Student { private String id; private String firstName; private String lastName; private int age; } public class DepartmentResponse { private String id; private String name; List<Student> students; } At Consumer side, I have the LamdaDsl as below: @Pact(consumer = "StudentServiceConsumer1") public RequestResponsePact createPact(PactDslWithProvider builder) { Map<String, String> headers = new HashMap(); headers.put("Content-Type", "application/json"); final DslPart actualPactDsl = LambdaDsl.newJsonBody((bodyDsl) -> { bodyDsl .stringType("id", "1") .stringType("name","Dep 1") .array("students",(stud) ->{ stud.object((s1->{ s1.stringType("id","1") .stringType("firstName","John") .stringType("lastName","Smith") .numberType("age",21); })); }); }) .build(); return builder .given("Department 1 exist") .uponReceiving("A request for DepartmentResponse Object with Id 1") .path("/department/1") .method("GET") .willRespondWith() .status(200) .headers(headers) .body(actualPactDsl).toPact(); } So in the pact file generated, I will have only one student record. Now, in the Provider side, with the id as "1", it will give two student records, sample code below:- public DepartmentResponse getDepartmentById(String id){ Student student1 = new Student(); student1.setId("1"); student1.setAge(23); student1.setFirstName("John"); student1.setLastName("Smith"); Student student2 = new Student(); student2.setId("2"); student2.setAge(21); student2.setFirstName("Adam"); student2.setLastName("Zamba"); DepartmentResponse department = new DepartmentResponse(); department.setId(id); department.setName("Dep 1"); department.setStudents(Arrays.asList(student1,student2)); return department; } Now when I run the pact verifier, it fails as it says there are 2 student records in the provider response. java.lang.AssertionError: 0 - $.students -> [{mismatch=Expected a List with 1 elements but received 2 elements, diff= { + "id": "1", "firstName": "John", "lastName": "Smith", - "id": "1", + "age": 23 + }, + { + "id": "2", + "firstName": "Adam", + "lastName": "Zamba", "age": 21}]

shefeeque85
2019-06-24 16:26
So what I need is, if there is a List in the response object, pact verifier should check only for the first instance

shefeeque85
2019-06-24 16:27
either lambda or the old way is fine for me

craig.pothier
2019-06-24 17:31
trying to publish pacts using typescript but Im getting the following error. Anyone have any ideas? Works if I change import state to require and run as js.

matt.fellows
2019-06-24 22:22
I think you need to change the import to `import pact from "@pact-foundation/pact-node"`

chris.maki
2019-06-25 03:12
has joined #general

thakkarjinal29
2019-06-25 05:39
Thanks @bethskurrie and @sankalan13. I did try that but there are 2 issues. 1. One is that `{pactbroker.providerVersionTags}` is returning empty, although I have tagged my provider. 2. I?m getting a `kernel_require.rb:54:in `require?: cannot load such file -- pact/hal/entity (LoadError)` error (Attaching screenshot)

matt.fellows
2019-06-25 06:02
Hmm I think the `401` is the real problem. Looks like the credentials aren?t going through to the broker maybe? Or perhaps it?s an incorrect bearer token

matt.fellows
2019-06-25 06:02
P.S. you exposed your circle CI token. You?ll want to deactivate that

thakkarjinal29
2019-06-25 06:03
Oops! Thanks! :shocked_face_with_exploding_head:

thakkarjinal29
2019-06-25 06:04
Hmm, the bearer token seems to be working for all other commands. But will still check, thanks! Any idea why `{pactbroker.providerVersionTags}` would be empty inspite of tagging the provider version?

matt.fellows
2019-06-25 07:52
Are you missing the `$` in front of that? i.e. `${pactbroker.providerVersionTags}`

bethskurrie
2019-06-25 08:00
@thakkarjinal29 there are a few libraries that incorrectly tag after publishing the pact or results instead of before. What are you using?

bethskurrie
2019-06-25 08:03
Also do you have the latest version of whatever you are using? The token auth support has only been added recently.

bethskurrie
2019-06-25 08:03
I assume you've removed the screenshot, because I can't see it

thakkarjinal29
2019-06-25 08:03
hey @bethskurrie, used `pact-broker create-version-tag`to tag the provider version

thakkarjinal29
2019-06-25 08:08
Hey @matt.fellows, when I use it with *$* in the commandline, it says `${pactbroker.providerVersionTags}: bad substitution`. Hence, was trying without it. However, it works fine from the UI, however even there it returns an empty string.

bethskurrie
2019-06-25 08:08
Ooh, you may be hitting problems with your shell interpolating the dollar sign.

bethskurrie
2019-06-25 08:11
Also, it looks like the token isn't being passed though. I can't see an authentication header being set.

bethskurrie
2019-06-25 08:11
Can you raise an issue in the pact broker client project?

thakkarjinal29
2019-06-25 08:12
Yes this was my next question :slightly_smiling_face: Sure, will do that right away

bethskurrie
2019-06-25 08:14
From memory, when I've created webhooks using this command I've used a file for the webhook json, so it avoids the bash interpolation issue.

thakkarjinal29
2019-06-25 08:14
I am using `pact-broker` utility of pact-ruby-standalone. The version of pact-broker utility is 1.18.0

thakkarjinal29
2019-06-25 08:16
I escaped the *$* and the command works fine. But yes, using a file makes more sense. Thanks, will do that!

matt.fellows
2019-06-25 08:20
Yep. I Verifies the token wasn't coming thru on the train and started investigating

matt.fellows
2019-06-25 08:20
Verified*

thakkarjinal29
2019-06-25 08:23
I am using the pact-ruby-standalone version 1.66.0 and the latest is 1.68.0 however, the `pact_broker-client gem` version in both is `1.18.0`

bethskurrie
2019-06-25 09:14
Ok, I've just put out a fix to the pact broker client in the standalone 1.69.0

bethskurrie
2019-06-25 09:14
the token should work now @thakkarjinal29

thakkarjinal29
2019-06-25 09:22
Wow that was quick! Thanks @bethskurrie @matt.fellows!


detert
2019-06-25 10:15
My pact verification shows this error: What am I doing wrong? * Expected a String matching /\d{1,2}/ (like "11") but got a Fixnum (12) at $.creditCards[0].detail.validToMonth * Expected a String matching /\d{4}/ (like "2019") but got a Fixnum (2020) at $.creditCards[0].detail.validToYear

bethskurrie
2019-06-25 10:18
You're expecting a sting, but getting a number

bethskurrie
2019-06-25 10:18
You can't do a regex on a number btw.

detert
2019-06-25 11:03
Oh, that is a surprise. Can i Match on exactly one or two digots?

bethskurrie
2019-06-25 11:03
Ni

bethskurrie
2019-06-25 11:03
No

bethskurrie
2019-06-25 11:04
Why is that important for a contact?

bethskurrie
2019-06-25 11:04
Oh, I see you have a month and a year.

detert
2019-06-25 11:04
Well I want to ensure that a valid month is returned, but maybe that is not part of the contract?

bethskurrie
2019-06-25 11:05
What might be important is whether it's a two digit year or a 4 digit year. Unfortunately, there's no way to check that, in v2 at least.

bethskurrie
2019-06-25 11:05
V3 might have Min and Max

detert
2019-06-25 11:06
That might be worth a feature request. Where should I write such an issue?

bethskurrie
2019-06-25 11:06
Check if it already exists in v3

bethskurrie
2019-06-25 11:06
In the pact specification repo

detert
2019-06-25 11:08
I don't see it at the first look. Maybe we could extend `{ "match": "integer" }` with `digits` or something like that, or we allow regex for digits as well

bethskurrie
2019-06-25 11:09
Raise an issue for it

detert
2019-06-25 11:09
The Generators are able to provide a specified amount of digits

detert
2019-06-25 11:09
thank you

bethskurrie
2019-06-25 11:10
Or, if you're in control of the schema, you could try changing the date to an ISO date format string.

bethskurrie
2019-06-25 11:10
You can do a regex on that.

bethskurrie
2019-06-25 11:11
Oh, just scrolled up and its a credit card expiry.

bethskurrie
2019-06-25 11:11
I see your issue.

detert
2019-06-25 11:11
I will use like(11) for the beginning. I have to change a lot of stuff else

detert
2019-06-25 11:11
Yes it is

carolyn.biggar
2019-06-25 11:38
has joined #general

alessandrobuggin
2019-06-25 14:08
has joined #general

thakkarjinal29
2019-06-25 15:00
Hey @bethskurrie, I think the 1.69.0 version did not get released, I am unable to use it.

zrkann
2019-06-25 20:49
has joined #general

mail259
2019-06-25 21:27
has joined #general

mail259
2019-06-25 21:32
I'm implementing contract testing in our organization and we are driving it through the provider. As a developer, you often start writing the API first and then use them in the frontend. Similarly, we write the API first and then merge it in master and then define the contract test inside the consumer. When we need to modify something, we take the same approach by making changes in the provider ( N-1 compatible ) and then making those changes in the consumer. I read that pact should be consumer driven but I'm able to understand what's wrong about contract testing by driving it through a provider? What are the cases when this approach can go wrong?

matt.fellows
2019-06-25 22:22
I?ve just re-ran that build - looked like a temporary GitHub API issue. It?s up now at https://github.com/pact-foundation/pact-ruby-standalone/releases/tag/v1.69.0

matt.fellows
2019-06-25 22:32
You can do it from the provider. But (at the moment) Pact makes it a little unnatural due to the workflow assuming it starts from the consumer (for all of the reasons written extensively at https://docs.pact.io).

matt.fellows
2019-06-25 22:32
If you are using the can-i-deploy checks via the Pact Broker on the provider and ensuring backwards compatibility, you still get the usual guarantees of contract testing - i.e. that your consumers and providers are API compatible.

bethskurrie
2019-06-25 22:36
There's no reason why the functionality can't come first @mail259. Pact will just make sure that any changes you make are compatible with your existing consumers.

thakkarjinal29
2019-06-26 04:46
Awesome! Thanks :slightly_smiling_face:

andreas
2019-06-26 11:52
has joined #general

mail259
2019-06-26 13:00
Thanks for the quick response! Given that I'm using can-i-deploy checks, what am I losing out on starting the workflow from the provider ( functionality first )? I'm not sure if it is an anti-pattern and can't get clear information from the pact docs.

matt.fellows
2019-06-26 13:09
You're not losing anything, really

matt.fellows
2019-06-26 13:11
CDC is a philosophical position that advocates better internal microservices design by putting the consumers at the heart of the process. Provider driven APIs tend to think about themselves and less about how they're consumed _</gross generalization>_

matt.fellows
2019-06-26 13:11
If you didn't get that from docs we need to fix something!

mail259
2019-06-26 13:15
That completely makes sense, thanks again!

bethskurrie
2019-06-26 23:47
Peeps. Does anyone here have the scenario where an http message is sent to a service, and an async message is sent back in response?

detert
2019-06-27 06:05
@bethskurrie Maybe. What do you mean with message? We trigger an http request to a search service. That service calls another endpoint when the search is completed

sundaresank
2019-06-27 09:09
has joined #general

whitehorse5353
2019-06-27 16:54
has joined #general

oscar821210
2019-06-28 00:31
has joined #general

doxuantien
2019-06-28 02:25
has joined #general

chris.maki
2019-06-28 05:24
@bethskurrie With POST calls, I?ve implemented services where the provider returns a 201 and populates the LOCATION header so the consumer can check on the progress. Is that similar to what you are trying to do? If not, can you give a little more detail on your service?

bqiu
2019-06-28 20:18
has joined #general

matt.fellows
2019-06-29 04:15
That?s the way I usually see it implemented

matt.fellows
2019-06-29 04:24
/poll ?If we were to run a webinar series, what should we cover?? ?Getting started? ?CD with the Pact Broker? ?Asynchronous service testing? ?Cloud service testing (e.g. lambda)?

matt.fellows
2019-06-29 04:48
Cross posting from #pact-broker Looking to get involved with OSS but don?t know where to start? Here is an easy win :point_right: https://pact-foundation.slack.com/archives/C9VPNUJR2/p1561783533171100

gaurav.singh55
2019-06-30 03:43
has joined #general

nick_horne_90
2019-07-01 08:46
Hi, I am trying to write a Pact-Verifying unit test for the consumer in Java. Should I only have one test per class? I have noticed that if I have multiple tests in the class some of them fail unless I add a sleep before running my client assertions.

nick_horne_90
2019-07-01 08:47
What I have looks like this: ```@RunWith(SpringRunner.class) @SpringBootTest(properties = {}) public class ConsumerPactVerificationTest { @Rule public PactProviderRuleMk2 stubProvider = new PactProviderRuleMk2("customerServiceProvider", "localhost", 8888, this); @Autowired private AddressClient addressClient; @Pact(provider = "test") public RequestResponsePact getAddresses(PactDslWithProvider builder) { return builder .given("a collection of 2 addresses") .uponReceiving("a request to the address collection resource") .path("/addresses/") .method("GET") .willRespondWith() .status(200) .body("...", "application/hal+json") .toPact(); } @Test @PactVerification(fragment = getAddresses public void verifyAddressCollectionPact() { assertThat(addressClient.getAddresses())... } }```

dorons
2019-07-01 09:25
has joined #general

tuan.ho
2019-07-01 09:29
Hi, anyone got experience with dredd test? how is it different from PACT?

tuan.ho
2019-07-01 09:30
there two to me do the same thing which is verifying the API contract

tuan.ho
2019-07-01 09:31
am i correct?

matt.fellows
2019-07-01 09:32
Dreds issues tests against a provider based on a spec (not a contract). It doesn't guarantee that both sides of the contract are in sync. It can be used alongside pact to verify provider functionality/conformity to a spec (to a degree). Pact is a testing framework that implements contract testing (distinct from spec testing) and guarantees both parties to a contract stay in sync

matt.fellows
2019-07-01 09:32
Short answer, no they are different

dorons
2019-07-01 09:34
Hi Can I get some help with pact and protobuf?


bethskurrie
2019-07-01 09:55
Hi @nick_horne_90 best to have this conversation in the #pact-jvm channel

nick_horne_90
2019-07-01 09:59
Thanks @bethskurrie I will ask in there

raffael.stein
2019-07-01 10:54
has joined #general

deepti.kinnerkar
2019-07-01 13:44
has joined #general

deepti.kinnerkar
2019-07-01 13:47
Is there any mechanism to create some data on the Provider via pact Files, before making a GET API Call?


jfnavin
2019-07-01 22:53
has joined #general

uglyog
2019-07-01 23:53
You're HTTP library is probably caching connections. Have a look at https://github.com/DiUS/pact-jvm/issues/342 for more info

nick_horne_90
2019-07-02 15:09
Thanks that does seem to be it. Im using the Spring RestTemplate and it has stored the connection in a connection pool

karlboyle
2019-07-02 15:25
has joined #general

emanuele.ivaldi
2019-07-02 21:18
has joined #general

ur_pact
2019-07-03 15:08
has joined #general

sandhyarani.gabbi
2019-07-03 16:05
has joined #general

morteza.alizadeh
2019-07-04 03:09
has joined #general

johngluckjunk
2019-07-04 05:24
has joined #general

berlinau
2019-07-04 16:48
has joined #general

xyang2008
2019-07-05 05:48
has joined #general

xyang2008
2019-07-05 05:58
Hi

xyang2008
2019-07-05 06:00
Hi, I'am newbie to pact and now learning it by writting some demo. Now the pact contract file was generated successfully as below. { "consumer": { "name": "weather-consumer" }, "provider": { "name": "weather-provider" }, "interactions": [ { "description": "Query weather info by city id.", "providerState": "City id \"101010100\" exists", "request": { "method": "get", "path": "/101010100.html" }, "response": { "status": 200, "headers": { }, "body": { "weatherinfo": { "city": "??", "cityid": "101010100", "temp1": "18?", "temp2": "31?", "weather": "????", "img1": "n1.gif", "img2": "d2.gif", "ptime": "18:00" } } } } ], "metadata": { "pactSpecification": { "version": "2.0.0" } } }% Next I want to do the provider verification, I run the below cmd: pact-verifier --provider-base-url=http://www.weather.com.cn/data/cityinfo ./pacts/weather-consumer-weather-provider.json I got the failures. INFO: Reading pact at ./pacts/weather-consumer-weather-provider.json Verifying a pact between weather-consumer and weather-provider Given City id "101010100" exists Query weather info by city id. with GET /101010100.html returns a response which WARN: Skipping set up for provider state 'City id "101010100" exists' for consumer 'weather-consumer' as there is no --provider-states-setup-url specified. has status code 200 has a matching body (FAILED - 1) Failures: 1) Verifying a pact between weather-consumer and weather-provider Given City id "101010100" exists Query weather info by city id. with GET /101010100.html returns a response which has a matching body Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example Encoding::UndefinedConversionError: "\xE5" from ASCII-8BIT to UTF-8 1 interaction, 1 failure Failed interactions: PACT_DESCRIPTION='Query weather info by city id.' PACT_PROVIDER_STATE='City id "101010100" exists' /Library/Frameworks/Python.framework/Versions/3.6/bin/pact-verifier --provider-base-url=http://www.weather.com.cn/data/cityinfo ./pacts/weather-consumer-weather-provider.json # Query weather info by city id. given City id "101010100" exists The error "Encoding::UndefinedConversionError:" seems to be a string2json translation error? I'am confused, maybe I used the pact-verifier in a wrong way, am't I?

xyang2008
2019-07-05 06:01
pact-demo ? curl http://www.weather.com.cn/data/cityinfo/101010100.html {"weatherinfo":{"city":"??","cityid":"101010100","temp1":"18?","temp2":"31?","weather":"????","img1":"n1.gif","img2":"d2.gif","ptime":"18:00"}}%

xyang2008
2019-07-05 06:01
I use curl to check the real server response, it returns ok.

bethskurrie
2019-07-05 06:03
You can only use pact for UTF-8 strings

bethskurrie
2019-07-05 06:03
it may be that your encoding env var is set to ASCII

bethskurrie
2019-07-05 06:03
are you running on windows?

xyang2008
2019-07-05 06:03
on macos

bethskurrie
2019-07-05 06:04
hm. should be ok then

xyang2008
2019-07-05 06:04
how to set the encoding? pact-verifier is a bin file

bethskurrie
2019-07-05 06:04
is your response returning non UTF-8 chars?

xyang2008
2019-07-05 06:05
you mean the response from pact-mock server or from the real server?

bethskurrie
2019-07-05 06:05
real server

xyang2008
2019-07-05 06:06
>>> r=requests.get("http://www.weather.com.cn/data/cityinfo/101010100.html") >>> r.encoding 'ISO-8859-1'

xyang2008
2019-07-05 06:06
ISO-8859-1

xyang2008
2019-07-05 06:07
not utf-8

bethskurrie
2019-07-05 06:07
the error is occuring because the response has ascii 8 bit chars in it

bethskurrie
2019-07-05 06:07
that's not going to work.

bethskurrie
2019-07-05 06:07
JSON encoding is UTF-8

xyang2008
2019-07-05 06:08
hmm, because this is a demo, i chose a publick interface, I will try other public API who returns utf-8. Thanks.

bethskurrie
2019-07-05 06:09
@xyang2008 please don't use pact with a public API!

bethskurrie
2019-07-05 06:09
It's really bad for that.

xyang2008
2019-07-05 06:09
I alse check pact-verifier --help, no option to set encoding. this ruby tool could not support set encoding?

bethskurrie
2019-07-05 06:09
the pact files are written in utf-8

bethskurrie
2019-07-05 06:09
i just don't think it would work.

xyang2008
2019-07-05 06:09
Ok, I will test our own API

xyang2008
2019-07-05 06:10
got it


xyang2008
2019-07-05 06:13
emm.. I will read the doc carefully. before I came here, I really read all the doc https://github.com/pact-foundation, it seems the doc is not very clear to a green hand, especially lack of examples. I read the some issues and found the slack... really thanks



xyang2008
2019-07-05 06:14
@bethskurrie thanks for your replies.

xyang2008
2019-07-05 06:15
I just read the readme files:)

bethskurrie
2019-07-05 06:15
ha. yeah, that's not very helpful!

xyang2008
2019-07-05 06:16
Ok, I will read the docs you share with me, thanks.


fun_rajesh
2019-07-05 11:16
has joined #general

fun_rajesh
2019-07-05 12:27
Hi, I received a mail from with a temporoary password. However, when i signed in https://<myusername>.http://pact.dius.com.au , the credentials were not identified.

fun_rajesh
2019-07-05 12:28
May I know how to start using the pact broker hosted in the cloud by Pact team

matt.fellows
2019-07-05 12:32
Hi Rajesh. Drop a line to and we'll get it sorted

kiran.kumar.sukumar
2019-07-05 14:01
has joined #general

fun_rajesh
2019-07-05 14:06
Thanks @matt.fellows I have sent a mail to the support

kiran.kumar.sukumar
2019-07-05 15:20
How do i replace a query parameter sent from the provider ?

kiran.kumar.sukumar
2019-07-05 15:48
Is it possible to modify the query parameter in the pact when running the test from the provider side ?

agarwalatrisha1212
2019-07-06 08:31
hi

agarwalatrisha1212
2019-07-06 08:35
I sorry if it not right channel to post the question, but i am newbie to pact and i wanted to develop the consumer driven test, i have visualisation of how does pact work? but i don?t have hands on . How do i get two dependent api and start with ? A simple example as to start with or pairing with somebody? I just wanted to get the experience of simple test with handson

pact.io
2019-07-06 09:41
Well, if you grep the pact and run all verification step manually that might be possible. However, I think that that is not a good choice as you could break the significance of your test. You could use the provider state to prepare everything as needed


sumit
2019-07-07 05:27
has joined #general

agarwalatrisha1212
2019-07-07 12:26
little

agarwalatrisha1212
2019-07-07 12:26
But i am more open for handson

pact.io
2019-07-07 16:01
@agarwalatrisha1212 you can find implementation guides there

skirankumars31
2019-07-07 16:22
My provider state has no control over the ID that should be used as a query parameter. Its a dynamically generated value

pact.io
2019-07-07 16:57
Why is it random? Are you able to mick the random generator on the consumer side? Every test should be reproducable

agarwalatrisha1212
2019-07-07 18:32
Thank you @pact.io

matt.fellows
2019-07-08 03:59
What language Trisha?

matt.fellows
2019-07-08 03:59
There are a few workshops that are worth doing (linked from docs side as Sebastian mentioned)

florian.nagel
2019-07-08 07:48
has joined #general

asite.mshah
2019-07-08 09:29
has joined #general

asite.mshah
2019-07-08 09:46
One question :- Is it possible to have a different response for the same request on the consumer side? For example call `/api/abc/1` on first call want response `1` and on the second call with the same request want response `2`. Could someone let me know if it supported through pact.

detert
2019-07-08 09:49
Pact tests are isolated. Thus I would say: no. That is not intended However you can set the provider state like "noone called /api/abc/1", "someone called /api/abc/1". Out of curiosity: Why do you have that behaviour? I would not expect that

matt.fellows
2019-07-08 09:51
The main way to achieve it is thru what is known as provider states. The classic example is getting a user - at a minimum, you'll want to test the 200 and the 404 scenarios

florian.nagel
2019-07-08 09:54
Does someone here have a generated pact file for a message queue, so the v3 specification, as a reference point for me? I've found a possible bug and want to compare my pact file. I've already checked multiple online resources, but am not able to build a pact file bc of other errors. So if someone has one laying around I'd appreciate it. I don't want to open an issue before knowing if it really is one. (I haven't found any open issues or stackoverflow questions regarding the possible bug). Any help is appreciated!

florian.nagel
2019-07-08 09:56
As a reference I've tried to compile this https://github.com/DiUS/pact-jvm/blob/v4.x/consumer/pact-jvm-consumer-junit/src/test/java/au/com/dius/pact/consumer/v3/AsyncMessageTest.java project but couldn't get it to produce pacts because of an error I encountered while executing the `build` task in gradle

asite.mshah
2019-07-08 10:08
Thank you for your response. Let me explain the scenario which I am trying to use. Correct me if it is not proper. - We have two services (`a` and `b`) , when we execute acceptance test of service `a` we mock service `b` using `pact-stub-server`. - So there are calls from service a --> b, for which I need to mock. This way we use pact to return a response, without starting actual service.

florian.nagel
2019-07-08 10:31
I think it is a legit bug! I've found a pact file to compare mine to and the `contents:` value under messages looks like a normal formatted JSON. My generated pact file looks like this though: ``` ... "contents": "{\n \"hometeamScore\": 0,\n \"ownerId\": 0,\n \"foreignteamScore\": 0,\n \"matchId\": 0\n}", ... ``` when they should look like this to be recognized correctly by a pact provider test: ``` ... "contents": {"hometeamScore": 0,"ownerId": 0,"foreignteamScore": 0,"matchId": 0}, ... ``` (Omitting some of the contents/pact file bc I don't think it is relevant. Can provide more information if necessary.) Should I ask on stackoverflow and provide more information or is it sufficient to ask this here?

detert
2019-07-08 10:51
Exactly

matt.fellows
2019-07-08 11:04
Let?s give it a quick crack here, and if no-one solves it right away, get it up on SO

matt.fellows
2019-07-08 11:05
At the moment, if you are trying to get pact-stub-server to return different responses from the same request then I think the (current) answer to that question is no

matt.fellows
2019-07-08 11:06
In your tests you can, but not via the stub server (because it needs to know which state to fetch, which is only provided during unit test / framework execution)

asite.mshah
2019-07-08 11:08
Thank you for answer and explaination

matt.fellows
2019-07-08 11:11
We?d like to be able to support that feature, we just haven?t thought of a good way of ?how?

matt.fellows
2019-07-08 11:11
There?s probably an issue for it somewhere, as I recall discussion the potential to augment/amend the pact file with ?predicates? etc.

matt.fellows
2019-07-08 11:12
I usually work around it by not creating two exact requests in a Pact file. In the fictional case above I would have two tests like this: ? `GET /users/1` returns `404` ? `GET /users/2` returns `200`

matt.fellows
2019-07-08 11:12
That way acceptance test mocks work

florian.nagel
2019-07-08 11:13
Alright! I'll send the code used to produce the pact here in a sec @matt.fellows Thanks for your help!

detert
2019-07-08 11:15
I did not understand that Manan needs different response codes. For me it was like, I get a valid 200 response, but the body is different. In the case you have a different provider state. Is the stub-server able to distinguish that?

matt.fellows
2019-07-08 11:15
Well, whether it?s different response codes, bodies etc., the principle is the same

florian.nagel
2019-07-08 11:17
This is the class used to generate the pacts. The first function is the important one. That is `createPactForTippabgabe(MessagePactBuilder builder)`. It is written in Java btw. I've tried it using the old and the new DSL for Java. Both produce the same result. @matt.fellows

matt.fellows
2019-07-08 11:28
I?m not that familiar with the JVM implementation as much, but do you need to call an `.asBody()` on that builder?

florian.nagel
2019-07-08 11:31
I'm not sure what you are referring to. There is nothing coming up when I search for `.asBody()`. I'm sorry if I'm missing something. @matt.fellows

florian.nagel
2019-07-08 11:33
Ah okay. Got what you mean. Trying it out now!

florian.nagel
2019-07-08 11:35
Still the same result unfortunately. Tried to call `.asBody()` on both, the `body` and on `actualPactDsl`, so the error persists no matter which DSL I use. @matt.fellows

matt.fellows
2019-07-08 11:38
bugger, sorry - was really just a guess

matt.fellows
2019-07-08 11:38
@uglyog any ideas?

detert
2019-07-08 11:40
And the stub-server does not support that? Is it possible to spawn it several times and merge the pact files afterwards? I did not implement that yet. But I am going to do so

matt.fellows
2019-07-08 11:41
I?m not sure what you?re asking? The stub server simply reads the pact files for use as a standalone API stub service.

matt.fellows
2019-07-08 11:42
The _mock_ server (thing used in the Pact tests themselves) absolutely _does_ support it

detert
2019-07-08 11:42
My mistake

matt.fellows
2019-07-08 11:42
all good!

florian.nagel
2019-07-08 11:43
I'm using `pact-jvm-consumer-junit5 version: '4.0.0-beta.3'` and `pact-jvm-consumer-java8 version: '4.0.0-beta.3'` by the way. I don't know if that is relevant

florian.nagel
2019-07-08 11:43
No worries! @matt.fellows I appreciate the help nonetheless

asite.mshah
2019-07-08 13:45
@matt.fellows I would suggest the way mockito did to support the different responses might be good option. Sample here https://static.javadoc.io/org.mockito/mockito-core/2.8.9/org/mockito/Mockito.html#10 yeah I have used mocking with different id for a different response, but here id(request) is same.

thamu.gurung
2019-07-08 19:54
has joined #general

thamu.gurung
2019-07-08 19:56
Hi everyone ..

thamu.gurung
2019-07-08 19:58
Looking forward to use Pact js for the contract testing. Can someone pls give me some kind of initial guidelines. Would like to use JavaScript to use Pact

matt.fellows
2019-07-08 22:35
Hi there! That?s great. What have you tried so far and why weren?t they helpful?

matt.fellows
2019-07-08 22:35
this will help us point you in the right direction

matt.fellows
2019-07-08 22:35
also #pact-js

uglyog
2019-07-09 00:13
@florian.nagel both versions are technically correct. The bodies can be encoded in a string (required for non-JSON formats) but for JSON that are inlined to make the file more readable.

uglyog
2019-07-09 00:34
I've confirmed that 4.0.0-beta versions are not inlineing the message contents. You can raise an issue for that.

florian.nagel
2019-07-09 08:14
I'll try to raise an issue for that when I have time for that today. Thank you for the quick reply! @uglyog What would be the next step after raising the issue? Can I help somehow?

thamu.gurung
2019-07-09 08:28
to be honest I haven?t started yet. Wondering if I can pull the example for the JS(https://github.com/pact-foundation/pact-js) and start

thamu.gurung
2019-07-09 08:28
Now I am doing my API testing using the Supertest. But would like to get started with Pact-js

thamu.gurung
2019-07-09 08:29
Would be wonderful if you can suggest me any example repo to clone and get started initially.

beth
2019-07-09 09:37
I believe there are examples in the pact js repo @thamu.gurung

simone.dicola820
2019-07-09 11:51
has joined #general

thamu.gurung
2019-07-09 13:11
would you recommend anything in particular , thanks

antonello
2019-07-09 14:09
I?ve taken the liberty to create this PR to add my current client to the list of companies in the testimonials page https://github.com/pact-foundation/pact.io/pull/89

antonello
2019-07-09 14:11
2 of my clients and old employer are in the list :slightly_smiling_face:

thamu.gurung
2019-07-09 20:08
@beth any suggestion?

matt.fellows
2019-07-09 21:18
I?d start with the simpler mocha unit test, and then once you get that, take a look at the e2e example which covers both consumer/provider and publishing to a broker

beth
2019-07-09 22:07
Thanks @antonello!

antonello
2019-07-09 22:36
My pleasure!

uglyog
2019-07-09 23:20
If you want to try a PR to fix it, it should be a small change

thamu.gurung
2019-07-10 08:43
thanks

budi.injo
2019-07-10 10:14
has joined #general

anders
2019-07-10 12:09
has joined #general

craig.pothier
2019-07-10 17:26
hello, I trying to do a GraphQL interaction. I followed your example and use the exact same queries in the client appolo and pact mock however I am getting this: ```{ "body": { - "query": /query\s*getMeetingsByUUID\(\$uuids:\s*\[UUID\]!\)\s*\{\s*directoryByUUIDsWithFilter\(uuids:\s*\$uuids,\s*filter:\s*MEETING\)\s*\{\s*\.\.\.\s*on\s*Meeting\s*\{\s*displayName\s*UUID,\s*\}\s*\}\s*\}/ + "query": "query getMeetingsByUUID($uuids: [UUID]!) {\n directoryByUUIDsWithFilter(uuids: $uuids, filter: MEETING) {\n ... on Meeting {\n displayName\n UUID\n __typename\n }\n __typename\n }\n}\n" } }``` And I am not getting the returned results I am expecting as it seems pact doesn't see the queries as being the same. Can anyone help me here?

dan.schepers
2019-07-10 22:06
has joined #general

ukamkhan
2019-07-11 01:28
has joined #general

johngluckjunk
2019-07-11 06:09
Hey all, I used pact at my last company. My current company is attempting to figure out why their contract testing implementation isn't getting adoption. (They are using Spring CDC). I have a bunch of questions, but primarily I'm wondering if there are any testimonials from anyone that is using Pact where there are hundreds of microservices, how they were able to get adoption, and whether or not that helped them convince developers to stop writing so many system e2e tests. I have other questions too, but I don't want to overwhelm. Oh, and yes I have seen this - https://medium.com/kreuzwerker-gmbh/consumer-driven-contract-tests-lessons-learned-b4e1ac471d0c. I'm planning on running a POC with pact using the broker. I just don't want to over promise.

matt.fellows
2019-07-11 06:18
Hello!

matt.fellows
2019-07-11 06:18
The GraphQL wrapper provided in the JS implementation is still fairly new, so it?s possible the matching regex that is applied is just? wrong

matt.fellows
2019-07-11 06:20
The wrapper is also just sugar over an HTTP interaction (because GraphQL runs on HTTP)

matt.fellows
2019-07-11 06:20
If you can get it running without the GraphQL interface, we can work out why it?s not working

matt.fellows
2019-07-11 06:20
or, if you can create an example project that replicates and raise an issue, we can look into it

nick_horne_90
2019-07-11 10:35
Hey all, as a consumer, we are modelling some fields (e.g. an Id) as a `String` type but actually the type on the provider is an `integer`. As a result our pact verification is failing but really we wan't to use a string because we don't care on the Id format (just that there is one). Are there any thoughts on this or solutions to get the pact to pass?

simon.nizov
2019-07-11 10:55
You can?t have it both ways. You need to make a decision regarding the contract. If you decide the field should be `String`, then the provider should serialize its response in such a way that fits the contract, regardless of its own internal implementation. On the other hand, if you decide that the provider is the source of truth, then you should change the contract defined by the consumer accordingly.

matt.fellows
2019-07-11 11:30
Following from that. If you ?don?t care? about the format, then `integer` it is

matt.fellows
2019-07-11 11:33
There are a bunch of articles out there, and I can direct you to https://docs.pact.io/testimonialshttps://docs.pact.io/testimonials for companies who are using Pact in one way or another

matt.fellows
2019-07-11 11:33
I have stories, but nothing that has been approved for public release (we are hopeful Sainsbury?s will approve something in this space soon - they are certainly in that size/category)

matt.fellows
2019-07-11 11:36
As a consultant and core Pact developer, there is no ?one way?. But the key things that tend to work: ? Can you identify a problem and ideally a way of measuring it? This usually takes the form of classic CD metrics slow or flakey builds, high test maintenance, long cycle/lead times etc. ? Find a small pocket that you can influence/control and demonstrate a before/after success story. Garner support from key stakeholders in the process, but also be sure to include those pesky ?skeptics? - they become your key change agents when things succeed ? Prove value, iteratively expand from there. If step 1 is 2 services within a team, step 2 should go across team boundaries or knock off a painful integration

matt.fellows
2019-07-11 11:53
Oh, and yes. Generally where there is Pact, e2e tests are reduced. In some cases, completely.

nick_horne_90
2019-07-11 12:13
Thanks for the reply's. I guess as the consumer I just want to say that there is a field called "id" that can be read as a `String` I don't want to make this an integer because on the provider side, its only an integer because of the database implementation (e.g. if that changes I don't really want suffer any consequences as all I care about is that I can read it as a string and its called id).

nick_horne_90
2019-07-11 12:15
With the provider, I can't easily change the API as there will be other clients that do rely on it being an `integer`. Ideally it would have been represented as a `string` from the start on the provider side.

james.hattersley-dyke
2019-07-11 14:05
any advice on how to handle developers changing the provider before the consumer and commenting out the pact verification steps of your build? :rage:

craig.pothier
2019-07-11 15:24
thank you!

joris
2019-07-11 19:55
has joined #general

marko.justinek
2019-07-11 22:44
@james.hattersley-dyke There?s a pretty good write up on how to get the most out of pact -> https://docs.pact.io/best_practices/pact_nirvana Hope it helps If your provider devs decide to not honour the contract and not tell you about it, it might not be (most probably isn?t) personal and just having a friendly chat with them (maybe a few times). Explaining you guys are on the same team to provide a service to end users where you all are responsible for users? success? that might make them think next time (or the 3rd time down the line) to remember to notify you they _need_ to change the provider? That way you can be ready for provider changes by rewriting the implementation and tests, and consequently the contract.

mboudreau
2019-07-11 23:23
@james.hattersley-dyke sounds like you have a cultural problem. Personally, someone disabling tests instead of improving them because it "stops them from doing code" is a flight risk and a cowboy. I'd have a long chat with them and their manager about it in the hopes that they understand that this is detrimental to the business and if they don't change their tune, it might be best to part ways.

abubics
2019-07-12 03:42
put them in charge of maintaining consumer SLAs :upside_down_face:

abubics
2019-07-12 03:45
The practical solution is to make non-breaking changes, deprecate the old interface, then remove it when nothing depends on it, but . . . is there no concern that things are broken in the meantime?

james.hattersley-dyke
2019-07-12 07:23
yeah, it was more of a joke question / rant I guess... Just frustrating when you see lines of code commented out just so 'the build passes' aka my breaking change can get in...

james.hattersley-dyke
2019-07-12 08:25
I'd like to make a suggestion for an improvement in the docs. This was something I missed and was struggling to get my head around. On the Pact Nirvana Guide https://docs.pact.io/best_practices/pact_nirvana#5-allow-contracts-to-change-without-breaking-your-builds sub-bullets 5 & 6 should be in *bold* or have a diagram attached. Especially the part about local verification and then putting the provider code into master first. With the emphasis on it being Consumer driven, I've been struggling with the point of how to get new changes into a provider but having the consumer tagged with a branch name and providers verifying against the latest master from a CI point of view. I feel it's quite an important point but easily missed. Just wanted to say, while the above is a minor minor critique I think Pact is an amazing tool. I'm also loving how helpful you all are on here and the effort you've all have and keep putting in.

matt.fellows
2019-07-12 08:26
Thanks James. Would you care to submit a PR to the docs?

matt.fellows
2019-07-12 08:26
The diagram though, yes, we do need one of those!

james.hattersley-dyke
2019-07-12 08:36
yeah I'll have a crack at getting something down. Just thinking of the best way to describe / visualize it all :slightly_smiling_face:

matt.fellows
2019-07-12 08:37
thanks, that?d be great

matt.fellows
2019-07-12 08:37
my advice: get the text out first and then worry about the diagram. _just_ in case that takes a little longer :slightly_smiling_face:

james.hattersley-dyke
2019-07-12 08:38
:+1:


ninjinsky.coding
2019-07-12 14:02
has joined #general

amber.houle3
2019-07-12 17:10
has joined #general

madhukar.mishra
2019-07-12 17:17
@matt.fellows @bethskurrie can I get my request for pactflow trial approved quickly. Want to use it for the demo if possible

antonello
2019-07-12 18:51
Hi! I have some doubts around how to deal with endpoints protected by cookie based authentication. I have looked at the docs and issues in GitHub but I?m still unclear as what the best approach should be. We have a provider that has some endpoints that are protected by cookie-based authentication. Let?s say that two cookies `cookie_a` and `cookie_b` are required. These cookies are issued by a login endpoint in the provider and are set on the browser via a Set-Cookie directive in the provider response. The consumer sends these cookies in every request but they are not actively added by the consumer as it?s the browser that adds them to every request. How should we treat these cookies from a pact point of view? Should we: a) Not include them at all - after all the consumer does nothing with them and, because the provider is written in Java with Spring, we can mock what we want and handle cases of successful and failed authentication anyway. b) Include the cookies in the request headers of our interactions. If b) is the best answer here, should the cookies have exactly the same names of the real ones? And what about the values, would it be enough for the provider to verify that both cookies are present or should we be able to produce some test cookies (like the real ones) that never expire that the provider will just accept as valid?

matt.fellows
2019-07-12 22:50
There's no approval process anymore, you should have your account already. Hope it goes well, let us know!

madhukar.mishra
2019-07-13 15:41
Talk went well enough, couldn't get the demo prepped on time. Maybe in the next iteration :smiley:

matt.fellows
2019-07-14 01:03
:ok_hand:

matt.fellows
2019-07-14 22:09
It?s an interesting question

matt.fellows
2019-07-14 22:10
if the API Provider requires it to operate, it?s a key part of the contract but equally your ?client _code_? doesn?t know about it. But your _client_ does, however

matt.fellows
2019-07-14 22:11
I think that?s illuminating.

antonello
2019-07-14 22:22
There are different views in the office and I can see merits on both including it and not including them.

antonello
2019-07-14 22:23
Perhaps it would be more important (and sufficient?) to test that the login endpoints actually returns a Set-Cookie response header.

antonello
2019-07-14 22:52
Also, assuming that we were to test that the consumer sends the cookies, would we not want to use some ?real cookies?, with real names and values that the provider can interpret? My gut feeling is that we should, as otherwise you wouldn?t be testing the real contract.

matt.fellows
2019-07-14 23:05
Yep. I think you need to weigh up the pros/cons. From a purely theoretical perspective, I think the answer is ?you should include it?. But taking a more balanced view, I?d say test what gives you value. If the cookie is always going to be implicitly added by the browser (because that?s how browser?s behave) and it?s a scenario unlikely to give your team more (useful) information about how the system behaves, whilst costing you effort in maintaining it. Then maybe it?s not worth it

matt.fellows
2019-07-14 23:05
(sorry for delay, I was on the train on the way in and then was walking to work)

william.ariawan
2019-07-15 00:43
has joined #general

abubics
2019-07-15 01:40
I maintain my first comment :stuck_out_tongue:

matt.fellows
2019-07-15 04:18
Yep, if I did choose to test this I'd use the same cookie names and valid looking values with the auth but mocked our on the provider side (or using request filters if needed to inject the correct value at provider verification time if mocking wasn't an option)

antonello
2019-07-15 06:15
Thank you @matt.fellows! So, if you tested it and you could mock the provider side, you would use valid looking values but not actual valid values. In other words you wouldn?t - for example - generate a valid value with a very long expiration date using the real secret?

bethskurrie
2019-07-15 06:31
@antonello I'm with Matt on this one - be pragmatic.

bethskurrie
2019-07-15 06:31
I like the idea of checking that the login endpoint returns a Set-Cookie header

bethskurrie
2019-07-15 06:33
You can set a header at verification time using the --custom-auth-header option so that you don't have to include any valid values in the pact itself.

bethskurrie
2019-07-15 06:34
If you want to be classy about it, you can use custom middleware that 1. makes sure the cookies with the right name are there and 2. replaces their values with real values.

antonello
2019-07-15 06:40
Thank you both!


antonello
2019-07-15 08:08
Thanks @matt.fellows. The provider is in Java though :slightly_smiling_face: (consumer is js).

matt.fellows
2019-07-15 08:09
Ah no. They're called request filters in the JVM implementation

antonello
2019-07-15 08:11
That?s what I thought. We can mock the authorisation/identification logic in the provider though, so - if we decided not to include the cookies in the pact - I reckon it would just be easier to mock.

matt.fellows
2019-07-15 08:30
Agree. Those filters are for break glass scenarios

antonello
2019-07-15 08:32
I would still quite like the idea of generating a real cookie using the real secret (which in dev is different from production) but with a long expiration date.

rosario.azzaro
2019-07-15 14:44
has joined #general

bethskurrie
2019-07-15 21:58
Try it and see and report back @antonello

antonello
2019-07-15 22:09
Consensus today was to not include the cookies header in the contracts, at least for now.

matt.fellows
2019-07-15 22:32
Thanks for the feedback

matt.fellows
2019-07-15 22:33
If the situation changes let us know

ghandour.jihad
2019-07-16 08:21
Hello @bethskurrie, I am coming back to this answer :slightly_smiling_face: I got 2 questions for you:

ghandour.jihad
2019-07-16 08:21
1- Did anyone work on the c++ during this time? do we have a solution?

ghandour.jihad
2019-07-16 08:22
2- Can you please give me more details on the C++ basics you mentioned above, so that I can try and convince a C++ developer to work on implementing a solution?

bethskurrie
2019-07-16 08:57
@ghandour.jihad Nobody has picked this up that I know of. I'm afraid I haven't done c++ since uni (a long time ago!!), so I won't be any help at all with the technical details.

ghandour.jihad
2019-07-16 09:05
sure no worries! @uglyog, hello :slightly_smiling_face: I am interested in a C++ implementation of PACT. Can you please provide me with more details on how can the c bindings of the rust impl you did be used so that we develop a C++ implementation? (I will forward your answer to C++ developers that might be interested in picking up the work) thanks a lot! :slightly_smiling_face:

nathan2oo3
2019-07-16 09:32
Is there a consensus on the best way to use ldap with pact broker? I see nginx python2 ldap module being recommended by Nginx for ldap authentication and there are docker images out there with the http_auth_ldap module compiled but is there a recommended approach for best results?

uglyog
2019-07-16 13:03
The Rust implementation is a shared library that exports C bindings. Should be very usable from C++.

pavani.polakala
2019-07-16 15:44
has joined #general

pavani.polakala
2019-07-16 16:07
Hi. I'm kind of new to pact contract testing and I want to develop pact for android project. But the pact implementation guide for android looks pretty outdated - https://github.com/DiUS/pact-workshop-android/tree/master/consumer . Do you any other link that helps me setup pact in android env?

abubics
2019-07-17 01:23
I don't know if there are any decent recent examples :slightly_smiling_face: but Pact in Android is the same as any other JVM language consumer, so it really depends more on what testing libraries you're using

tanle.oz
2019-07-17 04:07
has joined #general

elvis.willems
2019-07-17 09:23
has joined #general

sebastian.kempken
2019-07-17 09:31
has joined #general

sabil.beladri
2019-07-17 14:00
has joined #general

jakub.gawryjolek
2019-07-17 16:20
has joined #general

pkuang
2019-07-17 18:43
Is there a way to disable these warnings in the pactjs verifier output: "WARN: Adding header ...", they are polluting our logs which makes it difficult to read the verification results

matt.fellows
2019-07-17 23:25
At the moment I don?t believe so. Could you please raise an issue on the pact JS repo and we?ll get it on our backlog?

denis.ducansel
2019-07-18 09:20
has joined #general

meirosuandreea
2019-07-18 09:56
has joined #general

matt.fellows
2019-07-18 11:13
Haven?t heard of anyone doing this yet, but keen to hear how you go if you do

matektchorek
2019-07-18 17:50
has joined #general

tchorek.mateusz
2019-07-18 17:51
has joined #general

matektchorek
2019-07-18 18:14
Hello. I have running server that allows me to retrieve json when I send get method for an endpoint. I have created in groovy a pact that should test if the json I am sending is correct but unfortunately I constantly have ExpectedButNotReceived exception. if I remove willRespondWith or withAttributes methods everything goes fine but in most of examples there were both of them. What am i doing wrong? Json example: [{"_shoppingmalls":[{"href":"http://localhost:8080/api/shopsData/Shoppingmall/1"}],"id":1,"shopId":1,"shoppingmallId":"1", "isOpen":"true"}] def example = new PactBuilder() example { serviceConsumer "consumer" hasPactWith "producer" port 2356 given('' shopping mall request") uponReceiving(" a shopping mall list") withAttributes(method: 'get', path: '/api/shopsData/Shoppingmall') willRespondWith(status:200,headers: ['Content-Type':'application/json']) withBody([ { _links{ href string() } id integer() shopId integer() shoppingmallId string() isOpen string() } ]) } My exception is: ExpectedButNotReceived(expectedRequests= method: get path: /api/shopsData/Shoppingmall query: [:] headers: [ : ] matchers: MatchingRules(rules= {}) genetrators: Generators(categories={}) body: MISSING])

kevin.monteiro
2019-07-18 22:07
has joined #general

uglyog
2019-07-19 00:36
@matektchorek can you verify that the test code is actually making the request. Debug level logs would help.

matektchorek
2019-07-19 05:19
I can see that incoming data in the intellij's console is the same as in the web browser

matektchorek
2019-07-19 05:20
but asserting service.runTest with PactVerifyProvider.OK.INSTANCE fails

uglyog
2019-07-19 05:21
`ExpectedButNotReceived` means the mock server is not getting the request. Where is it going? Enabling debug logging will show what is happening.

matektchorek
2019-07-19 05:21
You mean pacta server?

matektchorek
2019-07-19 05:22
I have the runnig server at 8080 and pacta running at port 2356

matektchorek
2019-07-19 05:22
i only check that one at 8080

uglyog
2019-07-19 05:22
No, when you run the test, a mock server is created. You need to get your consumer code to make the request to that server.

matektchorek
2019-07-19 05:23
so if I go to the real server instead it does show the good results but tells that mock server is not used

uglyog
2019-07-19 05:23
Port 2356

matektchorek
2019-07-19 05:23
the problem is, when I used mock server

matektchorek
2019-07-19 05:23
it generated random hashed values

uglyog
2019-07-19 05:24
It will generate random values if you don't give example values to the `integer()` and `string()` functions

matektchorek
2019-07-19 05:25
ok, my bad then

matektchorek
2019-07-19 05:25
is it possible then to make pacta tests with the real server running on?

matektchorek
2019-07-19 05:26
just for curosity

matt.fellows
2019-07-19 05:26
`s/pacta/Pact`

matektchorek
2019-07-19 05:39
ye, my bad, i use pacta as substitute for Pact

matektchorek
2019-07-19 05:39
anyway

matt.fellows
2019-07-19 05:39
:smile:

matektchorek
2019-07-19 05:39
I have real jar file running in background

matektchorek
2019-07-19 05:39
and I attempt to use that mocked jar

matektchorek
2019-07-19 05:40
in Pact test, is there a way that Pact tests would treat that jar process as a mocked server?

uglyog
2019-07-19 06:04
No, it doesn't work like that

niickkc2
2019-07-19 23:06
has joined #general

seamusjbellew
2019-07-22 05:34
has joined #general

kapoorvishal23
2019-07-22 10:32
has joined #general

bartek.bulat
2019-07-22 13:18
has joined #general

sdpoling
2019-07-22 15:35
I see there are two git repositories pact-provider-verifier and pact-provider-verifier-docker. Is there any significant difference between them (except the underlying versions of the former are more recent).

luchillo17
2019-07-22 17:44
Second one i'm guessing its the docker image to be able to run Pact in a container

igordezky
2019-07-22 17:53
has joined #general

p0deje
2019-07-23 06:30
has joined #general

yousafn
2019-07-23 09:52
Ola, just me being a mither again. Is there any way to skip provider verification for certain pact interactions?

ramspotla
2019-07-23 10:47
has joined #general

thakkarjinal29
2019-07-23 11:35
Ran into the same issue. Is this resolved? Can you please redirect me to where this issue is raised?

ramspotla
2019-07-23 11:45
Hi There , I am trying to use JVM to set up pact project . Is there any sample project for this


detert
2019-07-23 11:57
The only thing that I can image is using tags

matt.fellows
2019-07-23 11:59
What have you tried so far?

matt.fellows
2019-07-23 12:00
Hmmm you sort of can in some cases. You can spexificy a single interaction to test. But not exclude/fliter

ramspotla
2019-07-23 12:04
I have not tried anything yet . First time at our work plc

ramspotla
2019-07-23 12:05
I?m trying to use pact-jvm-junit5 for consunervtestd

ramspotla
2019-07-23 12:05
Consumer test but Gradle build fails . I did as per your example

ramspotla
2019-07-23 12:07
And also other question I have is : does it support soap/ XML messages

yousafn
2019-07-23 12:08
No worries, for the moment, I will just drop those interactions from the consumer sides code. The provider isn?t going to expose a mechanism to modify the expected response via provider states, and from a consumer perspective, the shape of the response is the same for 3 pact interactions, and I can currently validate one of them so its all good

ramspotla
2019-07-23 12:09
Consumer sends soap message to micro service and micro service receives soap messages from downstream systems & process it sends it back to consumer in soap message

tchorek.mateusz
2019-07-23 13:14
I have an endpoint like: "http://localhost:8080/api/data/nbi/Shop?fields=name,shopId" that allows me to get list of shops with certains fields like name, etc. How can I recreate this string in pact framework? Should I add those parameters in query array in "withAttributes" method? Like: withAttributes(method: 'get', path: /api/data/Shop?fields=", query : [name: "name", shopId : "shopId"] ) ?

mui_ume
2019-07-23 13:20
Hi, I am getting confused with the provider for JVM in this github https://github.com/DiUS/pact-jvm/tree/master/provider

mui_ume
2019-07-23 13:20
do I just choose one only. my project is in java, using maven build and spring boot, junit, which one should I look at?

hvgiitr
2019-07-23 14:20
has joined #general

dherman
2019-07-23 14:36
has joined #general


pact.io
2019-07-23 16:10
According to the docs, soap is possible if I remember it correctly. You should take some time to read the docs. It really helps a lot


ramspotla
2019-07-23 22:04
then I went to I use Java section


ramspotla
2019-07-23 22:06
pact-jvm-consumer-junit5 JUnit 5 support for Pact consumer tests Dependency The library is available on maven central using: group-id = au.com.dius artifact-id = pact-jvm-consumer-junit5 version-id = 4.0.x

ramspotla
2019-07-23 22:08
after adding above dependency in gradle , gradle builld failed

craig.pothier
2019-07-23 22:35
I didn't resolve this unfortunately.

uglyog
2019-07-23 23:03
@ramspotla can you provide more info on how your build failed?

wontae.lee09
2019-07-24 00:30
has joined #general

davmitchell
2019-07-24 00:35
has joined #general

tjones
2019-07-24 01:25
If there are interactions in the consumer pact that you don't expect to work yet, tags are definitely the way to go

matt.fellows
2019-07-24 01:28
But you can?t do that _within_ a contract file, which is a current limitation.

mui_ume
2019-07-24 01:43
thanks my first provider pact looks like this: ```package xx.xxxxxx.platform.service.identitymanager.pact; import au.com.dius.pact.provider.junit.Provider; import au.com.dius.pact.provider.junit.State; import au.com.dius.pact.provider.junit.loader.PactBroker; import au.com.dius.pact.provider.junit.loader.PactFolder; import au.com.dius.pact.provider.junit.target.Target; import au.com.dius.pact.provider.junit.target.TestTarget; import au.com.dius.pact.provider.spring.SpringRestPactRunner; import au.com.dius.pact.provider.spring.target.SpringBootHttpTarget; import org.springframework.boot.test.context.SpringBootTest; import org.junit.runner.RunWith; @RunWith(SpringRestPactRunner.class) @Provider("Platform Services") @PactFolder("pacts") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class ProviderPactTest { @TestTarget public final Target target = new SpringBootHttpTarget(); @State("login with valid userId") public void loginTest() { System.out.println("Login Test with valid UserId Verified"); } @State("Start Chat with valid session") public void StartChatTest() { System.out.println("Start chat with valid session Verified"); } @State("logout with valid authToken") public void logoutTest() { System.out.println("logout with valid authToken Verified"); } @State("forgotPassword with valid userId") public void forgotPasswordTest() { System.out.println("forgotPassword with valid userId Verified"); } @State("start Session with valid token") public void startSessionTest() { System.out.println("startSession with valid token Verified"); } } ```

mui_ume
2019-07-24 01:44
I have a pact broker at a url https://pact.shared.frigg.li how do I add to my above code. is it like this: @pactBroker("https://pact.shared.frigg.li")

yousafn
2019-07-24 09:41
Yeah I have a single pact file for each consumer/provider. Some of those interactions are not able to work at the moment, due to the provider state not being able to be addressed in this current phase, so I would ideally like to skip one of those interactions within a pact. I could address it two ways at the moment - either drop the interaction from the pact contract when writing the consumer tests or when I programmatically overwrite a pact prior to verification, to add in AWS signed headers, just remove the interaction from the pact, pre verification. The former is simpler, and is possible now, as we have switched to wiremock for our mock services, rather than using pact mock service, due to some current kwown limitations (which I would like to address and have raised issues/pr?s for :ok_hand: )

antonello
2019-07-24 22:41
Hi! It?s me again! There is something that I have noticed today that is confusing me and some of the teams I?m working with. All our feature branches for consumer and provider have their own pipelines. The consumer?s feature branch pipeline publishes a pact with a tag `feature_branch_a` and the provider?s feature branch pipeline verifies pacts published with tags `master`, `prod` and `feature_branch_a`. So, if the name of the consumer?s and provider?s feature branches match, the pact tagged with `feature_branch_a` gets ?cross-verified?. Today a change was made on a branch of both consumer and provider that involved removing a field from the pact and from the response of the provider. Leaving aside whether this was the right thing to do, when the provider verification ran on the feature branch, it understandably failed because the latest pacts tagged with `master` and `prod` included the field that had been removed from the response of the provider. Now to the bit that I don?t understand. When going to the pact broker matrix and searching for the consumer version that published the pact with tag `feature_branch_a`, it shows that the pact was correctly published. However, it shows that the pact was not verified successfully, even if that pact specifically is compatible with the provider?s feature branch (as demonstrated by running the verification locally agains that tag). I can think of (at least) two possible explanations: a) I don?t understand how the matrix works and it is correct that ?Pact verified? in the matrix is red, or b) when running the provider verification, a failed verification result is uploaded by `pact_jvm` to the broker against the pact with tag `feature_branch` even if the verification tests succeeded when verifying the `feature_branch` tag but failed for `master` and `prod` (which were obviously published by a different consumer version). I hope this is not too convoluted, but it?s sometimes hard to describe these things with enough clarity.

bethskurrie
2019-07-24 22:44
Ok, that's a complicated scenario. Before I delve into it too deeply, have you remembered that the verification belongs to the *content*.

bethskurrie
2019-07-24 22:44
If two different versions of the pact have identical content, then the verification for one also belongs to the other.

antonello
2019-07-24 22:48
Here the content is definitely different as some fields were removed from the pact on the feature branch.

bethskurrie
2019-07-24 22:49
What would help here is if the build URL was published with the results. It's available in the API, but not many clients take advantage of it.

bethskurrie
2019-07-24 22:50
Are you publishing verification results from local machine or CI?

antonello
2019-07-24 22:51
All CI

antonello
2019-07-24 22:51
As we should :)

bethskurrie
2019-07-24 22:51
:thumbsup::skin-tone-3:

bethskurrie
2019-07-24 22:51
You're a pro.

bethskurrie
2019-07-24 22:51
And when you look at the CI results for that branch, they say they're green?

antonello
2019-07-24 22:52
The scenario I?ve described is probably more complicated than it should - but basically it seems that when the provider verification tests run for more than one tag, the latest pact with one of those tags is marked as non verified even the verification failed for a different tag

bethskurrie
2019-07-24 22:53
Sometimes the index can be misleading because it doesn't know which tags are significant, but the matrix should be accurate.

antonello
2019-07-24 22:53
Nope, CI results are red, as expected because feature consumer is compatible with feature provider, but feature provider is not compatible with master consumer.

bethskurrie
2019-07-24 22:53
Esp if you're in the view that shows every version - not the view that rolls up some of the results.

bethskurrie
2019-07-24 22:54
But you'd expect feature_branch_a pact and feature_branch_a verification to be green

bethskurrie
2019-07-24 22:54
Can you find that particular verification result in the CI and see what it says?

bethskurrie
2019-07-24 22:55
When we get verification results into the broker that will also help!

bethskurrie
2019-07-24 22:55
In fact, they may be there, depending which clients you're using. What are you verifying with?

antonello
2019-07-24 22:58
Using `pact-jvm-provider-junit`

antonello
2019-07-24 22:58
>But you?d expect feature_branch_a pact and feature_branch_a verification to be green yes, and that does not seem to be the case.

antonello
2019-07-24 23:01
>Can you find that particular verification result in the CI and see what it says? I can?t see anything being logged with regard to the verification result apart from the two test failures that I expect (for the master and prod tags - well, at least I think it?s for them because it?s 2 out of 3 that failed. Sadly the test runner does not say which tags failed the verification.)

antonello
2019-07-24 23:15
we?re using the `3.6.10` by the way

antonello
2019-07-24 23:21
Time for bed here in :uk:, but I?ll check this again when I wake up in 7 hours. I wonder if @uglyog may have any ideas of whether `pact-jvm-provider-junit` may be behaving incorrectly in this scenario?

uglyog
2019-07-24 23:25
Have a good night! It definitely seems like something is going wrong and we will have to debug a bit further. Version 3.6.10 does publish the verification results, so you will need to dig that out so we can see what is going on.

uglyog
2019-07-24 23:33
Just got a PR to print the tag: > When provider tests are run using the PactBroker, and multiple tags are specified, it can be to figure out which verification was for which tag. > This is slightly annoying especially when verifications fail. This commit prints out the tag if supplied.

antonello
2019-07-24 23:36
That?s great! It?s something we really wanted and I know @alessio.paciello was looking into it but great someone else got there first :blush:

antonello
2019-07-24 23:39
Off the top of your head, do you know if the verification results are published separately for each tag that gets verified?

uglyog
2019-07-24 23:42
It should be, based on the pacts that are fetched. Not sure what happens if two tags fetch the same pact.

gsravikumar
2019-07-25 05:34
has joined #general

gsravikumar
2019-07-25 05:47
Hi , I need input on using PACT for our use case. We are using PACT for our for all our microservice level contract testing. However we have a few jobs (spark jobs) , these jobs consumes data from KAFKA topic.. There are other services which writes into the same KAFKA topic. So two services are not talking to each other via APIs, but use common KAFKA topic. Does PACT supports contract testing for the above scenario ?


gsravikumar
2019-07-25 05:54
Thank you Alex.

matt.fellows
2019-07-25 06:11
Yes, we support testing this sorry if thing. Look for pact message related terms

matt.fellows
2019-07-25 07:02
Sort of thing*

shikha.mishra
2019-07-25 07:44
has joined #general

antonello
2019-07-25 08:12
:+1::skin-tone-2: As you said the next step is probably debugging through it

diegorherrera
2019-07-25 08:20
has joined #general

shikha.mishra
2019-07-25 09:16
Hi everyone, I am quite new to pact and graphql. Has anyone tried mutation in request? Could someone give me some pointers? Thank you:)

manish.kapoor
2019-07-25 10:00
has joined #general

dsu
2019-07-25 10:52
has joined #general

anders
2019-07-25 10:56
Hi Shika. Are you talking about requests to endpoints which mutate persisted data?Our project had some challenges testing this for a while. We solved it by realising that the pact probably should not be verified against an actual live database, but against a mocked database which always contains the expected state (given by the `state` field in the pact interaction), and which doesn't affect any live environment when mutated.

au443479
2019-07-25 13:03
has joined #general

au443479
2019-07-25 13:06
Hi everyone

au443479
2019-07-25 13:07
I want to use to test aws sns notification basically other than res api calls .. is pact a good framework to use for contract testing ?

rajendra.patil
2019-07-25 13:25
has joined #general

matt.fellows
2019-07-25 13:38
yes, you can test SNS notifications

matt.fellows
2019-07-25 13:38
which language?

matt.fellows
2019-07-25 13:38
what have you read/looked at so far?

rajendra.patil
2019-07-25 13:45
Hi Everyone ! I am seeing some wired issue with webhooks talking to slack , I have pivotal cloud foundry instance for my pact broker , when webhook executed it doesn't even go to my https proxy and shows following error.

rajendra.patil
2019-07-25 13:45
Failed to open TCP connection to http://hooks.slack.com:443 (getaddrinfo: Name or service not known)

rajendra.patil
2019-07-25 13:46
after research i learned that it could be caused by rack version! please advice


jgluck
2019-07-25 17:14
has joined #general

christopher.f.almanza
2019-07-25 18:46
Is there any general recommendation for when you have a CD pipeline?

christopher.f.almanza
2019-07-25 18:48
We started off by following the "team communication" motto, which is great. But sometimes we either merge in the wrong order or merge with time in between both consumer and provider

christopher.f.almanza
2019-07-25 18:48
which ends up in a broken build on our integrated environment for some time

christopher.f.almanza
2019-07-25 18:48
is there any process documentation that tackles a similar scenario

ljnoble
2019-07-25 18:58
has joined #general

getsreerag22
2019-07-26 02:28
has joined #general

shikha.mishra
2019-07-26 03:26
Thanks Anders. Yes thats what I was talking about. I will have a look at state field. Thank you:pray:

matektchorek
2019-07-26 12:01
In groovy, how can I add array in withBody parameter? like "array" [ { json: "json" } ] intellij doesnt see array : [ { json: "json" } ]

matektchorek
2019-07-26 12:04
getAt cannot be applied to array

matektchorek
2019-07-26 12:06
ok problem solved

matektchorek
2019-07-26 12:07
array = [ { json: "json" } ] works!

matt.fellows
2019-07-26 12:26
might want to ask this in #pact-jvm


matt.fellows
2019-07-26 12:28
?and read up on provider states

ajeet.tripathi632
2019-07-26 15:57
has joined #general

deshdeepdivakar
2019-07-29 02:37
hi @here I am getting this scalalogging issue when linking the mock server with the interaction. Any help is much appreciated! I am following this https://github.com/DiUS/pact-jvm/tree/master/consumer/pact-jvm-consumer-junit5

uglyog
2019-07-29 02:48
How are you running your tests? Are you using Scala in your project?

deshdeepdivakar
2019-07-29 02:50
No, we aren't using scala at all. I thought the Pact Junit extension might be using scala

deshdeepdivakar
2019-07-29 02:51
Found this https://github.com/lightbend/scala-logging/issues/68 but not entirely sure what is using scala and how I can exclude it

deshdeepdivakar
2019-07-29 03:09
@uglyog I am running my test as Junit test. Intellij

uglyog
2019-07-29 03:26
There must be some conflict that is bringing in different versions of the Scala logging. You can switch to the latest 4.0.0 beta version. That doesn't depend on Scala.

deshdeepdivakar
2019-07-29 03:28
Sure, let me give it a shot. Thank you for your instant responses appreciate :man-bowing:

deshdeepdivakar
2019-07-29 03:33
This is what i have at the moment - ```classpath 'au.com.dius:pact-jvm-consumer-junit5_2.12:3.6.12' classpath 'au.com.dius:pact-jvm-provider_2.12:3.6.12'```

deshdeepdivakar
2019-07-29 03:36
Now replaced with ```classpath 'au.com.dius:pact-jvm-consumer-junit5:4.0.0-beta.1' classpath 'au.com.dius:pact-jvm-provider-junit5:4.0.0-beta.1'```

annarayanarasagond
2019-07-29 04:09
has joined #general

deshdeepdivakar
2019-07-29 04:51
that worked thanks heaps!!

deshdeepdivakar
2019-07-29 06:48
hi @here just a general/conceptual question? When writing the provider test do I need to startup my provider service locally? I am assuming yes which means in our case I need to proxy a whole bunch of services and DB to have that service up and running. We are monolith from repository perspective but the code is segregated across different projects/folders. Any thought/suggestions are much appreciated as we are currently running a spike for this and really want to adapt it. Cheers!

matt.fellows
2019-07-29 07:00
you assumed correct, you do indeed

matt.fellows
2019-07-29 07:00
My general advice would be to stub out any external collaborators (an anti-social style test)

deshdeepdivakar
2019-07-29 07:07
Thanks @matt.fellows just to understand a bit better what you have suggested. Should I be stubbing everything what my provider needs? Also, a few things - we heavily use rpc/jrpc calls between different api's. I know this might already started to sound intertwined and it is. But we are aiming for leveraging http://Pact.io with all these challenges while we work on separating out those projects in to their own services. Cheers

matt.fellows
2019-07-29 07:09
Correct. But, just know thata when you do that, if you were previously relying on those tests for coverage you might need to add others in the interim to give you confidence that integration is working.

deshdeepdivakar
2019-07-29 07:14
Awesome, thanks appreciate your prompt response. :+1:

florian.nagel
2019-07-29 07:15
I had the same issue on the 3.x version

srikanthyadake
2019-07-29 09:25
has joined #general

lennart.tange
2019-07-29 09:56
has joined #general

lennarttange
2019-07-29 09:56
has joined #general

elineopsommer
2019-07-29 13:55
has joined #general

mohindroo.deepak
2019-07-30 06:10
has joined #general

zhaoxia2
2019-07-30 06:10
has joined #general

deshdeepdivakar
2019-07-30 06:23
hi @here can someone please point me to a good provider (Spring + JUnit 5) example. I am a bit confused as all the current JUnit examples are using Wiremock & I have my service running locally as a gradle task. Do I need to have my consumer mocked when verifying provider :thinking_face: https://github.com/DiUS/pact-jvm/blob/master/provider/pact-jvm-provider-junit5/src/test/java/au/com/dius/pact/provider/junit5/HttpsContractTest.java

deshdeepdivakar
2019-07-30 07:18
Also, ```org.junit.platform.commons.util.PreconditionViolationException: No supporting TestTemplateInvocationContextProvider provided an invocation context``` getting this error as well.

matt.fellows
2019-07-30 07:22
Maybe ask in #pact-jvm

deshdeepdivakar
2019-07-30 07:30
@matt.fellows @uglyog ^ can you please help with the error above ^

matt.fellows
2019-07-30 07:32
Sorry, that means nothing to me :grimacing:

matt.fellows
2019-07-30 07:32
Haven't worked in Java for ages

deshdeepdivakar
2019-07-30 07:34
no worries

deshdeepdivakar
2019-07-30 07:34
Sure

antonello
2019-07-30 07:42
Morning or evening, depending on time zones! I?m posting here rather than in #pact-jvm because, aside from the teamwork implementation, there is a more general point here. We have noticed a problem with pact-jvm-provider-junit. We will probably raise an issue on github, but in the meantime here is a brief explanation. When splitting the verification tests across multiple classes using @PactFilter, if some of the interactions are NOT verified (because they are ?filtered out?), the provider verification tests pass AND a verification result is NOT published to the broker.* While this is ?fine? from a can-i-deploy perspective, it is confusing because, when looking at the broker, it looks as though the provider verifications never ran. Also, one could argue that the provider verification tests should also fail if some interactions are not verified. I am inclined to agree with that. What is the ideal behaviour here? Failing the tests and/or uploading a failed verification results would seem reasonable in principle to me. * A couple of months ago @alessio.paciello pushed a fix to prevent the publication of successful verification results if not all interactions were verified.

antonello
2019-07-30 07:46
P.S. the problem doesn?t manifest itself if you don?t use @PactFilter and if all provider verification tests live in the same class. But it is not a sustainable approach, especially for services that are not that micro.

uglyog
2019-07-30 07:57
The ideal solution would be for the broker to accept the verifications in bits, and only display successful verification when all interactions have a successful result. But it will require work to implement this logic in the broker.

uglyog
2019-07-30 07:58
This is the junit 5 way of saying there were no tests to run. Probably because there were no matching interactions found to verify.

antonello
2019-07-30 08:00
You don?t think that pact-jvm-provider-junit could be changed to have a runner that aggregates the results as @alessio.paciello suggested here? https://github.com/DiUS/pact-jvm/pull/890#issuecomment-499769255

dvallabhuni
2019-07-30 08:05
has joined #general

uglyog
2019-07-30 08:09
I mentioned the ideal solution. Because you can then split the tests over multiple build agents. But that will work for tests that run in a single process. The complexity comes in when do you publish the verification result? You can?t wait for a result for all interactions, because if one doesn?t run.

antonello
2019-07-30 08:15
mmm. you make a very good point.

antonello
2019-07-30 08:20
could it be something that you can switch on and off? if you know you run tests in a single process, you would switch on the ability of failing the test run if not all interactions are verified?

william.robson
2019-07-30 09:34
has joined #general

richard.peckett
2019-07-30 14:48
quick question guys, forgive me if I'm being thicky mc thickson from backwardshire here... If you're defining a contract whereby the consumer is actually sending a POST to a provider is this valid (is the consumer actually a consumer here?) can a consumer be a consumer if it's sending data to the provider and the provider is responding in the 200 range with no content in the body?

phall
2019-07-30 14:53
Yes, the consumer is the ?user? of the service. That would be a valid use case.

thirumal.net
2019-07-30 16:07
Hi All @matt.fellows @yousafn we have implemented pact in some of our projects and it is working good. but stuck in implementing pact for non json services . what is the solution for xml response services form pact recommendation? Thanks in advance

yousafn
2019-07-30 16:09
pretty sure pact-jvm has xml matchers, pact-js doesn?t.

thirumal.net
2019-07-30 16:22
Thank you yousaf for quick response, you mean to say we can implement Pact for web services which will return xml responses from consumer and provider side . could you please guide me for some examples ?

atle.rudshaug
2019-07-30 19:26
has joined #general

kyle.hammond
2019-07-30 20:07
has joined #general

matt.fellows
2019-07-30 21:10
@thirumal.net The Java implementation supports XML (as does the Scala one). I?m not sure/aware of other languages Pact supports that do

matt.fellows
2019-07-30 21:10
so you could, but not if you need to test services that are not either of them

matt.fellows
2019-07-30 21:11
I can see the confusion, but yes, it?s still the correct parlance :slightly_smiling_face:

matt.fellows
2019-07-30 21:11
Presumably, the provider does something more than just respond with a `201` or something - hopefully it actually does something useful :slightly_smiling_face:

kyle.hammond
2019-07-30 21:30
Is it possible to write a PACT with the standard v2 matchers that will match a JSON array where each element of the array matches a regex? My consumer matching code look something like this (using pact-consumer-swift) ``` var expectedBody: [String: Any] = ["object": 123] let regex = Matcher.term(matcher: "(abc|def|ghi)", generate: "abc") expectedBody["available"] = Matcher.eachLike(regex, min: 1) ``` I?m trying to say that the ?available? key should contain an array of at least one element, and each of those elements should match the regex (that is, be one of the three possibilities listed in the regex). Example valid responses would be: `{"object":123, "available": ["abc"]}` or ` {"object":123, "available": ["abc", "ghi"]}` or `{"object":123, "available": ["def", "abc"]}` I can?t seem to figure out if the Pact contract v2 is supposed to support this by looking at the specification.

matt.fellows
2019-07-30 22:00
Hmmm that?s an interesting one. It should, I think. `eachLike(regex(...))` doesn?t work?

shivmohan08
2019-07-30 22:47
has joined #general

abubics
2019-07-30 23:20
The provider-consumer relationship is conceptually close to server-client. One end supplies a service via an interface, and the other end invokes it :)

matt.fellows
2019-07-30 23:21
Also see https://gist.github.com/bethesque/43eef1bf47afea4445c8b8bdebf28df0 (sorry didn?t hit send on this yesterday)

dpm
2019-07-31 06:39
has joined #general

srikanthyadake
2019-07-31 13:22
Hi All, I'm new to pact stuff, can anyone help me with this issue : https://stackoverflow.com/questions/57287320/provider-state-errors

srikanthyadake
2019-07-31 13:24
brief about the issue : when I try to run provider against pact file, I see 'error setting up provider-state'.

chaoscifer
2019-07-31 14:11
has joined #general

chaoscifer
2019-07-31 14:18
Hi! Please, Provider gradle task pactVerify fails with org.codehaus.groovy.runtime.DefaultGroovyMethods.collect(Ljava/lang/Iterable;Lgroovy/lang/Closure;)Ljava/util/List; I'm using pact-jvm with Kotlin and I'm loading the pact file from disk within build.gradle: pact { serviceProviders { providerService { protocol ='http' host = 'localhost' port = 7000 hasPactWith("consumerService") { pactSource = file("$rootDir/resources/pacts/providerService-consumerService.json") } } } } The output of this execution is: Verifying a pact between checkingAccount and fraudService [Using File /Users/cassio.kenji/workspace/fraud-service/target/pacts/checking-account-fraud.json] :pactVerify_fraudService (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.011 secs. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':pactVerify_fraudService'. > org.codehaus.groovy.runtime.DefaultGroovyMethods.collect(Ljava/lang/Iterable;Lgroovy/lang/Closure;)Ljava/util/List; -- Sorry for the lack of information at this moment. I work for a fintech and some data is very sensitive. I already tried a variety of alternatives from github examples and some Pact official documentation and I always come to that error. My pact-jvm versions: classpath("au.com.dius:pact-jvm-provider-gradle_2.12:3.6.1") //pactTests testCompile 'au.com.dius:pact-jvm-provider_2.12:3.6.1' Thanks!

kyle.hammond
2019-07-31 15:39
Indeed `eachLike(regex(?))` does *not* work during pact verification on the provider side. The consumer can code it that way, but I don?t know that the generated PACT is valid. The verification on the server side shows > Error: WARN: Only the first item will be used to match the items in the array at $[?body?][?available?] and stops the verification since it?s an error.

kyle.hammond
2019-07-31 15:42
The spec says, for the ?MinType? matcher > This executes a type based match against the values, that is, they are equal if they are the same type. In addition, if the values represent a collection, the length of the actual value is compared against the minimum. That implies that it is a ?Type? based match, and not a Regex based match for the items in the array. I?m not sure if ?type? based matches are supposed to be replaceable with ?Regex? based matches; that is, if anywhere I can put a type based match I could instead put a Regex based match.

uglyog
2019-07-31 23:02
Try the latest version of pact-jvm. Also check out https://github.com/pactflow/injected-provider-states-example and see if you get the same problem

chaoscifer
2019-08-01 00:12
hi, thanks for you reply! I ended solving this up by updating my gradle wraper to 5.1.1. as I said I work for a fintech and infosec is very restrictive... I have to use an internal repo and some packages are kinda of old. thanks again!

franklin.huynh
2019-08-01 01:36
Hi all I just wanna ask about the idea how to do the below statement without modifying the provider test > Add the ?production? tagged pact to the list of pacts the provider will verify. My current provider script is ``` new PactVerifier(config) .ProviderState($"{PactServiceUri}/provider-states") .ServiceProvider(ProviderName, ProviderUri) .HonoursPactWith(ConsumerName) .PactUri($"PactUtilities.PactBrokerCloud}/pacts/provider/{ProviderName}/consumer/{ConsumerName}/master") .Verify(); ``` Many thanks

franklin.huynh
2019-08-01 05:29
@matt.fellows ^^ any idea

srikanthyadake
2019-08-01 05:31
@matt.fellows any idea? thanks.

antonello
2019-08-01 05:35
Which language is that?

franklin.huynh
2019-08-01 08:12
it's C# @antonello

james.hattersley-dyke
2019-08-01 10:13
Hi, bit of a vauge question. We have an nginx service which calls a downstream REST API using lua. Nginx/lau is the consumer, and the provider is a spring boot app. I noticed there's a generic provider verification tool, is there the consumer equivilant? rather then install node or python etc into the nginx project, I was wondering if there's a generic way to create contracts?

sundakr1
2019-08-01 11:20
has joined #general

marius.maaland
2019-08-01 16:41
has joined #general

marius.maaland
2019-08-01 16:48
Hi all! I'm reading up on, and trying out Pact testing for my company. One question I have is: Can you not run provider tests against deployed APIs, using HTTP*S* ? Our APIs cannot be run locally (locahost, like in all the examples I've seen), but we do deploy to staging before production. I would like to run provider tests against `https://myapi-staging.com/blabla` before deploying to production. Is Pact not intended to be used that way, or am I missing something? When I do run a test like that, the test fails with `read server hello A: unknown protocol`

sedpavel
2019-08-02 12:09
has joined #general

ajitvdpthk
2019-08-02 12:17
has joined #general

matt.fellows
2019-08-03 13:54
You can do it that way, but it will get harder to do as your contracts get more advanced (e.g. setting up states). People so it though and can be a good way to get started with Pact

luis.giraldo10
2019-08-03 18:46
has joined #general

luchillo17
2019-08-03 19:19
Guys question about GraphQL interactions and provider states, i need the same query, different `given` clause & different response, i tried adding this new interaction in the exact test that uses it with the hope that the next request would use the latest defined interaction that matched the request in this test, but it uses the first interaction, how do we use the `providerStates` feature with GraphQL interactions?

luchillo17
2019-08-03 19:24
To clarify the new interaction has the same `withRequest`, `withVariables`, `withQuery` and `withOperation` (as null), things different are the `given`, `uponReceiving` and `willRespondWith`

srikanthyadake
2019-08-04 05:59
Hi all, a question regarding provider state. I need to do a post call which requires http request header from another api. Can I add request header in provider state block?

srikanthyadake
2019-08-04 08:47
I read about this, generateNewHeaders and requestFilters should be added. I am writing in .net and is this implemented in pact-net ? If so, any examples around?

matt.fellows
2019-08-04 22:34
It looks like the suffix `/master` is the tag. So you probably want to also do that for, say, `/production`

matt.fellows
2019-08-04 22:34
(sorry, was traveling second half of last week)

matt.fellows
2019-08-04 22:35
I think so, but you?d need to install Ruby for that CI job

matt.fellows
2019-08-04 22:36
for an example using the mock service in a standalone way (basically, a very crude implementation of what Node/Go/Python/PHP? use) see https://github.com/pact-foundation/pact-mock_service/blob/master/script/example.sh

franklin.huynh
2019-08-04 23:38
no worry @matt.fellows is that mean I need to update the provider test in order to verify /production tag? Do you have any idea to do it in cicd script? For example, if there is Production tag, it will automatically get the production tag verify?

franklin.huynh
2019-08-04 23:42
I'm trying to make it standard so the owners of the provider test don't need to raise any PR that just to add production tag

franklin.huynh
2019-08-04 23:42
I hope my question is clear

matt.fellows
2019-08-05 02:29
yep

matt.fellows
2019-08-05 02:29
I usually use git tags and/or environment variables to modify behaviour in builds. For example, if on the `master` branch, you might want to verify tags that match `master` and `production` whereas on a branch you might want `feature1` and `production`.

matt.fellows
2019-08-05 02:30
the code you shows above is just going to validate a single tag `master`. You might want it to dynamically iterate over a list of tags that are (possibly) supplied by the build environment

matt.fellows
2019-08-05 02:31
e.g. the build environment might have an environment variable `TAGS=master production` and you split that based on space, and then iterate over it

matt.fellows
2019-08-05 02:31
I don?t know the .NET API all that well, but others let you specify an array of tags to be verified. See if that?s possible, or perhaps raise a feature request if not

franklin.huynh
2019-08-05 03:15
this is exactly what I needed. I'll have a look on that if .net api have it

franklin.huynh
2019-08-05 03:26
at the moment, if I want to verify 2 tags, I need to verify it twice ``` new PactVerifier(config) .ProviderState($"{PactServiceUri}/provider-states") .ServiceProvider(ProviderName, ProviderUri) .HonoursPactWith(ConsumerName) .PactUri($"PactUtilities.PactBrokerCloud}/pacts/provider/{ProviderName}/consumer/{ConsumerName}/master") .Verify(); new PactVerifier(config) .ProviderState($"{PactServiceUri}/provider-states") .ServiceProvider(ProviderName, ProviderUri) .HonoursPactWith(ConsumerName) .PactUri($"PactUtilities.PactBrokerCloud}/pacts/provider/{ProviderName}/consumer/{ConsumerName}/production") .Verify(); ```

franklin.huynh
2019-08-05 03:27
it'll be great if we can pass as an array for to PactUri function

franklin.huynh
2019-08-05 03:27
I checked, it doesn't accept array list

matt.fellows
2019-08-05 04:13
might be worth raising a feature request

franklin.huynh
2019-08-05 04:34
yes, will do

mohindroo.deepak
2019-08-05 06:35
I was trying to set PactDir in consumer side where pact files generated but it always create in d:\pacts directory? Is this a bug? Another issue coming is how provider will get all pact files for specific provider? It can be multiple consumers using one provider?

matt.fellows
2019-08-05 06:48
Can you please ask that question in the related language channel @mohindroo.deepak? That will help get it answered quicker

gs201m
2019-08-05 10:19
has joined #general

matt.fellows
2019-08-05 12:44
Sorry Carlos I didn?t quite follow this question. Are you asking if you can use provider states with GraphQL? The short answer is yes, all that the JS GraphQL interface is is a wrapper over the default one (i.e. you could use that if you needed too)

matt.fellows
2019-08-05 12:44
What issue are you actually facing?

luchillo17
2019-08-05 16:01
To clarify the new interaction has the same `withRequest`, `withVariables`, `withQuery` and `withOperation` (is null), things different are the `given`, `uponReceiving` and `willRespondWith`, but the second request (which is the one that should use the new interaction) is still using the previous one.

matt.fellows
2019-08-05 22:13
Is it two requests in the same test? Or spread across multiple? I don?t believe you can do it twice within the same test

matt.fellows
2019-08-05 22:13
across tests it should work, and if not is a bug. Are you sure the interactions are cleaned in between tests? If you could paste the logs I can t take a look

luchillo17
2019-08-05 22:36
Its in same file, different `it` block.

pbarrientos
2019-08-05 22:46
has joined #general

matt.fellows
2019-08-05 22:48
should work, assuming you call `verify()` in between

luchillo17
2019-08-05 22:57
Hmm? the issue is when we're defining the interacions in the consumer, verify is called in the provider isn't it?

goingkilo
2019-08-05 23:22
has joined #general

matt.fellows
2019-08-05 23:55
In the consumer, you still must call the `verify()` method to ensure that your code did what you said it would


matt.fellows
2019-08-05 23:55
(I generally run this in the `afterEach` type block - after each `it` statement, we should check that your code did what it said it would do - in your case, make a call to the GraphQL mock service)

matt.fellows
2019-08-05 23:55
If you could share your code / logs, I could help more

luis.giraldo10
2019-08-06 00:38
@matt.fellows This is the code (test) and log

franklin.huynh
2019-08-06 00:47
hi @matt.fellows, I raise the feature request and I'd like to work on it. Could you explain to me on how other can use it in CICD? Please leave your comment here


franklin.huynh
2019-08-06 01:38
please ignore the above

sbellew
2019-08-06 02:03
has joined #general

gs201m
2019-08-06 04:36
You can consider running PACT against the deployed API in staging. Only pact generation is part of the unit tests...

thirumal.net
2019-08-06 05:45
Thank you @matt.fellows and @yousafn. we are analyzing pact implementation for xml-rpc service project. i am unable to find out any sample java example for pact xml -rpc projects. please share it if you come across pact implementation for xml-rpc

beth
2019-08-06 09:30
Try asking in the #pact-net channel @srikanthyadake

srikanthyadake
2019-08-06 13:16
cool, I was not aware of the channel. anyway, issue is resolved by using PactVerifierConfig.CustomHeader

srikanthyadake
2019-08-06 13:17
This is resolved now, this happened as there was a issue with pact file.

c.metz
2019-08-06 19:22
has joined #general

c.metz
2019-08-06 19:32
Question: is it possible to define a regex matcher for a plain text body of a multiformdata request? For details see: https://stackoverflow.com/questions/57372629/how-to-define-pact-specification-matching-rule-for-single-string-body. Help would be much appreciated. We got stuck with this. Thanks!

matt.fellows
2019-08-06 21:33
I had a quick look - the test seemed to run as expected as far as the log is cooncerned

matt.fellows
2019-08-06 21:35
That test file you sent me can?t match that log file. The description doesn?t match (log has ?A user? which is not present in the code)

matt.fellows
2019-08-06 23:01
@uglyog any suggestions?

efroese
2019-08-06 23:05
has joined #general

deshdeepdivakar
2019-08-06 23:47
Hi @here anyone tried http://pact.io for `json-rpc` ?

bethskurrie
2019-08-06 23:50
Try asking in the #pact-rust channel. @uglyog will be able to help you.

matt.fellows
2019-08-07 00:09
not me. Any reason why it wouldn?t work with Pact? Looks like JSON req/res so in theory should be OK?

deshdeepdivakar
2019-08-07 03:32
hi @matt.fellows I thought so, but few something i noticed : For a json-rpc header - should be `Content-Type : application/json-rpc` and if you set the ```context.setTarget(new HttpTestTarget``` it seems to override the header with some default values like `Content-Type : application/json`

matt.fellows
2019-08-07 03:37
Oh! Interesting

matt.fellows
2019-08-07 03:37
which language is this?

deshdeepdivakar
2019-08-07 03:54
`Java`

matt.fellows
2019-08-07 05:05
are you setting the correct headers in your request/response setup?

matt.fellows
2019-08-07 05:05
That doesn?t seem right, Pact shouldn?t modify / coerce any headers

deshdeepdivakar
2019-08-07 05:30
```package consumer; import au.com.dius.pact.consumer.MockServer; import au.com.dius.pact.consumer.Pact; import au.com.dius.pact.consumer.dsl.PactDslJsonBody; import au.com.dius.pact.consumer.dsl.PactDslWithProvider; import au.com.dius.pact.consumer.junit5.PactConsumerTestExt; import au.com.dius.pact.consumer.junit5.PactTestFor; import au.com.dius.pact.core.model.RequestResponsePact; import org.apache.commons.collections4.MapUtils; import org.apache.http.HttpResponse; import org.apache.http.client.fluent.Request; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import java.io.IOException; import java.util.HashMap; import java.util.Map; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; import static http://org.hamcrest.core.Is.is; //1. Add the Pact consumer test extension to the test class. @ExtendWith(PactConsumerTestExt.class) @PactTestFor(providerName = "messageService", port = "8080") public class rpcConsumerTest { private Map<String, String> headers = MapUtils.putAll(new HashMap<>(), new String[] { "Content-Type", "application/json-rpc" }); //2. create a method annotated with @Pact that returns the interactions for the test @Pact(consumer = "ConsumerService", provider = "messageService") public RequestResponsePact getMessage(PactDslWithProvider builder){ return builder .given("default") .uponReceiving("retrieve message") .path("/message") .method("GET") .willRespondWith() .headers(headers) .status(200) .body( new PactDslJsonBody() .integerType("id") .stringType("jsonrpc", "2.0") .stringType("method", "getMessage") .object("params", new PactDslJsonBody() .stringType("text","rpc-pact-demo") )).toPact(); } //3. Link the mock server with the interactions for the test with @PactTestFor @Test @PactTestFor(providerName = "messageService", pactMethod = "getMessage") void verifyGetMessage(MockServer mockServer) throws IOException { HttpResponse httpResponse = Request.Get(mockServer.getUrl() + "/message").execute().returnResponse(); assertThat(httpResponse.getStatusLine().getStatusCode(), is(equalTo(200))); // assertThat(IOUtils.toString(httpResponse.getEntity().getContent()), // is(equalTo("{\"articles\":[{\"variants\":{\"0032\":{\"description\":\"sample description\"}}}]}"))); } } ```

deshdeepdivakar
2019-08-07 05:31
I think I am setting it up right. Sorry, accidentally posted the whole Consumer spec

deshdeepdivakar
2019-08-07 05:31
``` private Map<String, String> headers = MapUtils.putAll(new HashMap<>(), new String[] { "Content-Type", "application/json-rpc" });``` Json rpc GET request body ``` {"id":"1420197679","jsonrpc":"2.0","method":"getMessage","params":{"text":"rpc-pact-demo"}} ```

deshdeepdivakar
2019-08-07 07:11
@matt.fellows ^ your thoughts please?

matt.fellows
2019-08-07 07:13
Sorry, I?m not across the Java DSL so I can?t respond with any authority, but looks ok to me

matt.fellows
2019-08-07 07:15
might be worth chatting in #pact-jvm to see if there are any people with specific advice?

vineethv
2019-08-07 08:09
has joined #general

c.metz
2019-08-07 08:54
I will. Thanks for your suggestion!

gs201m
2019-08-07 09:17
#general

gs201m
2019-08-07 09:21
Guys, I am trying to run PACT tests on a GOLang based MS. It works well in local but on the CI JENKINSX it always throws me error ?pact-mock-service?: executable file not found. Any help is appreciated.

matt.fellows
2019-08-07 09:39
My guess is that the executables are not on the `PATH`

matt.fellows
2019-08-07 09:39
Prove that's not true first and go from thetr

gs201m
2019-08-07 09:43
@matt.fellows how to set the executables in PATH in Jenkins File (using Jenkins X). In windows local I can do it. But on Jenkins kubernetes how can it be done?

matt.fellows
2019-08-07 09:56
:man-shrugging:

matt.fellows
2019-08-07 09:56
Who manages your Jenkins environment?

matt.fellows
2019-08-07 09:56
Its an environment variable. It just needs to be updated to point at where you've installed pact

uglyog
2019-08-07 10:05
Must be a defect if it is overwriting the header

gs201m
2019-08-07 10:06
That?s the challenge. It?s on JENKINSX on kubernetes. We have to mention in the Jenkins File about the instruction to install and point to the same. Which I am doing. Still no luck.

gs201m
2019-08-07 10:32
@matt.fellows is there any specific way to set path in Jenkins X

matt.fellows
2019-08-07 10:36
Im sorry, I don't know anything about Jenkins X

matt.fellows
2019-08-07 10:37
It looks ok, can you check if the binati s are in that directory and iff you can execute any of them?

matt.fellows
2019-08-07 10:38
Binaries*

antstorm
2019-08-07 10:48
has joined #general

deshdeepdivakar
2019-08-07 11:55
hi @uglyog, @matt.fellows sorry it wasn't overwriting the header. I misread that. ```21:44:57.819 [Test worker] DEBUG au.com.dius.pact.core.matchers.Matching - Found a matcher for application/json-rpc -> au.com.dius.pact.core.matchers.JsonBodyMatcher@7af6e144 returns a response which has status code 200 (FAILED) includes headers "Content-Type" with value "application/json-rpc" (OK) has a matching body (FAILED) Failures: 0) Verifying a pact between ConsumerService and messageService - retrieve message returns a response which has status code 200 expected status of 200 but was 400 1) Verifying a pact between ConsumerService and messageService - retrieve message returns a response which has a matching body / -> Expected empty body but received '[B@348a87ce'```

matt.fellows
2019-08-07 12:09
good to know. So it looks like your API is returning stuff when it shouldn?t?

deshdeepdivakar
2019-08-07 12:12
I wrote a basic -`rpc` service returning a string you pass to it & it works as curl request

deshdeepdivakar
2019-08-07 13:12
I don't think it's replaying the interaction as I can't see any request coming through in my provider service

amber.race
2019-08-07 21:45
has joined #general

brent.foley
2019-08-07 22:20
has joined #general

thirumal.net
2019-08-08 05:49
@uglyog Could you Please guide me here

nikolajs.cmihuns
2019-08-08 05:52
Hi, please help me to get understanding in the following problem. Provider has several http API's - 1,2,3,4. Is it somehow possible to verify api calls chain, the correct order in which api's must be called using PACT. The correct order let's say is 1,2,3,4, but not 1,3,2,4. Would provider state feature help here somehow or it's not the case for PACT testing at all ?

matt.fellows
2019-08-08 05:54
What have you read so far about this? Basically, in Pact you always test 1 API at a time. If you need state to do a call, lookup ?provider states?.

matt.fellows
2019-08-08 05:54
http://docs.pact.io has all of these questions answered in one form or another

matt.fellows
2019-08-08 05:54
see FAQ, best practices etc.

uglyog
2019-08-08 05:55
There are no example projects that I know of that use XML. You'll have to look at the XML tests in the Pact-JVM codebase, like this one https://github.com/DiUS/pact-jvm/blob/master/core/matchers/src/test/groovy/au/com/dius/pact/core/matchers/XmlBodyMatcherSpec.groovy or use the JSON examples but replace the bodies and content types with XML

sayboras
2019-08-08 06:56
has joined #general

nikolajs.cmihuns
2019-08-08 07:08
thanks:+1:

gs201m
2019-08-08 07:38
#general guys I am stuck in implementing pact for GO-LANG over Jenkins X. It always complains that it?s not able to find pact-mock-service not found in path. I am explicitly setting the path in Jenkins file through commands. It?s not working out.- Any helps or pointers is much appreciated.

matt.fellows
2019-08-08 07:44
Can you manually execute the binaries to see if they are present? Have you tried enabling debug/verbose on pact go to see if that provides feedback? What have you tried?

matt.fellows
2019-08-08 07:46
The PATH setting looks ok. Have you tried a `which pact-broker` to see if it finds the binary?

gs201m
2019-08-08 11:02
I am using the latest go-pact validation. Getting an error before

matt.fellows
2019-08-08 12:00
Can you run the pact binaries that you've downloaded? Ignoring pact go for a second, let's get the dependencies working first

oswald.quek
2019-08-08 15:06
it'll be something like `@PactBroker(scheme = "https", host = "http://pact.shared.frigg.il")`

gs201m
2019-08-08 18:33
Yes, pact binary is available and is being invoked. However the mock service is still not starting.

anupamknw
2019-08-08 18:43
has joined #general

luchillo17
2019-08-08 19:31
That section is likely to come from another test in the Auth service/store

matt.fellows
2019-08-08 22:09
What happens when you run `/usr/local/git/bin/pact-mock-service` directly? (not through Pact Go)

thirumal.net
2019-08-09 00:08
Thank you @uglyog

uglyog
2019-08-09 00:11
You can also take this opportunity to be the first to create a sample project for it :smile:

thirumal.net
2019-08-09 00:13
sure:) if my poc goes well , will update you back on the same. Thank you again !:+1:

deshdeepdivakar
2019-08-09 05:21
hi @here I am keen to understand the best practices around maintaining Pact's across different versions. For example : Assume, consumer version 1 defines pact for provider version 1 and next iteration we add some non breaking changes to provider version 1 and incremented provider to version 2 - should I'll be updating the consumer 1 pacts?? How would I ensure backward compatibility if I update my pact fro consumer 1? Please, share your experience. Cheers!!

antonello
2019-08-09 06:47
If it?s only the provider that changes, you shouldn?t make any changes to your consumer tests. Simply provider version 2 will have to verify the pact published by consumer version 1.

matt.fellows
2019-08-09 07:11
:point_up:

matt.fellows
2019-08-09 07:11
Exactly what Anto said

matt.fellows
2019-08-09 07:11
so you can keep making changes to the provider until such point that it breaks one of its consumers - Pact will detect this situation

matt.fellows
2019-08-09 07:13
This is the easiest case. It gets more complex when both consumers and providers are constantly making changes. This is where the Pact Broker comes in handy, and can help you identify which components are compatible at any one moment (the can-i-deploy command is the most useful here)

puja.bhattacharya.pb
2019-08-09 18:28
has joined #general

kbakk
2019-08-10 17:01
has joined #general

kbakk643
2019-08-10 17:16
has joined #general

mohindroo.deepak
2019-08-11 07:57
If provider wants to do some breaking and important changes in the code which effects consumer as well then 1) will provider not able to release those changes till consumer not make their changes? Might be consumer need another week to release those changes. 2) logically provider release pipeline should fail. But how will we intimate this breaking change to all consumers across the company?

matt.fellows
2019-08-11 07:59
1) is the answer. If you do release the changes, then you break the consumers. Why would you want to do that?

matt.fellows
2019-08-11 07:59
You initiate the change by talking to the teams

matt.fellows
2019-08-11 08:00
Ideally, you inplement the change using the expand/contract schema approach

matt.fellows
2019-08-11 08:00
Add new field with new behaviours, wait for consumers to transition to it, deprecate old field

bart.schotten
2019-08-11 08:10
I have question about the Pact Specification (maybe there should be a channel for that): why was the decision made to allow matching rules on requests? I can't think of a scenario in which that would be useful and it seems to go against Postel's Law...

mohindroo.deepak
2019-08-11 08:39
Intimation to the consumers about change will be manual or it is automated with some feature? What are the roles of web hooks here?

bethskurrie
2019-08-11 08:46
I personally don't tend to use it, and recommend strict matching where possible, as I only use pact to unit test the client class that is responsible for communicating with the provider. Some people do use it for higher level tests, in which case the more flexible matching is handy. There's also the case where you can use a generated pact to create a stub service for higher level integrated tests, and it's very useful then.

bart.schotten
2019-08-11 08:57
Right, that last case I can imagine.

matt.fellows
2019-08-11 09:33
I mean. You have to speak to your consumers if you're going to decide break stuff. Period. No tool can automate that for you. But Pact has a number of ways of determining if systems are compatible with one another, the most notable is using can-i-deploy with the broker. But the usual flow is that if you break a consumer on the provider side the provider teams build will fail (because if you release bad things will happen) and that's a prompt to go and speak to people (see the theme here?).

matt.fellows
2019-08-11 09:34
Webhooks are useful, and you could use a webhooks on a failed verification to notify consumers. The usual case is for the opposite - to kickoff builds on the provider side for a new contract/changed contract. You could subscribe to the same event to notify the providers of the change

mohindroo.deepak
2019-08-11 18:37
Thanks

richard.jones
2019-08-11 22:14
If I understand your question correctly, matching on requests (allowing variable parameters to match the request params/payload) is very useful to us because it means we can generate a single pact that handles many different unit test data cases, rather than generating new pacts for each case.

richard.jones
2019-08-12 03:13
Is anyone verifying pacts against AWS lambdas?

uglyog
2019-08-12 03:23
Yes, using message pacts.


bart.schotten
2019-08-12 06:30
I personally wouldn't use Pact for unit tests in this way, but it's always interesting to hear how other people approach things.

antonello
2019-08-12 07:47
I imagine that a common, or at least useful, use case for pact is to verify backwards compatibility of api changes against multiple versions of native mobile applications that users may be using. Obviously in this case there can be more than one consumer version in production. @emanuele.ivaldi and I were discussing this and we were thinking that a possible approach may be to tag consumers, when released, with a tag like ?prod-v1.2.0?. This way, you could run provider verification tests against all the ?live? versions, provided that you keep a list of the current live versions somewhere outside of the broker, as you cannot at the moment query the broker for a tag with wildcards. An alternative approach, as the provider is written in Java, would be to be able to tell pact-jvm: ?verify all pacts with a prod tag and not just the latest one tagged ad prod?. This approach would require removing prod tags from the consumer when versions are deprecated and, obviously, a change to pact-jvm. Thoughts?

matt.fellows
2019-08-12 08:05
My first instinct is to support wildcards or regexes to achieve it, with the behaviour of still retrieving the latest for each tag it finds. I suspect they will have unintended consequences but seems the nicest

matt.fellows
2019-08-12 08:06
The answer we usually give is for the provider to know in advance of sacred tags and include that in the list to verify, but it would be nice automate that

antonello
2019-08-12 08:10
Which - as I explained - would require tagging with something more than just `prod` - in other words the tags need to be aware of the version also, which is a bit of a bastardisation of the tags, but kind of harmless.

fernandojsmoreira
2019-08-12 08:12
has joined #general

matt.fellows
2019-08-12 08:22
yes, indeed it is

matt.fellows
2019-08-12 08:22
it?s definitely a workaround, and not a true first class citizen in the system

bethskurrie
2019-08-12 10:21
@antonello I've designed the API so that you can verify *all* pacts with a given tag, not just the latest.

bethskurrie
2019-08-12 10:21
This is to support mobile consumers that have multiple prod versions.

bethskurrie
2019-08-12 10:22
There is a bit of code in the client that needs to be added to support specifying the "all" instead of just "latest", and I just haven't gotten around to putting that in yet.

antonello
2019-08-12 10:22
that?s great @bethskurrie! However, as far as understand it, `pact-jvm` does not support that (yet).

bethskurrie
2019-08-12 10:22
Someone else has asked for it recently, and I need to do it, but I've been using all my Pact energy on Pactflow, and then I come home and I have nothing for the OSS code.

bethskurrie
2019-08-12 10:22
pact-jvm will soon.

antonello
2019-08-12 10:23
sounds great

bethskurrie
2019-08-12 10:23
There's a new API being written for supporting "pending pacts" which will make the broker a lot smarter in what pacts it returns for verification.

antonello
2019-08-12 10:23
in the meantime, we may have to use the workaround.

bethskurrie
2019-08-12 10:23
Again, it's close to done, but I've had little OSS code time recently.

bethskurrie
2019-08-12 10:24
Yes, if you keep a "manifest" of the prod versions, it will achieve the same thing.

bethskurrie
2019-08-12 10:24
I think it would be easier than trying to do wildcard matching.

gaurav13.singh
2019-08-12 13:52
has joined #general

gaurav13.singh
2019-08-12 13:54
Hi, Does pact supports SOAP api calls??

gaurav13.singh
2019-08-12 13:59
basically my microservices make a soap request to downstream system and convert it back to json to serve client

gaurav13.singh
2019-08-12 14:00
so I need to implement pact between my microservice and the downstream system

nathan2oo3
2019-08-12 14:58
Where in pact brokers http://config.ru does the webhook_host_whitelist need to be set? I have tried it in the config loop and outside it below the basic auth variables but still get the error "for security purposes the response details are not logged. Configure webhook host whitelist"

marius.maaland
2019-08-12 15:57
Yeah I am trying to run against staging. The problem is that `pact-go` doesn't seem to like `https` , because it gives me `read server hello A: unknown protocol` when I try it

matt.fellows
2019-08-12 21:08
Is it a self signed certificate?

matt.fellows
2019-08-12 22:22
Search this channel for that very question. Not all languages support XML but Java + Rust does

richard.jones
2019-08-12 23:15
What do you see as ?in this way??

bethskurrie
2019-08-12 23:22
It just goes where the rest of the config goes. Can you copy paste it here? You definitely restarted the server after making the change?

matt.fellows
2019-08-13 11:30
What language are you using?

gijs.van.der.venne
2019-08-13 12:01
has joined #general

gijs.van.der.venne
2019-08-13 12:05
Hi everyone, We started using Pact testing and am running into an issue. Consumers provide pact contracts that we have to adhere to as provider. We get a nice contract from the consumers stating an event that we did not build yet. So our pact-jvm build is now failing. How can i prevent my build to fail in this case?

matt.fellows
2019-08-13 12:06
So my guess is that the consumers are yet to move to production (because their code wouldn?t work). My guess, is that their work is on a feature branch

gijs.van.der.venne
2019-08-13 12:07
Yes it is in a staging branch indeed but now our application build is failing because we use the central staging branches to comsume the contracts

matt.fellows
2019-08-13 12:08
The usual way of dealing with this, is to get your consumers to only tag what?s in production as e.g. `prod` and your provider only cares about validating things that are in, or about to go to, production

matt.fellows
2019-08-13 12:08
(see https://docs.pact.io/best_practices/pact_nirvana for the full workflow you should follow over time)

matt.fellows
2019-08-13 12:09
(you might use multiple tags, but again, that doc above will illuminate that)

matt.fellows
2019-08-13 12:09
If they are tagging the pact as something that needs to be supported by you straight away, but is not valid, you will need to have a conversation with that team telling them that their feature is not yet ready and that they are breaking your build

matt.fellows
2019-08-13 12:10
Their workflow needs to support reality - right now they?ve told you via a Pact publish that it needs to be supported, and Pact is failing because it doesn?t want that to happen. I?d suggest reviewing your tagging strategy, so that features that aren?t going to production yet don?t fail your build

gijs.van.der.venne
2019-08-13 12:10
Thanks a lot of this information

gijs.van.der.venne
2019-08-13 12:11
am starting to read the documentation and the strategy seems very useful indeed am going over to the team to see if they tagged anything :slightly_smiling_face:

matt.fellows
2019-08-13 12:13
:thumbsup:

matt.fellows
2019-08-13 12:14
you?re welcome!

nathan2oo3
2019-08-13 15:02
dc = PactBroker::DockerConfiguration.new(ENV, PactBroker::Configuration.default_configuration) dc.pact_broker_environment_variables.each{ |key, value| $http://logger.info "#{key}=#{value}"} app = PactBroker::App.new do | config | config.logger = $logger config.database_connection = create_database_connection(config.logger) config.database_connection.timezone = :utc config.enable_public_badge_access = true config.enable_badge_resources = true config.webhook_host_whitelist = dc.webhook_host_whitelist config.webhook_http_method_whitelist = dc.webhook_http_method_whitelist config.webhook_scheme_whitelist = dc.webhook_scheme_whitelist #You should set these to appropriate values for your organization config.webhook_host_whitelist = ['http://host.domain.com'] # For security reasons, it is not recommended to alter this list (see below) config.webhook_http_method_whitelist = ['POST'] config.webhook_scheme_whitelist = ['https'] config.base_equality_only_on_content_that_affects_verification_results = dc.base_equality_only_on_content_that_affects_verification_results config.order_versions_by_date = dc.order_versions_by_date config.disable_ssl_verification = dc.disable_ssl_verification end

nathan2oo3
2019-08-13 15:02
Currently how we have it configured. Apologies about the formatting seems mobile app doesn't have code formatting

li.poltorak
2019-08-13 21:51
has joined #general

li.poltorak
2019-08-13 22:10
Hi, I'm working with a couple of other SDETs and QA engineers across teams at my company to test out pact and see if it will work for our needs, we're just putting together a quick proof-of-concept to learn more about the tool. In the particular case I'm testing, the consumer is a python api and the provider is a php (laravel) api. I was wondering, is it required to set up a provider states url for the provider, even if I'm just testing a GET request for a resource I know exists?

matt.fellows
2019-08-13 22:11
Awesome!

matt.fellows
2019-08-13 22:12
Nope, for a lot of cases you can get by with out them. I still like to document the state itself (because it makes for more readible test cases and clarity) but don?t act on the provider state during validation

matt.fellows
2019-08-13 22:12
In many cases, I single (well designed) database fixture on the provider side can take care of most states

matt.fellows
2019-08-13 22:12
e.g. `given user A exists` and `given user B does not exist` is an easy thing to implement

matt.fellows
2019-08-13 22:13
doing `given user A exists` and `given user A does not exists` requires different data to be seeded during verification.

li.poltorak
2019-08-13 22:25
It looks like `.given('user A exists')` or whatever is required, and if there's nothing set up on the provider-side for that, it fails validation (`Could not find provider state "user A exists" for consumer...`). Is there a way to set it up to not require it? Or not expect it in the consumer test?

li.poltorak
2019-08-13 22:25
I'm new to this concept, so forgive me if I'm missing something obvious.

matt.fellows
2019-08-13 22:53
hmmm

matt.fellows
2019-08-13 22:53
that might be a bug on the PHP code - it shouldn?t fail the test if not present, just emit a warning

matt.fellows
2019-08-13 22:54
Are you sure it?s an error and failing the test? If it is, perhaps omit them for now, and raise an issue on the GitHub repo?

li.poltorak
2019-08-13 22:56
Hmmm, ok. I'm using the docker pact verifier to run the verification: https://github.com/DiUS/pact-provider-verifier-docker

li.poltorak
2019-08-13 22:56
Maybe I have something configured wrong there.

li.poltorak
2019-08-13 22:59
```WARN: the following non-mandatory environment variables have not been specified: '["provider_states_url", "provider_states_active_url"]' Reading pact at /tmp/pacts/consumer-provider.json Verifying a pact between Consumer and Provider Given a request for reservation 12345 with GET /v1/reservations/12345 returns a response which has status code 200 (FAILED - 1) has a matching body (FAILED - 2) Failures: 1) Verifying a pact between Consumer and Provider Given a request for reservation 12345 with GET /reservations/12345 returns a response which has status code 200 Got 0 failures and 2 other errors: 1.1) Failure/Error: set_up_provider_state interaction.provider_state, options[:consumer] RuntimeError: Could not find provider state "" for consumer Consumer # /usr/local/bundle/gems/pact-1.14.0/bin/pact:4:in `<top (required)>' # /usr/local/bundle/bin/pact:17:in `load' # /usr/local/bundle/bin/pact:17:in `<main>' 1.2) Failure/Error: tear_down_provider_state interaction.provider_state, options[:consumer] RuntimeError: Could not find provider state "" for consumer Consumer # /usr/local/bundle/gems/pact-1.14.0/bin/pact:4:in `<top (required)>' # /usr/local/bundle/bin/pact:17:in `load' # /usr/local/bundle/bin/pact:17:in `<main>'```

li.poltorak
2019-08-13 23:00
There's the output of the tests.

matt.fellows
2019-08-13 23:00
hmm interesting

matt.fellows
2019-08-13 23:00
in that case, could you please raise a bug there :stuck_out_tongue:

li.poltorak
2019-08-13 23:00
Absolutely, will do!

matt.fellows
2019-08-13 23:00
thank you

matt.fellows
2019-08-13 23:00
presumably it works without the states defined, yes?

li.poltorak
2019-08-13 23:17
I'm not sure how to not define them. If I leave the line out of the consumer test, it fails.

li.poltorak
2019-08-13 23:19
Here's the error: ```self = <pact.pact.Pact object at 0x10bfed080>, scenario = 'a request for reservation 12345' def upon_receiving(self, scenario): """ Define the name of this contract. :param scenario: A unique name for this contract. :type scenario: basestring :rtype: Pact """ > self._interactions[0]['description'] = scenario E IndexError: list index out of range```

matt.fellows
2019-08-13 23:23
Is that the description or the state? The description is definitely mandatory

li.poltorak
2019-08-13 23:25
I'm working off of the example from the pact-python github page (with specifics changed out for our particular test case of course) ```(pact .given('UserA exists and is not an administrator') .upon_receiving('a request for UserA') .with_request('get', '/users/UserA') .will_respond_with(200, body=expected))```

li.poltorak
2019-08-13 23:25
And it seems like whatever I put in the `.given('UserA exists and is not an administrator')` is what fails when I try to run the verification.

li.poltorak
2019-08-13 23:26
But if I try to leave that line out, it will fail in the above manner.

li.poltorak
2019-08-13 23:26
I'm not sure if that's the description or the state.

matt.fellows
2019-08-13 23:26
weird

matt.fellows
2019-08-13 23:26
because https://github.com/pact-foundation/pact-python#verifying-pacts-against-a-service says to do it without provider states (to start with)!

li.poltorak
2019-08-13 23:29
It looks like it fails with a different error (authentication, which I expected) if I run the verification command as shown in that example, using pact-python, from the consumer API's repo, so I imagine it's either a bug or a misconfiguration in the docker verifier I was trying to use from the provider. Running the verification from that python project won't work in the long run, but it's perfectly fine for local testing and can unblock me to keep exploring pact, so that's good! :slightly_smiling_face:

matt.fellows
2019-08-13 23:42
ok perfect

li.poltorak
2019-08-13 23:42
Thank you so much for your help! I really appreciate it.

matt.fellows
2019-08-13 23:42
apologies, sometimes the language implementations have their minor differences

matt.fellows
2019-08-13 23:42
we?ll get it sorted - if you raise the issue typically it?s sorted within a day or two

li.poltorak
2019-08-13 23:43
Thank you!

matt.fellows
2019-08-13 23:43
FYI if you need a quick space to test pact publishing / workflows with e.g. can-i-deploy, you should checkout http://pactflow.io :wink:

matt.fellows
2019-08-13 23:43
if you need more than a few contracts let me know and I can bump up the plan (we?re reviewing the free tier at the moment)

li.poltorak
2019-08-13 23:43
I'll look into it!

bethskurrie
2019-08-14 04:07
Ah, if you're messing with the docker one, you just need to set the right env vars @nathan2oo3

bart.schotten
2019-08-14 06:40
I prefer keeping my (functional) unit tests entirely separate from my contract tests, so I never felt the need to have a single interaction handle multiple test cases.

antonello
2019-08-14 07:47
Is there a piece of documentation that explains which versions of the DSLs are compatible with v3 of the pact specification?

uglyog
2019-08-14 07:49
This is the only docs I know of: https://docs.pact.io/feature_support

antonello
2019-08-14 07:50
Thank @uglyog. I know it existed but could not find it. Still :sleeping:

antonello
2019-08-14 07:52
Is v3 supported in pact-jvm 3.6.x or only in v4?

bethskurrie
2019-08-14 07:52
No pressure, but @tanle.oz may be having a go at v3 for Ruby ;-)

antonello
2019-08-14 07:52
I was reading your recent blog post on provider states @uglyog

uglyog
2019-08-14 08:29
V3 is supported since 3.2+

nikolajs.cmihuns
2019-08-14 09:52
Hi, is there some documentation on how to read error message when pact test fails. E.g I use https://github.com/DiUS/pact-jvm/blob/b370475f0107c16ab498d488fe09c005cff037ad/provider/pact-jvm-provider/src/main/kotlin/au/com/dius/pact/provider/junit/JUnitProviderTestSupport.kt#L24 And output looks to me unreadable. Does pact-jvm have some human readable processor of error output string ?

nikolajs.cmihuns
2019-08-14 10:00
I mean, does one have to manually cast what is in place of Any (mismatches: Map<String, Any>), and act accordingly further

nikolajs.cmihuns
2019-08-14 10:00
Is it the only option available currently ?

matt.fellows
2019-08-14 12:15
V3 in Ruby btw means we get it in JS, Go, python, PHP and . NET

hendrik.diel
2019-08-14 12:29
has joined #general

hendrik.diel
2019-08-14 12:52
Hi, i wonder if there is a planned release date for 4.0.0-beta.5? We are waiting for the fix of issue #908 and #912.

sandro.schifferle
2019-08-14 13:04
has joined #general

richard.jones
2019-08-14 22:42
Interesting! Our pact mocks are just part of our regular test suite mocking. As in, we don?t mock downstreams in any other way other than in exceptional circumstances (like ensuring a 500 response is handled well)

bethskurrie
2019-08-14 22:44
Are you talking about the consumer side or the provider side Richard? I think Bart is talking consumer side.

uglyog
2019-08-14 22:52
I see about getting a release out for you

marius.maaland
2019-08-14 23:50
no I don't believe so

richard.jones
2019-08-15 00:04
I?m talking consumer side, yes.

nikolajs.cmihuns
2019-08-15 06:15
@uglyog

uglyog
2019-08-15 06:18
Are you referring to the actual values which are displayed as `List(Map(code -> 101, order -> 1, timestamp -> 1970-01-01T00:00:11.113Z)`?

nikolajs.cmihuns
2019-08-15 06:22
yes, it is taken from real test if I've got you correct

nikolajs.cmihuns
2019-08-15 06:25
looks like we need additional case for List inside JUnitProviderTestSupport.generateErrorStringFromMismatches

nikolajs.cmihuns
2019-08-15 06:26
I will recheck

uglyog
2019-08-15 06:27
I think the JUnit error output needs to be better presented in general


bart.schotten
2019-08-15 06:55
I try to keep my api client code (the code that I test with Pact) very minimal. The only thing it should do is perform a request to the right path and correctly deserialize the response. All the functional handling around that is done by other code, in which I can then mock the api client, so I don't need Pact (or another http mock service) to test it.

mdilts11
2019-08-15 14:18
has joined #general

itsmanishahere
2019-08-15 14:33
has joined #general

pijush.debnath
2019-08-15 17:54
has joined #general

marius.maaland
2019-08-15 19:07
is pact-go trying to use SSLv2/v3 ? cause that's disabled in my certificate

vinay.luz
2019-08-15 20:24
has joined #general

richard.jones
2019-08-15 22:19
Cool, thanks for the info, and your usage is something I have definitely seen around. FWIW my intent is to ensure that the data going to/from the API call reflects the code using that API, rather than whether I can call the HTTP library correctly.

david862
2019-08-15 22:48
has joined #general

chuck
2019-08-16 18:03
has joined #general

sgriffiths1975
2019-08-19 03:21
has joined #general

archana.rachuri
2019-08-19 23:24
has joined #general

getsreerag22
2019-08-20 05:33
@here Is there anyway I can convert Swagger into Pact????

uglyog
2019-08-20 05:36
Not currently. The problem is that swagger is defined in terms of the API endpoint. I.e. here is an endpoint, it accepts these parameters and here is the list of possible responses. But there is no automatic way to know which request corresponds to which response.


getsreerag22
2019-08-20 05:48
Thank you @bethskurrie

matt.fellows
2019-08-20 05:53
As an aside though, we are working on and thinking about how to marry Pact and Swagger better together at Pactflow. Ping one of us offline if you?d like to be part of this discovery and product development process

vaishnavi.boyidi
2019-08-20 07:38
has joined #general

fil.tmb
2019-08-20 10:58
has joined #general

philusd
2019-08-20 11:46
has joined #general

simon.waterhouse
2019-08-20 14:12
has joined #general

vinoth.raman
2019-08-20 15:26
has joined #general

vinoth.raman
2019-08-20 15:32
Vinoth Raman [4:29 PM] I am trying to setup a pact test for one of the project. unfortunately, I could not PACT dal file created after the successful build.Here is my code

vinoth.raman
2019-08-20 15:32
package com.test; import au.com.dius.pact.consumer.Pact; import au.com.dius.pact.consumer.PactProviderRuleMk2; import au.com.dius.pact.consumer.PactVerification; import au.com.dius.pact.consumer.dsl.PactDslWithProvider; import au.com.dius.pact.model.RequestResponsePact; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import java.util.HashMap; import java.util.Map; public class consumertest { @Rule public PactProviderRuleMk2 mockProvider = new PactProviderRuleMk2("test_provider", "localhost", 8080, this); @Pact(consumer = "test_consumer") public RequestResponsePact createPact(PactDslWithProvider builder) { Map<String, String> headers = new HashMap<String, String>(); headers.put("Content-Type", "application/json"); return builder.given("test GET").uponReceiving("GET REQUEST").path("/pact").method("GET").willRespondWith().status(200).headers(headers) .body("{\"condition\": true, \"name\": \"tom\"}").given("test POST").uponReceiving("POST REQUEST").method("POST") .headers(headers).body("{\"name\": \"Michael\"}").path("/pact").willRespondWith().status(201).toPact(); } @Test @PactVerification() public void givenGet_whenSendRequest_shouldReturn200WithProperHeaderAndBody() { } }

vinoth.raman
2019-08-20 15:33
Vinoth Raman [4:30 PM] <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd%22> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>test</artifactId> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-consumer-junit_2.11</artifactId> <version>3.4.1</version> </dependency> <dependency> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-consumer_2.11</artifactId> <version>3.4.1</version> </dependency> <dependency> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-model</artifactId> <version>3.5.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18</version> </plugin> </plugins> </build> </project>

vinoth.raman
2019-08-20 15:33
Could some possibly point me where the issue is please?

mail.colin.smith
2019-08-20 19:20
has joined #general

lgaete.astudillo
2019-08-20 19:30
has joined #general

afrancoh
2019-08-20 19:34
has joined #general

kyle.hammond
2019-08-20 20:43
You have no code in the givenGet_whenSendRequest_shouldReturn200WithProperHeaderAndBody method. In that method you should have your client code connect to the mock server, make the network request, and assert that your code behaves correctly with the expected response.

matt.fellows
2019-08-20 22:04
Could you please ask this on #pact-jvm ?

matzalew
2019-08-21 05:46
has joined #general

ben.minter
2019-08-21 08:26
has joined #general

samuel.hodgkinson
2019-08-21 11:12
has joined #general

matchehot
2019-08-21 17:42
has joined #general

matchehot
2019-08-21 17:49
Hi, has anyone used jvm XmlBodyMatcher to match response body?

matchehot
2019-08-21 17:49
looking for examples

danavery
2019-08-21 22:23
has joined #general

g.maguire85
2019-08-21 23:34
has joined #general

kresimir.kuren
2019-08-22 13:03
has joined #general

david862
2019-08-22 18:06
Hey, I?m curious about pact best practices (and I need to convince my team to use them). Does anyone have any good resources?

marius.maaland
2019-08-22 18:28
There's a section about this in the documentation: https://docs.pact.io/best_practices Is there anything in particular you're curious about?

david862
2019-08-22 18:31
Yeah - I had looked at that pretty thoroughly, but thanks. I?m specifically curious about how much of the consumer to include in the contract test. My team?s assumption is that we should only be including the API call to the provider, and ensuring the right data is returned, but I was under the impression you want to make sure the consumer actually does what you are expecting with the data (more than just deserialization, I mean.)

david862
2019-08-22 18:33
For example we have a service that tells us if a customer is blacklisted, should the pact test include just `service.get('/is-blacklisted?q=john+smith')` or something a bit higher up like a consumer method that calls that endpoint and returns a boolean?

thirumal.net
2019-08-22 21:11
Hi @david862 - i think your team assumption is correct . as a consumer ,we have to make sure provider is returring 200 Ok status and data we need to continue consumer logic. we can still go ahead and verify the data but i think that is not the purpose of contract testing . verifying data should be part of another testing not contract testing . if we have microservice architecture and lot of services are there , it is not ideal to check data instead we have to verify minimum things (200, mandatory attributes from provider) which will make the total CI/CD process quick

nathan2oo3
2019-08-23 09:16
Sorry for the late reply Beth. I noticed in the docs about setting http_proxy environment for executing via an http proxy but other than that is there any other environment variables I need to set? I have already set the PACT_BROKER_LOG_LEVEL: DEBUG in the docker compose file


bethskurrie
2019-08-23 20:45
"PACT_BROKER_WEBHOOK_SCHEME_WHITELIST - a space delimited list (eg. http https). Defaults to https."

bethskurrie
2019-08-24 07:12
I like to include enough of the consumer to ensure that I'm not just testing an HTTP request. I generally have a "XYZClient" class that is responsible for translating between my internal domain and the way the provider represents the data. I like to check that my client does the right translations, serialises the data the right way (though I do tend to keep that serialisation logic in a separate class) and handles the different responses the way I want (eg. 404 might return a null object, a 500 might raise an exception)

bethskurrie
2019-08-24 07:13
I don't tend to include the service layer.

bart.schotten
2019-08-24 10:38
Can a v3 Pact include both messages and (request-response) interactions? This is not entirely clear to me from the spec.

uglyog
2019-08-24 23:34
No, they have to be separate. That?s something we?re planning for the v4 format

bart.schotten
2019-08-25 07:16
v3 isn't final yet is it? :wink: At least, the readme makes it seem like it's still in a "proposal" state, and not everything is covered by testcases.

uglyog
2019-08-25 07:25
V3 was released with Pact-VM over two years ago. It would not be fair to users to change it now

bart.schotten
2019-08-25 09:48
One other small question about the "include" matcher: does the check that the actual value is included in the expected value, or the other way around? And is it only supposed to work with strings?

uglyog
2019-08-25 22:45
Yes, it works on strings and checks that the actual value includes the value associated with the matcher.

jenpresly18.jps
2019-08-26 04:55
has joined #general

bart.schotten
2019-08-26 05:29
Thanks!

r.deboer
2019-08-26 14:37
has joined #general

gcao
2019-08-26 19:31
has joined #general

rikkiprince
2019-08-26 22:50
has joined #general

serge.a.silva
2019-08-27 07:09
has joined #general

serge.a.silva
2019-08-27 07:23
Hey everyone! Following up from this issue https://github.com/pact-foundation/pact-net/issues/197#issuecomment-525138624 as suggested by Beth. Pact-net has been flagged for having a CVE that comes from the version of Ruby that was bundled with it. In the above thread, I mention two CVEs. The first one is a false negative, but the second is correct and it is flagged with maximum severity. We're trying to ramp up my team to use it, but having been flagged means we'll have to look at something else. Beth mentioned there's plans to port pact-net to switch over to the Rust implementation (instead of bundling Ruby in the DLL). I'd like to continue using Pact. What would be the best way to move forward and get green on pact-net? If rewriting part of it to rely on the Rust version, have there been other examples of pact implementations that are based off of the Rust one? Is there a quicker solution? Thanks!

matt.fellows
2019-08-27 07:55
hiya!

matt.fellows
2019-08-27 08:12
OK so we?d love some help on this

matt.fellows
2019-08-27 08:13
Here is an example PoC that Ron put together that implements an MVP pact JS interface build on the rust bindings: https://github.com/uglyog/pact-js-v3-poc

matt.fellows
2019-08-27 08:13
We literally discussed this today

matt.fellows
2019-08-27 08:16
I?ll ping you again a little later to discuss more, just getting to the end of my train journey :slightly_smiling_face:

matt.fellows
2019-08-27 08:16
but sufficed to say - this is moving toward the top of my list for JS/Golang

serge.a.silva
2019-08-27 08:17
Nice, I'll take a look!

serge.a.silva
2019-08-27 08:17
Sure ping me when available, I'd also like to have a rough estimate of how long this will take me!

serge.a.silva
2019-08-27 08:31
Could code under native be reused?

serge.a.silva
2019-08-27 08:44
(I'm not a rust expert :smile:)

matt.fellows
2019-08-27 13:34
Anyone here based in Perth? Beth will be visiting next week... https://www.linkedin.com/posts/bethanyskurrie_activity-6571535304581312512-ElaI

matt.fellows
2019-08-27 13:35
Cc: @neil :point_up:

alvina.putri
2019-08-27 20:30
has joined #general

nathan2oo3
2019-08-27 21:21
Thanks @bethskurrie that helped a lot. One thing though I have tried running your Ruby script for inserting self signed certs but keep getting errors even after installing the dependent gems. Is it possible to manually import the certs into the database?

matt.fellows
2019-08-27 23:15
So the short answer is no, the code there wouldn?t be reusable, because it uses Neon which is a Rust to JS interface. This has benefits (no need for the ugly FFI bindings) but means that we?ll need a small wrapper for each language to achieve it. The alternative is a shared dynamic library, which means we can write it once, but will have some of the downsides of ?crossing the boundary?. It might be a situation that we start with that, and evolve to another interface

matt.fellows
2019-08-27 23:16
@uglyog might have other thoughts, however

serge.a.silva
2019-08-28 00:07
Since I'd like to keep using Pact, I'd prefer the quicker way (of course, in a way that can be improved overtime) :smiley:

uglyog
2019-08-28 00:12
A wrapper in each language over a shared library means that you can create DSLs and tooling that take advantage of the idioms specific to that language. A shared library designed to be used by everyone means the interface becomes the "lowest common denominator", in essence a C interface.

serge.a.silva
2019-08-28 00:18
So a shared library still seems useful?

uglyog
2019-08-28 00:19
There is an existing shared library. The interface still needs some work.

uglyog
2019-08-28 00:21
There is an example of using it with Javascript, Ruby and C here :point_right: https://github.com/pact-foundation/pact-reference

serge.a.silva
2019-08-28 00:21
Oh, which one is it? I'd like to at least plan out the work we'll need to do for a replaced C# version

serge.a.silva
2019-08-28 00:21
Nice :+1:

serge.a.silva
2019-08-28 00:27
Would the current C# dsl/library be a good end result to aim for (ie only change the implementation)? Or is it in your plans to change them too?

uglyog
2019-08-28 00:30
I would try to reuse what is there. That's what I did with the Javascript POC, I took an existing JS test and got it working using the shared library

serge.a.silva
2019-08-28 00:31
Great, I'll do that then.

uglyog
2019-08-28 00:32
If you need any help, let me know. I was planning at looking into the .NET implementation after I'm done with the JS one

serge.a.silva
2019-08-28 00:32
Thanks folks! I'll be sure to come back here with some news :smile: How stable is the Rust implementation btw?

uglyog
2019-08-28 00:32
It's been used by a few people

deshdeepdivakar
2019-08-28 08:27
hi @here can we generate `RequestResponsePact` automatically. So, that I don't have to write the json body myself. I read somewhere using jackson object mapper but not entirely sure. Please share your thoughts. ```package example.consumer import au.com.dius.pact.consumer.dsl.PactDslJsonBody object PactUtil { fun jsonRpcMethodRequest(methodName: String): PactDslJsonBody = PactDslJsonBody() .stringType("id") .stringType("jsonrpc", "2.0") .stringType("method", methodName) fun jsonRpcMethodResponse(): PactDslJsonBody = PactDslJsonBody() .stringType("id") .stringType("jsonrpc", "2.0") }```

evman182
2019-08-28 22:43
has joined #general

matt.fellows
2019-08-28 22:47
I'm not sure if a tool exists, but I suppose it's possible to write one?

matt.fellows
2019-08-28 22:47
As long as you still write the test case around it, it's a viable approach.

matt.fellows
2019-08-28 22:48
In go, we use tags (like an annotation) that dry the tests up in the way you describe

jing.song
2019-08-29 04:04
has joined #general

sarajcarbajal
2019-08-29 09:16
has joined #general

joao
2019-08-29 13:31
has joined #general

christopher.f.almanza
2019-08-29 15:17
People who are experienced with Pact, what do you find useful to put in the `upon receiving` property of a Pact Interaction object:

christopher.f.almanza
2019-08-29 15:18
1. a sentence that describe an operation: `uponReceiving: 'a latest news request'`

christopher.f.almanza
2019-08-29 15:18
2. the actual endpoint: `uponReceiving: 'GET /news'`

christopher.f.almanza
2019-08-29 15:19
please vote with a :thumbsup: emoji, and thank you very much :slightly_smiling_face:

enrique
2019-08-29 15:21
I?d reword a bit, something like `'a request to get the latest news'` or `'a query to get the latest news about the market'` or something similar

christopher.f.almanza
2019-08-29 16:07
Quick question, does matcher `like() / somethingLike()` will match by type also properties that are array of objects? ie: ``` student: somethingLike({ firstName: 'john', courses: [{ name: 'Math', }], }) ``` will the courses `name` be also matched by type?

david862
2019-08-29 17:54
Thanks for the feedback, how would you ensure that a mock return value for the XYZClient class, used in the test for some part of the service layer, stays in sync with the response in the contract test?

davidjgmendes
2019-08-29 18:11
Greetings, I am finding a weird (at least for me) behavior when validating contracts on the provider side using junit. The verifications results are only published whenever they are successful. For example: I forgot to implement a state change on the provider side that was defined on the consumer side. The test failed because i didn't implement it but because the result of that specific pact fragment was not published the matrix said i could deploy. I don't understand this behavior can someone clarify. Thanks in advance

davidjgmendes
2019-08-29 19:02
Is this behavior intended ?

akhteraa
2019-08-29 19:24
has joined #general

uglyog
2019-08-29 22:53
Yes, the matchers cascade

uglyog
2019-08-29 22:54
No, that seems like a defect

kian.leong
2019-08-30 08:08
has joined #general

davidjgmendes
2019-08-30 08:39
I thought so, I can PM u some more detailed information if that would help

uglyog
2019-08-30 09:37
Raise an issue for that, please.

simon.nizov
2019-08-30 09:53
Hi all, I was getting the following error when trying to publish verification results back to the broker: ``` Error returned from verification results publication 400 {"errors"=>{"provider_version"=>["can't be blank", "Version number '' cannot be parsed to a version number. The expected format (unless this configuration has been overridden) is a semantic version. eg. 1.3.0 or 2.0.4.rc1"]}} (Pact::Provider::VerificationResults::PublicationError) ``` Downgrading the `pact` gem version from `1.41.0` to `1.26.0` solved the issue. I?m running the official Dockerized broker version `dius/pact-broker:2.27.6-2`. What is this about? Were there braking changes since that release?

bethskurrie
2019-08-30 09:54
We're up to 2.36

bethskurrie
2019-08-30 09:54
That's a very old version.

bethskurrie
2019-08-30 09:55
The latest Pact Broker versions just order the provider version by date. You don't need a semantic version number

bethskurrie
2019-08-30 09:57
It does also look like your provider version is empty.

simon.nizov
2019-08-30 09:59
I think it's passed to the broker under a different name

simon.nizov
2019-08-30 09:59
Same exact configurations in pact_helper.rb but with the downgraded version works like a charm

bethskurrie
2019-08-30 09:59
It should be "providerApplicationNumber". Pretty sure the publishing code is fine. Just upgrade your broker.

bethskurrie
2019-08-30 10:00
Hm. I'd recommend upgrading to the latest.

simon.nizov
2019-08-30 10:00
Will do. Thanks!

bethskurrie
2019-08-30 10:00
There are performance and other issues with the older versions, including a vulnerability with the webhooks.


davidjgmendes
2019-08-30 10:04
if u need more info say something

apurvjpatel
2019-08-30 13:05
has joined #general

nyarasha
2019-08-30 18:37
has joined #general

priyank.shah217
2019-08-31 11:56
I am new to PACT, Have a question: In my consumer side, i am able to generate pact file with json array (2 entries) with some fields. The json contract uploaded to pact-broker successfully. But while running this file against producer, which basically ingest some random data on those json fields (entries may vary, and data could be any random). due to this eventually my contract test failed. returns a response which has status code 200 (OK) has a matching body (FAILED) So now question is i am more interested into json schema, not in content matching. Is there any way to just focus on those part using pact.

priyank.shah217
2019-08-31 12:03
Do i need to set state from provider side in order to get matched response ? (using directly ingesting data into repository)?

simon.nizov
2019-08-31 12:14
I suggest you have a look here: https://docs.pact.io/getting_started/matching#response-matching On one hand, ?it doesn?t matter what value the provider actually returns during verification, as long as the types match?. On the other, it?s not recommended to use random data for pacts because it will fool the broker into thinking that the pact has changed which will cause some unwanted behavior.

priyank.shah217
2019-08-31 13:30
Thanks @simon.nizov

priyank.shah217
2019-09-01 04:54
I really done my weekend exercise successfully by implementing pact for one of pet project. https://github.com/priyankshah217/ContractTestingExample.git Nice documentation @bethskurrie @uglyog and whole pact team...

simon.nizov
2019-09-01 14:18
@bethskurrie I upgraded our broker to the latest version and still getting the same error :cold_sweat:

simon.nizov
2019-09-01 14:18
Is there an easy way to log the full HTTP request sent to the broker?

serge.a.silva
2019-09-01 21:11
a bit challenging to build pactnet on a mac :slightly_smiling_face:

simon.nizov
2019-09-01 21:29
More on my issue above.. I managed to track down the specific change that is causing my issue. In the release of `v1.27.0` of the Pact gem there is a change in the way the gem calls the broker. `#to_json` is not called on `verification_result` anymore. See here: https://github.com/pact-foundation/pact-ruby/compare/v1.26.0..v1.27.0#diff-2aa19ad532bad3f2050ce3b3aff47b0dL94 The `to_json` method is critical because it translates `provider_application_version` to `providerApplicationVersion`. Not calling it causes the payload sent to the broker to change from what it?s like in `v1.26.0`: `{success:false, providerApplicationVersion": "1.0.0.fake"}` to what it?s like in `v1.27.0`: `{publishable: true, success: false, provider_application_version: "1.0.0.fake", test_results_hash: {?}}` The broker then throws a validation error due to not finding the `providerApplicationVersion` key. As can be seen in the following spec: https://github.com/pact-foundation/pact_broker/blob/master/spec/lib/pact_broker/api/contracts/verification_contract_spec.rb#L74 But if what I?m saying is correct, how is publishing provider verification results working for anyone that is using the latest versions of pact? Am I going crazy here? Any help is welcome!

matt.fellows
2019-09-01 21:43
Thank you! :pray:

milleniumbug
2019-09-02 09:09
has joined #general

milleniumbug
2019-09-02 14:08
I am interested in the efforts of writing a C# wrapper over a Rust library myself. @serge.a.silva is your repository public anywhere?

serge.a.silva
2019-09-02 14:21
I was working on top of pactnet (which is public) but didn't get very far.

milleniumbug
2019-09-02 14:25
Fair enough. I'm gonna do the same approach for now.

serge.a.silva
2019-09-02 14:26
Do create a branch when you get somewhere!

milleniumbug
2019-09-02 14:27
sure

florian.nagel
2019-09-03 07:46
I'm unfortunately based in Germany, but I'd still like to see the talk. Will it be recorded and published online afterwards by any chance?

matt.fellows
2019-09-03 08:02
Beth has given this talk before, I?ll dig up the link?

florian.nagel
2019-09-03 08:02
Ah! Thanks a bunch


matt.fellows
2019-09-03 08:06
It?s not quite the same talk, but the gist is: https://www.youtube.com/watch?v=79GKBYSqMIo&feature=youtu.be

florian.nagel
2019-09-03 08:06
Thanks Matt! Will check it out :smile:

emils.solmanis
2019-09-03 12:56
has joined #general

patryk.skrzymowski
2019-09-03 13:01
has joined #general

thomas.rappos
2019-09-03 23:19
has joined #general

abhishek04002
2019-09-04 01:35
has joined #general

matt400
2019-09-04 03:39
has joined #general

lotsabackscatter
2019-09-04 03:39
has joined #general

simon.nizov
2019-09-04 07:47
@bethskurrie @matt.fellows - I would love your input on this

bethskurrie
2019-09-04 07:51
Hey. Let me have a look.

bethskurrie
2019-09-04 07:58
Yes, you can turn --verbose on @simon.nizov

bethskurrie
2019-09-04 07:59
Ok, so the results I just published look like this: ``` { "providerName": "Pact Broker", "providerApplicationVersion": "0ec26e835373b56410e2b69371e99fa254943e76", "success": false, "verificationDate": "2019-09-04T10:36:21.885+10:00", ```

bethskurrie
2019-09-04 07:59
I'm on version 1.41.0 of pact

bethskurrie
2019-09-04 08:00
If you're on 1.27, then I think there was a bug in that version that has been fixed since.

bethskurrie
2019-09-04 08:02
Which language are you running your verifications in?

simon.nizov
2019-09-04 08:08
Ruby, Pact v1.41.0

simon.nizov
2019-09-04 08:10
Which component is responsible for building that payload?

bethskurrie
2019-09-04 08:10
``` class VerificationResult def initialize publishable, success, provider_application_version, test_results_hash @publishable = publishable @success = success @provider_application_version = provider_application_version @test_results_hash = test_results_hash end def publishable? @publishable end def provider_application_version_set? !!provider_application_version end def to_json(options = {}) { success: success, providerApplicationVersion: provider_application_version, testResults: test_results_hash }.to_json(options) end def to_s "[success: #{success}, providerApplicationVersion: #{provider_application_version}]" end private attr_reader :success, :provider_application_version, :test_results_hash end ```

simon.nizov
2019-09-04 08:11
So where are `providerName` and `verificationDate` coming from in your payload? :S

bethskurrie
2019-09-04 08:12
good question

bethskurrie
2019-09-04 08:13
oh, that's the response

bethskurrie
2019-09-04 08:13
they get added

bethskurrie
2019-09-04 08:13
let me find the request

bethskurrie
2019-09-04 08:14
``` opening connection to localhost:9292... opened <- "POST /pacts/provider/Pact%20Broker/consumer/Pact%20Broker%20Client/pact-version/dd27a7b453e63d32428f48f772eb93cd7e525e7f/verification-results HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: application/hal+json, */*\r\nUser-Agent: Ruby\r\nContent-Type: application/json\r\nAuthorization: [redacted]\r\n" <- "{\"success\":false,\"providerApplicationVersion\":\"0ec26e835373b56410e2b69371e99fa254943e76\",\"testResults\":{\"tests\":[{\"testDescription\":\"has status code 200\",\"testFullDescription\" ```

bethskurrie
2019-09-04 08:14
I just hacked `@verbose = true` in `lib/pact/hal/http_client.rb`

bethskurrie
2019-09-04 08:15
what version of ruby are you using?

simon.nizov
2019-09-04 08:15
2.6.3

bethskurrie
2019-09-04 08:16
hm. I don't have 2.6 on this machine, and I can't install it over hotel wifi to try it unfortunately.

simon.nizov
2019-09-04 08:17
That?s so weird that I?m getting this payload: `{publishable: true, success: false, provider_application_version: "1.0.0.fake", test_results_hash: {?}}` then

simon.nizov
2019-09-04 08:17
who is calling `to_json` on `verification_result`?

bethskurrie
2019-09-04 08:18
I'm not sure myself. I'm just investigating.

simon.nizov
2019-09-04 08:19
:thinking_face:

simon.nizov
2019-09-04 08:19
Which ruby are you using? I?ll install it and try

bethskurrie
2019-09-04 08:19
2.4.5

bethskurrie
2019-09-04 08:20
I've got 2.5.1 though

bethskurrie
2019-09-04 08:26
``` def post(payload = nil, headers = {}) wrap_response(href, @http_client.post(href, payload ? JSON.dump(payload) : nil, headers)) end ```

bethskurrie
2019-09-04 08:26
`lib/pact/hal/link.rb`

bethskurrie
2019-09-04 08:27
I wonder if the behaviour of JSON.dump has changed

bethskurrie
2019-09-04 08:28
I'm surprised I used json dump instead of to_json. Normally, I'd to_json things. I wonder what I was thinking.

bethskurrie
2019-09-04 08:30
In irb with ruby 2.6, run this code and tell me what you get @simon.nizov

bethskurrie
2019-09-04 08:30
``` require 'json' class VerificationResult def initialize publishable, success, provider_application_version, test_results_hash @publishable = publishable @success = success @provider_application_version = provider_application_version @test_results_hash = test_results_hash end def to_json(options = {}) { success: success, providerApplicationVersion: provider_application_version, testResults: test_results_hash }.to_json(options) end private attr_reader :success, :provider_application_version, :test_results_hash end JSON.dump(VerificationResult.new(true, true, "1", {})) ```

simon.nizov
2019-09-04 08:31
one sec, nokogiri is taking forever to install :smile:

simon.nizov
2019-09-04 08:31
(bundling for 2.4.4 that I already have)

bethskurrie
2019-09-04 08:32
ah nokogiri

simon.nizov
2019-09-04 08:34
``` [5] pry(main)> JSON.dump(VerificationResult.new(true, true, "1", {})) => "{\"success\":true,\"providerApplicationVersion\":\"1\",\"testResults\":{}}" ```

bethskurrie
2019-09-04 08:35
that looks fine! I dont' know what's going on.

bethskurrie
2019-09-04 08:36
that's the exact code that should be running.

simon.nizov
2019-09-04 08:36
yeah so weird

bethskurrie
2019-09-04 08:36
In `lib/pact/hal/http_client.rb` set `@verbose = true` and then run the publication.

bethskurrie
2019-09-04 08:37
I need to expose that flag in the api.

simon.nizov
2019-09-04 08:44
``` <- "POST /pacts/provider/Ecommerce%20Server/consumer/Rocky/pact-version/9915c87556e8a24e716f0e38140f9b983219ce01/verification-results HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: application/hal+json, */*\r\nUser-Agent: Ruby\r\nContent-Type: application/json\r\nHost: localhost:9292\r\nContent-Length: 2576\r\n\r\n" <- "{\"publishable\":true,\"success\":false,\"provider_application_version\":\"1.0.0\",\"test_results_hash\":{\"tests\":[{\"testDescription\":\"has status code 201\",\"testFullDescription\":\"Verifying a pact between Rocky and Ecommerce Server A request to start a punchout new session with POST /api/punch_out/sessions.json returns a response which has status code 201\",\"status\":\"failed\",\"interactionProviderState\":null,\"interactionDescription\":\"A request to start a punchout new session\",\"exception\":{\"class\":\"RSpec::Expectations::ExpectationNotMetError\",\"message\":\"\\nexpected: 201\\n got: 400\\n\\n(compared using eql?)\\n\"},\"actualStatus\":400},{\"testDescription\":\"has a matching body\",\"testFullDescription\":\"Verifying a pact between Rocky and Ecommerce Server A request to start a punchout new session with POST /api/punch_out/sessions.json returns a response which has a matching body\",\"status\":\"failed\",\"interactionProviderState\":null,\"interactionDescription\":\"A request to start a punchout new session\",\"exception\":{\"class\":\"RSpec::Expectations::ExpectationNotMetError\",\"message\":\"Actual: {\\\"message\\\":\\\"param is missing or the value is empty: buyer_cookie\\\"}\\n\\nDiff\\n--------------------------------------\\nKey: - is expected \\n + is actual \\nMatching keys and values are not shown\\n\\n-{\\n- \\\"start_page_url\\\": \\\"String\\\"\\n-}\\n+{}\\n\\n\\nDescription of differences\\n--------------------------------------\\n* Could not find key \\\"start_page_url\\\" (keys present are: message) at $\"},\"actualBody\":{\"message\":\"param is missing or the value is empty: buyer_cookie\"},\"differences\":[{\"description\":\"Could not find key \\\"start_page_url\\\" (keys present are: message) at $\"}]},{\"testDescription\":\"\\\"Content-Type\\\" which equals \\\"application/json; charset=utf-8\\\"\",\"testFullDescription\":\"Verifying a pact between Rocky and Ecommerce Server A request to start a punchout new session with POST /api/punch_out/sessions.json returns a response which includes headers \\\"Content-Type\\\" which equals \\\"application/json; charset=utf-8\\\"\",\"status\":\"passed\",\"interactionProviderState\":null,\"interactionDescription\":\"A request to start a punchout new session\",\"actualHeaders\":{\"Content-Type\":\"application/json; charset=utf-8\",\"Cache-Control\":\"no-cache\",\"X-Request-Id\":\"bb2794c8-bad5-4df2-b151-150d107fc24a\",\"X-Runtime\":\"0.341292\",\"Vary\":\"Origin,Accept-Encoding\",\"Content-Length\":\"66\"}}],\"summary\":{\"testCount\":3,\"failureCount\":2},\"metadata\":{\"warning\":\"These test results use a beta format. Do not rely on it, as it will definitely change.\",\"pactVerificationResultsSpecification\":{\"version\":\"1.0.0-beta.1\"}}}}" ```

simon.nizov
2019-09-04 08:45
:cold_sweat:

bethskurrie
2019-09-04 08:45
so confused

bethskurrie
2019-09-04 08:45
so, you used the same ruby to do that little experiment as to run that code?

bethskurrie
2019-09-04 08:46
In `lib/pact/hal/link.rb:47` add a `puts JSON.dump(payload)`

bethskurrie
2019-09-04 08:46
also do a `puts payload.to_json`

bethskurrie
2019-09-04 08:46
see if they're different

bethskurrie
2019-09-04 08:47
also, do you have active record in this project?

bethskurrie
2019-09-04 08:47
or any other JSON libraries?

simon.nizov
2019-09-04 08:49
in debug from within the project JSON.dump doesn?t call to_json

bethskurrie
2019-09-04 08:50
is there a JSON library you're using that might have monkeypatched JSON dump?

simon.nizov
2019-09-04 08:50
I have active record as a dependecy of rails but we use mongoid instead

bethskurrie
2019-09-04 08:50
If you view the source of JSON.dump what do you get?

simon.nizov
2019-09-04 08:50
Maybe `Oj`

simon.nizov
2019-09-04 08:50
let me check

bethskurrie
2019-09-04 08:50
Ah, Oj is a likely candidate.

bethskurrie
2019-09-04 08:51
I've had issues with it before

bethskurrie
2019-09-04 08:51
``` $ JSON.dump From: /Users/bethanyskurrie/.gem/ruby/2.4.5/gems/json-2.2.0/lib/json/common.rb @ line 384: Owner: #<Class:JSON> Visibility: public Number of lines: 20 def dump(obj, anIO = nil, limit = nil) if anIO and limit.nil? anIO = anIO.to_io if anIO.respond_to?(:to_io) unless anIO.respond_to?(:write) limit = anIO anIO = nil end end opts = JSON.dump_default_options opts = opts.merge(:max_nesting => limit) if limit result = generate(obj, opts) if anIO anIO.write result anIO else result end rescue JSON::NestingError raise ArgumentError, "exceed depth limit" end ```

bethskurrie
2019-09-04 08:55
Ok, I've just released 1.41.1 with to_json instead of JSON.dump. Can't think of a good reason why it's JSON.dump, and no tests broke when I changed it.

simon.nizov
2019-09-04 09:05
Yeah it looks like it?s Oj although I?m not sure what exactly is happening

simon.nizov
2019-09-04 09:05
Thanks!!

bethskurrie
2019-09-04 09:06
NP.

milleniumbug
2019-09-04 12:27
I managed to build Rust reference library and wrote some C# P/Invoke bindings here https://github.com/milleniumbug/pact-rust-net However, it seems that the exposed C API from Rust isn't enough to replicate current Ruby-based implementation features - among other things, selecting a specific IP address (e.g. localhost) instead of listening to any, adding and clearing interactions, and so on. Also no C API for pact verifier. How should I approach this? Should I create my own Rust crate that provides a C API for this first?

milleniumbug
2019-09-04 12:58
Or should I send PRs to pact-reference project with additional C API functions? @uglyog

milleniumbug
2019-09-04 13:08
I'm also exploring the idea of using pact-matching library from C#, so it would be possible to use http://ASP.NET Core's TestServer with contract tests. This is, OTOH, is optional for now, since it means partially reimplementing Pact features in C#.

nathan2oo3
2019-09-04 16:31
Hi @bethskurrie I managed to get the certs imported but still it gives us ssl errors when executing the webhooks. Is there a way to verify that the ssl certs have been imported into the database successfully?

guillermo.castro
2019-09-04 18:26
has joined #general

priyank.shah217
2019-09-05 03:32
Have a question, Shall i used pact for CDC if my producer and consumer deployed in AWS lambda?

bethskurrie
2019-09-05 03:38
How are your lambdas operating @priyank.shah217? Are they returning a synchronous response, or are they just accepting and sending messages?

priyank.shah217
2019-09-05 03:52
Its sync APIs

bethskurrie
2019-09-05 03:53
We're working on support for this, but it's not done yet unfortunately.

priyank.shah217
2019-09-05 03:53
I just referred https://github.com/pact-foundation/pact-js/tree/master/examples/serverless but its moreover about async API..can we have something for sync apis also?

bethskurrie
2019-09-05 03:54
We realise it's a great use case for pact.

priyank.shah217
2019-09-05 04:12
:+1:

dvallabhuni206
2019-09-06 01:02
has joined #general

kiranpatel11
2019-09-06 01:31
has joined #general

kiranpatel11
2019-09-06 02:54
has anyone considered pact consumer library for http://force.com apex language? not sure if it is even feasible considering ruby dependency and apex being cloud/interpreted language. (I am not http://force.com/apex guy, but experienced pact user now)

rafael.santos.193
2019-09-06 17:20
has joined #general

thirumal.net
2019-09-06 19:25
@kiranpatel11 - i don't think there is a out of box support for SFDC but i think still you can use below CLI tools to accomplish the same

thirumal.net
2019-09-06 19:25
There is no pact native support to C++/SFDC/SAP but still it is possible to write pacts for C++/SFDC/SAP projects https://github.com/pact-foundation/pact-reference How to write a consumer test, without a consumer language / DSL support https://github.com/pact-foundation/pact-mock_service/blob/master/script/example.sh how to write a provider test, without provider language / DSL support https://github.com/pact-foundation/pact-ruby-standalone/releases

uglyog
2019-09-06 23:03
If your lambda functions are deployed via API gateway, you can just treat them like a normal HTTP server

uglyog
2019-09-06 23:22
Please send any PRs. I'm also happy to help. We need to work out a good interface.

uglyog
2019-09-06 23:23
I'm going to split the Rust mock server library into a core one and an FFI one which we can expand as you need

serge.a.silva
2019-09-08 06:22
@milleniumbug how?s it going? can I help with anything?

kiranpatel11
2019-09-09 00:10
Thanks for the response, I did looked at the example.sh earlier, but it mentions that interactions to be written by respective pact DSL. Since there is not DSL for SFDC, what's the best way to write. I am considering to keep it along with SFDC codebase and integrating with CI/CD pipeline.

florian.nagel
2019-09-09 08:05
Hello beautiful Pact people, quick question. Have any of you used Pact in an async communicating environment in larger projects? If so, what difficulties did you encounter? And what do you think has to happen to have async CDC testing be as good as sync CDC testing? (@matt.fellows I'll just tag you as well so I don't clutter your mail inbox) Any and all feedback or experiences are welcome! Have a wonderful day.

sahil.goyal2
2019-09-09 12:22
has joined #general

matt.fellows
2019-09-10 02:42
Sorry all if I haven?t returned any messages for a little bit - was away for the past 4 days. Ping me if I?ve ignored you :stuck_out_tongue:

matt.fellows
2019-09-10 02:42
> And what do you think has to happen to have async CDC testing be as good as sync CDC testing? What do you mean by this, sorry?

serge.a.silva
2019-09-10 05:30
Keep in mind, using the Ruby version might get you flagged for a couple of nasty CVEs depending on your SDL/compliance practices.

gigo1980
2019-09-10 08:48
has joined #general

gigo1980
2019-09-10 08:57
Hi, i have seen that the pact broker ui reference to an external project `pactflow`. Will they contribute the ui changes also back to the project?

bethskurrie
2019-09-10 09:04
Hi Enrico. There are no plans to open source the Pactflow UI, as it is part of a commercial product offering.

gigo1980
2019-09-10 09:05
Ok, and will be a onprem solution available in the future ?

kimsia
2019-09-10 09:13
has joined #general

uglyog
2019-09-10 09:40
We are looking into how to offer an on-prem version of Pactflow. At the moment it is tied to a cloud provider?s services, so would need to be decoupled from that.

milleniumbug
2019-09-10 14:46
I'm currently evaluating Pact, and I have a question regarding its use case. My situation is that I have several microservices, each one has its own existing test suite, with the test suite launching the HTTP microservice, and sending it a request, and examining its response. In production, the service calls other services, but in tests, we're using mocks instead. I believe that using Pact mock services instead of regular mocks here will improve coverage across multiple services, since these tests will make each service "cross-check" requests/responses against each other (instead of the service assuming in its own tests what will the other service respond). I am new to contract testing, however, and I'm not sure if this is intended approach, and whether this approach is right (if it's not an anti-pattern)

milleniumbug
2019-09-10 15:02
I am currently trying out this approach on our two services, and it seems to work on consumer side, but provider side is a bit involved, since it involves a single call to `.Verify()` which issues provider state change POST requests, and the requests stored in the pact json, but our existing tests are running xUnit-style arrange-act-assert way. I understand that since the provider has to be aware of what provider states it has to set up, the contract tests could also be done that way, except that pact verifier would have to 1.) read the pact file, to collect all request/response pairs 2.) allow to "emit" a stored request based on the (description, state) pair, and then verify the response 3a.) raise an error in case not all of the requests stored in the pact file would be emitted (which would mean the consumer added a case, and team responsible for provider need to write code to handle that provider state) 3b.) issue requests for the remaining, not "emitted" previously, and see if the provider handles it 4.) send the overall results to the pact broker

milleniumbug
2019-09-10 15:16
@uglyog A separate FFI lib is a great idea. I have a question wrt stability of the lib. Is it fine if I introduce breaking changes in the pull requests?

milleniumbug
2019-09-10 15:19
Asking because I wrote this a few days ago https://github.com/milleniumbug/pact-reference/commit/b48ee725205cfcd1874c5f15a5368509cb7d09a4 while attempting to FFI the lib from C# I was boggled why I get firewall prompts from Windows, and it turned out that by default in PactNet we're listening on localhost, rather than any (so requests never leave the computer they're sent on)

milleniumbug
2019-09-10 15:23
My Rust skills are limited, but I know C# and C++, and I'm comfortable with writing bindings

milleniumbug
2019-09-10 15:36
My plan is: - "ripping away" the Ruby guts from the lib, and replacing anything that calls into the process with stub calls, so I can see where these parts are - compiling all the features that we need to have in order to achieve feature parity with the original Ruby code, in a comprehensive list - evaluate features and see what FFI interface would be most suitable for these - implement the FFI on Rust side (and possibly the features that aren't there yet in Rust code itself) - replace the stub calls with calls to FFI - make existing PactNet test suite pass with the new Rust implementation - extend the PactNet library with my use cases

milleniumbug
2019-09-10 15:46
I'm not sure *where* are the Ruby parts in particular yet, so these parts (point 1 and 2) are where I could use some help Also I don't know yet how to bundle native .dlls in a way that will work in both 32-bit and 64-bit windows - this is a new thing in comparison with the Ruby implementation, which didn't have that requirement (separate processes are launched just fine because there's no shared address space, but a 32-bit process must load a 32-bit library, and 64-bit process must load a 64-bit library)

lwillmeth
2019-09-10 21:03
has joined #general

swu
2019-09-10 21:10
has joined #general

ckotyan
2019-09-10 21:17
has joined #general

matt.fellows
2019-09-10 21:36
What would he the main barrier to not go with a SaaS product here?

matt.fellows
2019-09-10 21:37
Be*

jasonbarr.za
2019-09-11 07:20
has joined #general

german.schnyder
2019-09-11 15:38
has joined #general

athayes.ca
2019-09-11 20:19
has joined #general

anthony.hayes
2019-09-11 20:19
has joined #general

sankarkumar.ponnusamy
2019-09-11 23:39
has joined #general

dan184
2019-09-12 12:29
has joined #general

dan184
2019-09-12 12:38
Hi all, thanks in advance for helping out and providing pact as open source :slightly_smiling_face: I'm trying to get a consumer test running on my linux machine, which I'm pretty sure worked on my mac yesterday, but I keep getting ``` Pact verification failed - expected interactions did not match actual. ``` I can see that Pact is hitting the provider with the right method, path and the right body is being returned. I suspected that headers weren't matching, but I can't see where. 1) Is there any reason this shouldn't work on linux versus mac? can't think of one 2) Any way of debugging how the matching is determined? Loglevel at debug doens't provide any clues - just says missing request

weina.liu
2019-09-12 15:23
has joined #general

weina.liu
2019-09-12 15:28
hello, everyone. we are working on researching tool of gRPC contract testing. does PACT support gRPC?

jainvarz
2019-09-12 17:22
has joined #general

dperez
2019-09-12 17:23
hi @neil hope everything goes good on your end. I was wondering if you could help us merging the latest master into the branch message-pact. Thanks a lot!

neelofer.tamboli
2019-09-12 22:06
Hi Beth. We have a similar situation where two different versions of our web application can be in prod at the same time. How can we ensure any new PRs support both versions? I am still understanding the pact tags. We have a gradle task to verify the pact using `pactTag=production`. How can we verify both production tags every time? We are using a CD workflow so the production tags can change rapidly.

bethskurrie
2019-09-12 22:08
@weina.liu no it doesn't, through we're interested in how it might be added.

bethskurrie
2019-09-12 22:09
@dan184 can you provide an executable example please?

bethskurrie
2019-09-12 22:10
What's else is in the logs in the log file?

bethskurrie
2019-09-12 22:13
@milleniumbug One way to simplify this is to use a "normal" mock to mock downstream calls when you are verifying the upstream pact. Then use a shared artifact in the pact tests for the downstream pact to make sure that you're keeping the two sets of tests in sync.

bethskurrie
2019-09-12 22:14
Or, you could generate the downstream pact first, and then parse the requests/responses from that pact to set up your "normal" mocks in the upstream pact verification.

bethskurrie
2019-09-12 22:16
@neelofer.tamboli we're releasing a new verification api soon that will allow you to say "all pacts with the prod tag" instead of just "the latest Pact with the prod tag". You'll need to remove the prod tag from the versions you no longer wish to verify to make this work.

bethskurrie
2019-09-12 22:17
For now, the easiest way might be to keep track of the version numbers explicitly.

bethskurrie
2019-09-12 22:18
@nathan2oo3 yes, look in the database.

bethskurrie
2019-09-12 22:19
I think there's a way to disable ssl checks entirely.

bethskurrie
2019-09-12 22:20
It may not be exposed via an env var in the docker container though.

bethskurrie
2019-09-12 22:22
Oh yes it is

bethskurrie
2019-09-12 22:22
PACT_BROKER_DISABLE_SSL_VERIFICATION

neelofer.tamboli
2019-09-13 02:11
Thank you. Do you know when it will be out?

p0deje
2019-09-13 03:58
Hey folks, I?m in the process of building a proper ?Pact Nirvana? (https://docs.google.com/document/u/1/d/e/2PACX-1vRf1kSDccImNipOOm1G-bjcSs-ifbZjf1v54K-dIcq8BLKeFPAAm_bf_p71UKqkRMIx30QWWL-kN8TI/pub) for 2 services and things work perfectly fine until I start dealing with _production_ tag verification. After thinking about how to develop services independently, I thought that every Git feature branch of every service (regardless if it?s provider or consumer) needs to be checked against _production_ version of the other service. This seems to be easily done on the provider side, but not on the consumer. On the consumer side, I set up 2 _contract_content_changed_ webhooks: 1. The first webhook triggers the provider verification on provider?s _master_ Git branch (or feature branch). 2. The second webhook triggers the provider verification on provider?s _production_ revision (step #8 of the document). The problem is reporting the results back to the Github? I tried using _contract_published_ webhook, but it only checks the latest version of the provider, so it can?t ensure that consumer is compatible with the provider?s _production_ if the contract is not changed. And when the contract is changed, it doesn?t know about provider version tags, so it reports to Github with any tags at all. And only after verification results are published, they are shown in Github. Has anyone faced similar issue? I?m attaching few screenshots to explain it more.

p0deje
2019-09-13 04:00
This is how it looks when contract_published and the content is not changed. Only _master_ is reported.

p0deje
2019-09-13 04:00
This is how it looks when contract_published and contract content is changed.

p0deje
2019-09-13 04:01
And finally this is how it looks when verification results are published from CI. The first is for master provider. The second is for production provider.

matthias.laug
2019-09-13 05:56
has joined #general

p0deje
2019-09-13 06:42
I guess it worths checking out #protobufs

bethskurrie
2019-09-13 06:48
I'm hoping to release it Thursday week.

bethskurrie
2019-09-13 06:49
I've scheduled a day in!

bethskurrie
2019-09-13 07:16
@p0deje I don't have time to sit down and work through the details of your challenge, but try reading the updated document here: https://docs.pact.io/best_practices/pact_nirvana#d-configure-pact-to-be-verified-when-contract-changes

bethskurrie
2019-09-13 07:17
It might have something that the old doc doesn't explain.

bethskurrie
2019-09-13 07:17
You can pass the tags of the pact in the webhook template.

bethskurrie
2019-09-13 07:18
The other thing to consider is, sometimes putting the full logic of what you want to achieve into the webhook is not possible. In that case, it's best to trigger an intermediate build which can do the logic of which branch to test against which branch.

p0deje
2019-09-13 07:21
Thanks @bethskurrie, I?ll go through the doc you pointed out.

p0deje
2019-09-13 07:22
I know that I can pass the tags in the webhook template, but it seems like Broker is unaware of the tags when contract is changed. Like in https://pact-foundation.slack.com/archives/C5F4KFKR8/p1568347257107500?thread_ts=1568347127.106900&cid=C5F4KFKR8

bethskurrie
2019-09-13 07:29
There was a bug in some of the implementations where the tagging was done after the pact was published, instead of before.

bethskurrie
2019-09-13 07:29
It should have been fixed in all the impls now. Try upgrading.

p0deje
2019-09-13 07:50
I?ll try, thanks. Just to be sure, _contract_published_ webhook only checks latest revision, right? It?s impossible to use to ensure the contract is also verified against provider?s _production_ tag.

bethskurrie
2019-09-13 07:54
Contract published doesn't check anything. It gets triggered each time.

bethskurrie
2019-09-13 07:55
Contract content changed goes through each of the tags that it has, and sees if the previous version with that tag is different

bethskurrie
2019-09-13 07:56
I'm confused as to your problem. The only way to ensure a new contact is verified against the prod version of a provider is to check out that version of the provider and verify the changed pact against it.

p0deje
2019-09-13 07:57
Oh, so if provider has revision that has both _master_ and _production_ tag, contract_content_changed will check both tags?

p0deje
2019-09-13 07:59
I?ll read the guide now again, I?m confused as well :disappointed:

nathan2oo3
2019-09-13 09:37
Great. Thanks Beth I figured it out had to modify your script to pull the script from another location and cat it into the DB. We don't want to have to turn off ssl verification.

robin
2019-09-13 09:38
*edited*

bethskurrie
2019-09-13 09:48
Hi @robin it will help if you ask in the channel for your language. The techniques will vary based on which language you're using.

robin
2019-09-13 09:48
Hi beth, got it, I?ll transfer my message in the appropriate channel

bethskurrie
2019-09-13 09:50
> Oh, so if provider has revision that has both _master_ and _production_ tag, contract_content_changed will check both tags? Yes


lauri.vaeaenaenen
2019-09-13 09:53
has joined #general

p0deje
2019-09-13 11:34
> If your pact is published with tags applied to the consumer version, then you can think of all the pacts that share the same tag name as forming a time ordered ?pseudo branch?. So I?m confused. It will only check consumer version tags, not provider. So if I work in consumer?s feature branch, contract_content_changed will never be triggered for _production_ tag because consumer version doesn?t have it.

bethskurrie
2019-09-13 23:10
Why would it check the provider tags?

bethskurrie
2019-09-13 23:12
The pact doesn't have provider tags.

bethskurrie
2019-09-13 23:13
The contract_content_changed will be triggered for the production tag when you tag the consumer version you just deployed to prod.

bethskurrie
2019-09-13 23:14
It won't get triggered on pact publication, no.

tati.shep
2019-09-15 11:49
has joined #general

kiranpatel11
2019-09-16 07:32
see if this visualization helps...!! happy to be corrected. We are using this model and seems to be good enough. In adition, consumer can publish pact from specific feature branch when provider isn't ready with implemenation yet.

bethskurrie
2019-09-16 08:35
Fantastic diagram @kiranpatel11

admin
2019-09-16 13:17
has joined #general

neelofer.tamboli
2019-09-16 20:49
Cool. Thank you. Please let me know when it is available. I'll be looking at the release notes meanwhile.

simonmeulenbeek
2019-09-17 08:41
has joined #general

gs201m
2019-09-17 12:31
Error throws as HTTP BAD RESPONSE. STatus message says wrong number of arguements. Can someone help?

gs201m
2019-09-17 12:32
#general Guys recently all our pact tests are failing with weird error. We tried to find root cause by just adding response 200 assertion it?s still failing

matt.fellows
2019-09-17 22:32
what have you tried to diagnose? What language are you using? What?s changed?

catrionamcgarvey
2019-09-17 22:32
has joined #general

jfister
2019-09-17 23:00
has joined #general

tjones
2019-09-18 05:15
Could you paste the full error message, please?

tsalvin
2019-09-18 08:14
has joined #general

tsalvin
2019-09-18 08:19
Hi, has anyone used .and/.or with the Lambda DSL object? I'm not sure it's supported like in the non lambda version after checking the docs, but i'd like to check that value is either null or a stringtype https://github.com/DiUS/pact-jvm/tree/master/consumer/pact-jvm-consumer-java8


tsalvin
2019-09-18 08:37
That explains it perfectly, thanks for the response!

tom.mcardle
2019-09-18 10:33
has joined #general

p0deje
2019-09-18 11:05
@kiranpatel11 Thanks for this awesome diagram! May I just clarify one point related to ?Verify Consumer Change?? The consumer publishes the contract with ?master? tag and Pact-Broker will check if contract is changed only for ?master?, ignoring ?prod?. So, is it theoretically possible that contract is _not_ changed for provider?s ?master? but is changed for provider?s ?prod??

vhbsouza
2019-09-18 20:10
has joined #general

vhbsouza
2019-09-18 20:53
@matt.fellows I searched in this channel and couldn't find how to do it (I think is due to the slack 10k message history limit). Do you have a link or something else about it? And I'm using Java.

matt.fellows
2019-09-19 01:51
Java supports XML, but doesn?t have the same richness in the DSL as JSON (see https://github.com/DiUS/pact-jvm/issues/243)

matt.fellows
2019-09-19 01:52
I?m not aware of any public example using it

matt.fellows
2019-09-19 01:52
You need to use the `XmlBodyMatcher`


tritorto
2019-09-19 02:10
has joined #general

wongso_a
2019-09-19 07:14
has joined #general

talshoef
2019-09-19 07:22
has joined #general

dianaszaharia
2019-09-19 10:22
has joined #general

kiranpatel11
2019-09-20 01:36
@p0deje There are two things that can potentially break the working contract 1. Consumer (master) or 2. Provider (master) When consumer publishes new contract, verification should happen against _head_ and _prod_ codebases of the provider. When provider introduces a new change, it verifies the same against the _head_ and _prod_ pacts of the consumer. That way, we can keep the changes from both pacticipants in check by mean of ensuring all combinations !! That's what is famously refferred as Pact Metrics !! I hope it makes sense.

kiranpatel11
2019-09-20 01:37
I assumed the branching strategy to be trunkbaseddevelopment here. As i mentioned earlier, in addition to this you may also use feature branches for early feedback on compatibility, however, they are not expected to be verified always due to WIP implementation.

kiranpatel11
2019-09-20 01:40
@p0deje I think your assumption is incorrect, when consumer publishes new contract, you get a trigger using a webhook. As part of that trigger, you should perform verification against the _head_ and _prod_ version of provider codebase.

kiranpatel11
2019-09-20 01:45
While publishing verification results to pact-broker, we can provider provider version, However, I did not find any documentation on tagging at the same time. is it possible to tag provider upon publishing verification results to pact-broker ?

bethskurrie
2019-09-20 01:46
Yes, that's the way it's meant to happen.

bethskurrie
2019-09-20 01:46
What library are you using?

kiranpatel11
2019-09-20 01:52
pact-jvm

bethskurrie
2019-09-20 01:53
maven or gradle?

kiranpatel11
2019-09-20 01:53
maven

bethskurrie
2019-09-20 01:53
I'd have a look at the code for the maven pact publishing. It may be that the tags are just not exposed in that task yet.

bethskurrie
2019-09-20 01:54
They should be however - if they're not, raise an issue (or even better, I can help you work on a PR, as I know Ron is super busy at the moment).

bethskurrie
2019-09-20 01:54
You can also just call the tagging API directly. It's just a PUT to http://broker/pacticipants/PACTICIPANT/versions/VERSION/tags/TAG.

bethskurrie
2019-09-20 01:55
You need to do the tagging before the verification publication however, so that the right info is present in the webhooks when they get kicked off.

kiranpatel11
2019-09-20 01:57
At the moment, I am explicitly using cli to tag once the verification is performed - success or failed.

bethskurrie
2019-09-20 01:57
if you're relying on the tags in the webhooks, then they won't be present.

bethskurrie
2019-09-20 01:58
Otherwise, you'll be ok.

kiranpatel11
2019-09-20 01:58
I think i will need to rely on the webhooks to retry can-i-deploy on consumer side, its WIP.

kiranpatel11
2019-09-20 02:00
let me check the docs again, if needed I will work on PR

bethskurrie
2019-09-20 02:01
We appreciate everyone's contributions. It's a big job to keep everything going and up to date.

kiranpatel11
2019-09-20 02:06
Sure, btw I am in Melbourne only, hope to catch up with you guys someday.:slightly_smiling_face:

bethskurrie
2019-09-20 02:06
That would be awesome :slightly_smiling_face:

kiranpatel11
2019-09-20 02:26
I found this is flagged as an enhancement https://github.com/DiUS/pact-jvm/issues/823

neelofer.tamboli
2019-09-20 03:47

bethskurrie
2019-09-20 03:48
yes, it will be in there

neelofer.tamboli
2019-09-20 03:57
How do we ensure backward compatibility? What we are doing right now: 1. Create a webhook for Provider which invokes provider Jenkins build when a contract changes. This calls the Jenkins pipeline of the provider, latest master branch. 2. When a contract is changed by consumer, the provider build runs and posts result back to the consumer build. I am not sure I understand how backward compatibility works with this if the master branch of provider has more changes than the provider service deployed on production.

p0deje
2019-09-20 04:43
Right, thanks for clarifying, Kiran

kiranpatel11
2019-09-20 04:48
~<@UHPHAN078> Hope this diagram helps you understand.~



nithinmohan114
2019-09-20 07:42
has joined #general

yuma.higashiyama
2019-09-20 11:58
has joined #general

neelofer.tamboli
2019-09-20 14:14
Perfect, thank you. Exactly what I was looking for.

simonmeulenbeek
2019-09-20 14:46
hey Pact-users, I have a (hopefully) simple question... I'm using pact-jvm-consumer-java8_2.12, and i'm trying to generate pacts on my consumer side. I'm encountering an error where my requests don't get matched with the expected requests, because i'm sending objects with extra key-value pairs. I was under the assumption that creating a expectation will create a sort-of 'minimum viable request', where extra key-value pairs are accepted as long as the expected fields are present

simonmeulenbeek
2019-09-20 14:47
am i wrong in this assumption??

simonmeulenbeek
2019-09-20 14:47
relevant part of my dsl:

simonmeulenbeek
2019-09-20 14:48
` PactDslJsonBody() .stringValue("service_operation", OPERATION_CANCEL_ITEMS) .eachLike("items", 1) .uuid("id") .closeArray()

simonmeulenbeek
2019-09-20 14:48
`PactDslJsonBody() .stringValue("service_operation", OPERATION_CANCEL_ITEMS) .eachLike("items", 1) .uuid("id") .closeArray()`

simonmeulenbeek
2019-09-20 14:48
hmm code tags apparently don't work

simonmeulenbeek
2019-09-20 14:49
the 'eachLike' array holds objects that contain at least an id. When I send objects that also contain other keys it fails with error: " mismatch=Expected a Map with 1 elements but received 2 elements"

simonmeulenbeek
2019-09-20 14:51
I'm probably not using the right arraytype. But tbh it's pretty confusing, there are no docs for the DSL language, and The javadoc isn't that much clearer either

borsuk.artem034
2019-09-20 15:30
Hi, can you share exaple of json?

neelofer.tamboli
2019-09-20 16:53
... but never found a link from anywhere online.

matt.fellows
2019-09-21 02:35
Can you please move this to #pact-jvm ?

uglyog
2019-09-21 03:30
That is true when verifying the provider extra fields will be ignored. But in the consumer test, you are in control of the test so you should be sending the correct attributes to match your expected request.

hoangthaikt07
2019-09-21 08:48
has joined #general

abubics
2019-09-22 23:35
You want to use the triple ` for multi-line code :slightly_smiling_face:

kanaga.chinnappan
2019-09-23 13:19
has joined #general

bart.schotten
2019-09-23 14:12
For a large international company that has to integrate both Java and .NET services I have developed an alternative Pact implementation for .NET that is more compliant with Pact-JVM. It has (at least for our practical purposes) full support for Pact Specification V3, so that includes Message Pacts. From a user perspective it works a bit like a mix of Pact-NET and Pact-JVM (it has a similar DSL). It's not quite a 1.0 version yet, but it's currently already being used in practice, so feel free to check it out: https://github.com/bartschotten/com-pact I want to note that although this goes against the Pact policy of using a common (ruby/rust) core for each implementation, I hope the effort is still appreciated. If nothing else, developing a new implementation from the ground up raised some questions about the details of the Pact Specification that may help to sharpen its definition.

rajendra.sidhu
2019-09-23 16:29
has joined #general

tkimia
2019-09-23 18:31
has joined #general

mpglover
2019-09-24 01:52
As someone who has been toying with a native implementation for Elixir I just want to :+1: your efforts. I agree that it's a good way to ensure the specification is really solid.

uglyog
2019-09-24 02:19
It's not so much a policy as a way to quickly get a language implementation working. Could you announce it in the pact-net channel?

rootuid
2019-09-24 08:58
has joined #general

rootuid
2019-09-24 09:04
https://github.com/pact-foundation/pact-python/ it's a year since the last commit to that repo. Wondering if there is an alternative fork that is progressing ?


rootuid
2019-09-24 09:07
ahh excellent, thanks @294simon

fabio
2019-09-24 09:08
has joined #general


s.roodhorst
2019-09-24 09:46
has joined #general

matt.fellows
2019-09-24 10:28
:wave: hello new friends!

matt.fellows
2019-09-24 10:29
Awesome stuff Bart. Thanks for getting involved!

george.papas
2019-09-24 11:41
has joined #general

tkimia
2019-09-24 14:30
Hey all, I'm looking for info about the state of message based contracts in ruby. It seems like there are a few repos in the pact-foundation https://github.com/pact-foundation/pact-message-ruby that suggest that this is not usable yet.

mohsin
2019-09-24 14:55
has joined #general

mohsin
2019-09-24 15:00
hi, I'm unable to sign into my account. I just registered a few mins back and the email/temp password doesn't work

mohsin
2019-09-24 15:02
could someone please help me @here

mohsin
2019-09-24 15:52
nevermind, I figured it out.

k.sciana
2019-09-24 18:29
has joined #general

erica.kastner
2019-09-24 21:09
has joined #general

george.papas
2019-09-24 23:31
Hello pactarians. Is anyone using pact or contract testing with grpc?

bethskurrie
2019-09-24 23:31
Hi George!

bethskurrie
2019-09-24 23:31
There's a channel for it.

george.papas
2019-09-24 23:31
hey Beth!

bethskurrie
2019-09-24 23:31
No implementation yet, but some discussion.

george.papas
2019-09-24 23:32
protbuf channel ?

george.papas
2019-09-24 23:32
cheers, i?ll take a look

bethskurrie
2019-09-24 23:33
There was another Matt working on an implementation. I'm not sure if our history goes back far enough for me to remember who though!

george.papas
2019-09-24 23:34
got it, looks like I can get back to may 7th

george.papas
2019-09-24 23:34
matt constable?

bethskurrie
2019-09-24 23:34
Could be!

jack
2019-09-25 10:23
has joined #general

fabio.sortino
2019-09-25 12:06
has joined #general

fabio
2019-09-25 12:13
hello i have a question regarding pact.........i have that problem that the pacts generated cannot be replayed against the mock..the consumer is written in pact js...the pact will be generated and also published on the pact broker. when i run pactVerify the contracts will be verified against the original provider this is working..but i am not able to run the tests against the mock..what i am doing wrong???

fabio
2019-09-25 12:13
Request Failed - Connect to 127.0.0.1:8114 [/127.0.0.1] failed: Connection refused: connect

fabio
2019-09-25 12:14
i always get the error connection refused

fabio
2019-09-25 12:18
logfile output

jorge.florian
2019-09-25 13:12
has joined #general

zoeabryant
2019-09-25 15:20
has joined #general

mbieganski.infomatt
2019-09-25 16:24
has joined #general

tritorto
2019-09-26 04:35
Hi Guys, im after a bit of guidance on `best practices` for consumer versioning - I read that using the git-sha is a possibility to use for the consumer version when publishing to the pact broker - I'm wondering if it means that upon a commit to our dev or master branch for example, we would set the consumer version to the git-sha (with the corresponding branch tag) and push that up via our CI/CD- this would happen irrespective of if a pact file change has happened or not?

bethskurrie
2019-09-26 04:37
Correct.

bethskurrie
2019-09-26 04:37
The broker handles the versioning of the pact content for you.

uglyog
2019-09-26 04:38
When you say "replayed against the mock", what do you mean?

bethskurrie
2019-09-26 04:38
You just push it and tell it which consumer version it belongs to, and it will deal with the rest.

tritorto
2019-09-26 04:39
excellent - I think im finally getting my head around versioning and tagging. I suppose we would see our matrix get fairly big over time, is there something we should be doing to manage that maybe?

bethskurrie
2019-09-26 04:39
yes, there is a clean up script.

bethskurrie
2019-09-26 04:39
I've been meaning to add it to the docker container and have it run at a regular interval.


tritorto
2019-09-26 04:40
oh nice - we are using docker for local development but pactflow will be our dev environment, once I finish up my POC and demo it to my team... is this something to handle in Pactflow also?

bethskurrie
2019-09-26 04:41
If you notice your queries taking too long, let us know, and we can clean it up for you.

tritorto
2019-09-26 04:41
yea makes sense! thanks :slightly_smiling_face:

angela.gloyna
2019-09-26 05:54
has joined #general

s1apped
2019-09-26 06:00
Hi I have some problem with junit provider , pactbroker and gradle. I try to set PactBroker properties in gradle like test { systemProperty 'pactbroker.tags', 'test' systemProperty 'pactbroker.host', 'url' systemProperty 'pact.provider.version', 'version' systemProperty 'pact.verifier.publishResults', 'true' I'm getting error : Did not find any pact files for provider This works just fine @PactBroker(host = "url", scheme = "http", tags = {"ests"}). Am I missing something?

bethskurrie
2019-09-26 06:01
@s1apped best to ask in #pact-jvm

s1apped
2019-09-26 06:03
thanks!

liam.williams
2019-09-26 11:11
has joined #general

schmittol
2019-09-27 10:58
has joined #general

peter.lockwood
2019-09-27 13:14
has joined #general

rbhati
2019-09-27 13:44
has joined #general

pkuang
2019-09-30 02:43
Hi, I was wondering if there is any plans for a C++ DSL ?

matt.fellows
2019-09-30 02:48
It?s come up, but no specific plans yet

srinivasan.anusha
2019-09-30 03:09
has joined #general

ckaptan
2019-09-30 13:34
Hello everyone. I am running into the following error when publishing to pact broker `PactBroker::Client::Error - {"error":{"message":"The maximum number of integrations has been added to your account."}}`. Any idea how to resolve this? Thanks.

samuel.hodgkinson
2019-09-30 14:41
Are you using PactFlow? If so, there's a limit of 5 contracts on the free developer instances (https://pactflow.io/pricing/)

alex.thayn
2019-09-30 20:41
has joined #general

me_pact
2019-09-30 20:54
has joined #general

andreas.thurn
2019-10-01 05:30
has joined #general

andreas.thurn
2019-10-01 05:33
We are having the same issue. We are using DiUS hosted pact. We've got 14 integrations so far.

bethskurrie
2019-10-01 05:42
Hi guys. @andreas.thurn you will be one of our beta customers, from before the official "Pactflow" launch, when it was just a hosted version of the OSS codebase.

andreas.thurn
2019-10-01 05:44
That's existing. Does that mean we are falling into the 5 integrations limit or do we have unlimited contracts?

bethskurrie
2019-10-01 05:44
@ckaptan you will be on our Pactflow free developer plan, which has a limited number of integrations (as Sam pointed out, this is noted on the pricing page). This plan is meant to allow developers to do an effective proof of concept to work out if Pactflow is the right product for them, but you will need to choose one of the paid plans if you would like to use Pactflow at scale.

bethskurrie
2019-10-01 05:47
@andreas.thurn your contracts will not be limited, however, if you would like to use some of the fancy new features (webhooks editing and testing UIs, secrets management, SSO, lovely new UI that isn't built with jquery ... :laughing: ) then you'll need to move to one of the paid plans. As one of our beta users though, you would be offered a discounted rate. Feel free to send us an email about it.

bethskurrie
2019-10-01 05:48
Actually, Andreas, I'm confused as to how you're getting limited at 14 contracts. The only limit we have is 5 - all other plans are unlimited.

andreas.thurn
2019-10-01 05:49
I guess that we added 14 contracts before the limit was set in place :thinking_face:

bethskurrie
2019-10-01 05:50
Ah, that would make sense.

nayaksurajr
2019-10-01 05:50
has joined #general

bethskurrie
2019-10-01 05:50
You must have been one of our very first offical Pactflow customers, after we launched.

bethskurrie
2019-10-01 05:50
You get 9 bonus contracts then!

iago.quirino
2019-10-01 09:39
has joined #general

reachbharathan
2019-10-01 09:58
has joined #general

mtimbs91
2019-10-01 12:04
has joined #general

nouri.tawfik
2019-10-01 12:34
has joined #general

phall
2019-10-01 13:23
We (@ckaptan and I are in the same organisation) are on the DiUS-hosted non-pactflow version. Is this a new limit?

phall
2019-10-01 13:24
This has encouraged us to move to Pactflow proper, so I guess it worked :wink:

rbhati
2019-10-01 18:17
@here need a quick help, I'm trying to use pack in one of our contract test and the simple ask is to know how can I set `pact_json_filename` variable, goal is to specify the filename

rbhati
2019-10-01 18:23
@bethskurrie ^^ please help

hande.sagar
2019-10-03 04:15
has joined #general

hande.sagar
2019-10-03 04:26
Hi All , currently I am facing one problem , when trying to publish pact contract for rest provider.

hande.sagar
2019-10-03 04:26
This is the mvn Command we are using in our Jenkin pipeline: MVN cmd: mvn pact:verify -P contract-tests,no-asciidoc -Dpactbroker.host=http://kube-pact -Dpact.verifier.publishResults=true -Dpact.provider.version=fc7194df2b341fbada3c7c2fa0f1ef96abe5f59d -Dpact.tag=feature/FMPSU-236-pact-for-phase-3-4 This is the Error we are getting: 1 @PactVerification then " Verification Failed - No annotated methods were found for interaction 'A GET request to retrieve package with id `04398eb4-0f57-4056-b2ea-aa45bf5c4bfd`.'. You need to provide a method annotated with @PactVerifyProvider("A GET request to retrieve package with id `04398eb4-0f57-4056-b2ea-aa45bf5c4bfd`.") that returns the message contents. " 2. We have added @PactVerifyProvider with method verifyPackage then we got another error ?Verification Failed - Failed to invoke provider method 'verifyPackage'?. If any one has some idea about this issue please revert back to me.

bethskurrie
2019-10-03 04:27
Best to ask on the #pact-jvm channel @hande.sagar

hande.sagar
2019-10-03 04:30
Thanks

bethskurrie
2019-10-03 04:39
@rbhati best to ask on the channel for your language. We have 8+ different implementations and I don't know which one you're talking about.

phillip.goff
2019-10-03 13:16
has joined #general

rootuid
2019-10-03 13:42
Hi @channel, I'm making a requests.get to the pactman mock server but I get a 500 + "received but no interaction registered" back. It appears the mock server is up,returns a 500 and the message as per this code https://github.com/reecetech/pactman/blob/67e17532dc0dff4e41c33cb98cb747670fa6adf2/pactman/mock/mock_server.py#L104 . I don't however know why it's happening :disappointed:

rootuid
2019-10-03 13:43
any advice or code examples much appreciated :slightly_smiling_face:

rootuid
2019-10-03 14:30
more testing: ... talking to the the mock server using any string receives the same response. What defines a registered interaction ?

rootuid
2019-10-03 15:08
my code for reference `import atexit` `from pactman import Consumer, Provider` `import requests` `pact = Consumer('Consumer').has_pact_with(Provider('Provider'), use_mocking_server=True)` `pact.start_mocking()` `print('server on {}'.format(pact.uri))` `atexit.register(pact.stop_mocking)` `def testabc():` ` path = '/test/123')` ` pact.given(` ` 'blah'` ` ).upon_receiving(` ` 'a GET request'` ` ).with_request(` ` method='GET',` ` path='/test/123'` ` ).will_respond_with(200, body={'status': 'FAILED'})` ` response = requests.get(pact.uri+path, "")` ` print(response.status_code)` ` print(response.text)` ` assert (response.status_code == 200)`

rbhati
2019-10-03 17:06
@bethskurrie i'm working on python

dhiral.kaniya
2019-10-03 20:01
has joined #general

dhiral.kaniya
2019-10-03 20:53
Hello everyone, I am new in Pack.

dhiral.kaniya
2019-10-03 20:53
I want to implement pack for my dropwizard application. Can anyone suggest the resource link ?

abubics
2019-10-03 23:29
First, I'd jump in #pact-jvm :slightly_smiling_face:

abubics
2019-10-03 23:31
Then I'd start looking at readmes here: https://github.com/DiUS/pact-jvm

abubics
2019-10-03 23:32
Also, some getting started guides here: https://docs.pact.io/implementation_guides/jvm

bethskurrie
2019-10-04 00:04
@rbhati which python implementation? Pact-python or pactman?

matt.fellows
2019-10-04 02:48
Pact?

ttola
2019-10-04 09:26
has joined #general

joseph.haig
2019-10-04 13:35
has joined #general

joseph.haig
2019-10-04 13:48
I have a question that I suspect may have the answer (a) that is not what Pact is for or (b) that has already been answered ? (and possibly also (c) why would you want to do that?). Sorry if this is the the case. For an API (pact provider, I think is the correct terminology) I would like to have a wrapper library that deals with all the http calls. This wrapper library would then be used by the client application instead of making all the API calls explicitly. I know that I can create the contract between the wrapper library and the API but, in terms of checking the contract during deployment, I want to do this in the client application. Is there a correct way to set this up? Should I (and is it possible to) create a contract between the client application and the wrapper library? I have already done this (some time ago) and the solution I came up with is that the client application copies the contract from the wrapper library and submits that as its own, but this doesn?t feel right.

david862
2019-10-04 16:12
Funnily enough we?ve run into the same issue this week. Agree copying the contract is weird yeah.. :shrug:

dhiral.kaniya
2019-10-04 16:35
Thanks @abubics for update

swaroopshere
2019-10-05 17:59
has joined #general

stewart.henderson
2019-10-05 21:50
has joined #general

sabino_lrs
2019-10-06 03:15
has joined #general

dannybrown2710
2019-10-07 10:24
has joined #general

dannybrown2710
2019-10-07 10:31
Hi , Can anyone help me with setup of pact broker. I dont find sufficient content to setup locally. Also, is there any wrapper available to setup using nodejs? Thanks in advance

matt.fellows
2019-10-07 10:41
Hi Danny. There is no NodeJS wrapper (it's a Ruby app). The wiki itself is pretty clear, the only prerequisite is a working Ruby setup

matt.fellows
2019-10-07 10:42
Alternatively you could use something like Pactflow to save you managing your own

iruben91
2019-10-07 12:50
What opinions are out there about mocking internal code dependencies for Provider tests? In our APIs, we already have component tests that should test the application?s real code behaviour (such as ?return 404 if no entity found?). Our controllers receive the request and send it to a query handler, take the result, and convert it to the response model. In this scenario, could mocking out the application?s query handler and just return what?s expected be enough? Would you see any major flaws in this approach?

jack.middleton
2019-10-07 13:39
has joined #general

tony.ibbs
2019-10-07 14:13
has joined #general

yosevuk
2019-10-07 18:13
has joined #general

yosevuk
2019-10-07 18:18
Hello! I have a question about when to use `pactBrokerUrl` versus `pactUrls` when setting up provider [verification options](https://github.com/pact-foundation/pact-js#verification-options). Are you supposed to use `pactUrls` when you have a provider with more than one consumer pact broker URLs that you want to be able to verify independently?

yosevuk
2019-10-07 18:26
Oh, I should ask this in the pact-broker channel :blush:

vitaliy.grigoruk
2019-10-07 18:28
Hi Yosevu, we have the same setup (1 provider, multiple consumers). In case when provider verification CI job is triggered by a change in provider codebase, we simply verify that all consumer contracts are satisfied (we pass `pactBrokerUrl`, `consumerVersionTag`, `pactBrokerUsername`, `pactBrokerPassword`) In case when provider verification is triggered by pact broker (when contract is changed for a specific consumer), we pass `PACT_URL` of a changed contract to provider?s CI job as a build param and then start provider verification with the following opts: `{ pactUrls: [process.env.PACT_URL], pactBrokerUsername, pactBrokerPassword }`. This allows us to verify only a changed contract. Hope, this answers your question

sabitha_alamaddi
2019-10-07 19:08
has joined #general

sabitha_alamaddi
2019-10-07 19:11
Hi, Does Pact support Spock framework?

yosevuk
2019-10-07 19:43
Hey Vitalii, thanks for sharing! Yes, it looks like we have a similar setup. So, as I understand you verify all the consumer contracts with `pactBrokerUrl` when the provider changes, but only individual consumers when they change the contract with `pactUrls`?

ruben.perezg
2019-10-07 20:10
That's the same approach I've implemented :man-shrugging: I'm not an expert by any means, so take it with a grain of salt... But as far as I understand it, it should be just what these tests would need

abubics
2019-10-07 21:39
Sounds like a #pact-jvm question :) But yes, it's possible to write pact consumer tests using Spock. But how you prefer to run them may change whether you want to.

bethskurrie
2019-10-07 22:12
@yosevuk yes, exactly. You can read about this in the Effective Pact setup guide on http://docs.pact.io


vitaliy.grigoruk
2019-10-08 07:27
yes, @yosevuk

hefnat
2019-10-08 10:03
has joined #general

carolin.wiechert
2019-10-08 11:53
has joined #general

yosevuk
2019-10-08 14:31
Great, thank you both!

pkuang
2019-10-08 15:54
Hi, is there a recommended/supported workflow for a consumer who is also a library that is a dependency of another consumer? eg. Consumer A integrates with Provider X (A -> X) Consumer B pulls in the Consumer A library so by transitivity, B -> X so we need to make sure the current version of A used in B is compatible with Provider X Currently we establish this relationship by having library A publish its pacts with every release and having consumer B source these pacts, overwrite the 'consumer' field to B, and publishes it along with any pacts generated from B. This allows the provider X to verify against all use cases of its API possibly hit by B to ensure B is using a compatible version of the library A As a side note, we only require the provider verify against the latest version of library A but ensure compatibility with older versions of A only if they are actively used by other consumers via the pact merging method above. Our current solution is not scalable since we don't have an automated way for B to detect which of its library deps contains pact integrations and it is even more complex when there is a longer dep chain, eg. For provider X and provider Y, there exists library consumer A -> X and library consumer C -> Y, where consumer B deps on A and A deps on C, so the resulting integrations are C -> Y, A-> X, A -> Y (transitively), B -> X & B -> Y (transitively) Let me know if we're doing something wrong here or if there is some established workflow that supports this. Thanks!

rbhati
2019-10-08 17:17
hi @bethskurrie appreciate your response, I'm on pactman

rbhati
2019-10-08 17:18
I think in last few days i burned all my brain juices to understand how pact works, however now i'm brain dead after I been blocked by pact-verifier

rbhati
2019-10-08 17:22
my test script is ``` import unittest from pactman import Consumer, Provider import requests import atexit pact = Consumer('Joor-UI').has_pact_with(Provider('Atlas'), file_write_mode="overwrite", # pact_dir=, port=8155, use_mocking_server=True) pact.start_mocking() atexit.register(pact.stop_mocking) class AtlasRetailerName(unittest.TestCase): def test_get_retailer_name(self): expected = { "errors": [ { "extensions": { "code": "UNAUTHENTICATED" }, "message": "Context creation failed: Missing auth" } ] } pact.given( 'test_data_setup' ).upon_receiving( 'a request for UserA' ).with_request( 'POST', '/' ) .will_respond_with(400, body=expected) with pact: response = http://requests.post(pact.uri) print(response.json()) ```

rbhati
2019-10-08 17:24
this works with -> ```pact-verifier``` however I want to make a http request for test data setup that returns a json and I must retrieve values out of json to proceed

rbhati
2019-10-08 17:25
#pact-python please help ^^

ckotyan
2019-10-08 17:52
Oops

ckotyan
2019-10-08 17:55
sorry wrong window

dannybrown2710
2019-10-08 18:34
Thanks for your help. Was facing issues with sqlite

matt.fellows
2019-10-09 00:15
:+1:

matt.fellows
2019-10-09 00:15
For a real app you should use Postgres or MySQL

tmok01842
2019-10-09 00:20
Hi all - I've got an error to report. My company has a pact broker account and when people are attempting to view the matrices they're getting 'internal server error'

uglyog
2019-10-09 00:22
Please ask in the #pact-broker channel

tmok01842
2019-10-09 00:23
Ah, ok. Thanks

jovallep
2019-10-09 05:41
has joined #general

olaniyanayobamijr
2019-10-09 06:34
has joined #general

nsshinde27
2019-10-09 10:05
has joined #general

grzegorz.polek
2019-10-09 14:22
has joined #general

catrionamcgarvey
2019-10-09 14:47
Hi - are there any pitfalls if I have a service which is both a provider and a consumer using Pact? specifically if I publish/verify it in the broker with the same name as a consumer and provider respectively?

mauricio.galeas
2019-10-09 15:38
has joined #general

pravera
2019-10-09 17:27
Hi! We?ve worked with many services which are consumer and provider at the same time, and there?s no issue with that. You will have to do the proper consumer/provider configuration and that?s it! They will appear in the pact-broker as different rows for each role.

pravera
2019-10-09 17:30
As you can see, each pact will have the provider and consumer specified in the URL, so in this case, so if the service is consumer and provider, the URL?s are going to be different. `https://broker-base-url/matrix/provider/provider_name/consumer/consumer_name`

matt.fellows
2019-10-09 23:02
The broker should handle this scenario just fine. It?s very common.

bethskurrie
2019-10-10 00:37
Make sure the names match, or you won't be able to use can-i-deploy @catrionamcgarvey

giuseppemath
2019-10-10 01:24
has joined #general

matt.fellows
2019-10-10 01:44
Sorry, I started responding properly to this and then got sidetracked (:baby: ). Thanks Beth

tritorto
2019-10-10 06:17
I?ve done something similar - in that we are using a nuget package of the provide library which contains the ?models? and httpclient (generated via refit) that the client consumes - this of course is all .net packaging, but it seems to work well for us and we use that in the consumer side with type matching to generate the pacts

alexander.schwartz
2019-10-10 07:21
has joined #general

catrionamcgarvey
2019-10-10 09:28
thank you! :slightly_smiling_face:

elain.kelly
2019-10-10 14:50
has joined #general

elaine.kelly
2019-10-10 14:51
has joined #general

harshavardhan.kavuri
2019-10-10 15:25
has joined #general

harshavardhan.chowdar
2019-10-10 15:27
has joined #general

ryan.dens
2019-10-10 16:06
has joined #general

bethskurrie
2019-10-10 20:31
@rbhati you'll need to talk to the pactman author. That's not the same as pact-python

stanko.s.petkovic
2019-10-10 21:32
has joined #general

sai.bolam
2019-10-11 09:43
has joined #general

florian.nagel
2019-10-11 10:27
Hey all! Apart from the multiple language support offered by Pact, what other benefits are there to use Pact in favor of for example Spring Cloud Contract?

p0deje
2019-10-11 10:29
~AFAIK The latter doesn?t support messages (e.g. pub/sub, websocket)~

p0deje
2019-10-11 10:30
AFAIK The latter doesn?t support messages (e.g. pub/sub, websocket)

florian.nagel
2019-10-11 10:50
@p0deje That's what I believed as well. Do you know if they have introduced that recently? As I can recall I didn't see it the first time I was making inquiries about CDC testing.

gabriel.pichot
2019-10-11 10:57
has joined #general


florian.nagel
2019-10-11 11:39
Sorry, I misphrased that. Do you know *when* they introduced that feature? Sorry about the confusion

vsoto26
2019-10-11 13:41
has joined #general

vsoto26
2019-10-11 13:44
Hello! Has anyone used Pact with the Quarkus framework? Is it supported?

p0deje
2019-10-11 14:41
@antonello As far as I understand, Spring Cloud Contract is limited to a particular message protocol that is used by Spring, isn?t it? Pact on the other hand allows to use messages for any kind of asynchronous communication (e.g Kafka, WebSocket).

matt.fellows
2019-10-12 22:52
If it works on the JVM it should, but I don?t know enough about the specifics. I believe it?s JVM binary compatible, so in theory it should right?

mark.chambers
2019-10-13 13:31
has joined #general

florian.nagel
2019-10-13 13:46
The Spring cloud contract documentation does state that it supports integration for various messaging queues like for example Kafka, or RabbitMQ, but don't quote me on this.

florian.nagel
2019-10-14 08:43
@matt.fellows What's your take on this? You are probably more informed on this topic than I am.

darragh.grace
2019-10-14 10:59
has joined #general

venkateshmca2002
2019-10-14 11:03
has joined #general

venkateshmca2002
2019-10-14 11:12
Hi... I am trying out pact JVM. I want to test a resource accepting POST request and expects JSON as payload. I wish to validate the contents of the payload. Is it possible to do it pact. Am i right to expect this out of pact... would appreciate any inputs in this regard. thanks

hstene
2019-10-14 11:56
Yes. Yes, it is. All of this should be documented on http://pact.io and on the pact-jvm github

matt.fellows
2019-10-14 13:48
They are roughly equivalent as stated above. SCC have done a great job, and have also worked hard to get integration with Pact happening via serialising to a pact file (thereby allowing more choice of tools/hybrid Pact/SCC rollouts and also integration with our pact broker. The big differences outside of language specific are tighter integration with the Pact Broker workflows (CI/CD) and the approach to messaging / async. SCC is tighter integrated into Spring libraries and common tools, whereas we decouple ourselves from the various tools and focus more on the payload moving between them

matt.fellows
2019-10-14 13:49
It's been a while since I've looked deep into SCC, there are likely differences in how to do the matching.

florian.nagel
2019-10-14 14:42
Thank you for the input! Appreciate it. It's more or less what I thought, but it's great to have some confirmation. Cheers!

akazantseva2
2019-10-14 16:16
has joined #general

safiyya
2019-10-14 16:47
has joined #general

novyludek
2019-10-14 17:39
has joined #general

kah.goh
2019-10-14 21:44
has joined #general

gaurav.chhabra
2019-10-15 02:24
has joined #general

mateusz.zalewski
2019-10-15 07:41
has joined #general

dannybrown2710
2019-10-15 09:49
Hi Team, I have a doubt, is there any way to categorize pacts for projects in Pact broker(open source)? The UI to show pacts looks over populated and is alphabetically sorted, which doesn't help in categorizing. Thanks in advance.

matt.fellows
2019-10-15 10:22
Unfortunately not, sorry!

colin.bean
2019-10-15 14:08
has joined #general

tjones
2019-10-15 23:57
You could achieve this by prefixing consumer names with projects

neil.syrett
2019-10-16 09:37
has joined #general

akiro
2019-10-16 10:26
has joined #general

akiro
2019-10-16 10:57
Hi Team Could you please help me to clarify next part of documentation https://docs.pact.io/best_practices/provider#only-stub-layers-beneath-where-contents-of-the-request-body-are-extracted How deep is better to stub in three-tier architecture (transport details => business logic => data resources)? I have two options: 1). Stub business logic completely - it will allow me to keep tests simple, but at the same increase possibility of someone forgetting about them during code changes, which would lead to an incorrect contract, because stub would still return old version of the data. 2). Stub only third-party interacted to which we don't access to - for example, we are using a real database without any stubs, but still stub interactions with other microservices (maybe with pact as well). As minus it would make the provider side of contact tests similar to API testing of the microservice. From my perspective first one better reflects the essence of contract testing, but narrowing the scope only to the transport interaction.

florian.nagel
2019-10-16 11:22
For anyone wondering when the feature was introduced. I have asked on their gitter and apparently they have supported messaging queues before Pact did. I neither know why I have missed it nor why it only recently came to my attention. @p0deje Pinging you because you were holding the same belief as I were :sweat_smile:

colin.bean
2019-10-16 14:25
has joined #general

joshwakefield45
2019-10-16 18:09
has joined #general

sliu7
2019-10-17 02:31
has joined #general

phillip.goff
2019-10-17 12:38
@here Noob question - Please can someone help identity what is the 'Dynamic variable substitution' to POST in a webhook the verification status. At the moment I can only see ${pactbroker.githubVerificationStatus} or ${pactbroker.bitbucketVerificationStatus}


phillip.goff
2019-10-17 14:43
I meant Please can someone help identify not identify...

phillip.goff
2019-10-17 16:23
ignore my question above as I have jumped the gun and I am still working my way through the guides https://docs.pact.io/best_practices/pact_nirvana

jennifer.molis
2019-10-17 16:25
has joined #general

okereke.ruth
2019-10-17 20:55
has joined #general

bethskurrie
2019-10-18 04:07
@akiro I tend to use approach 2, unless there are serious complications that would make it unviable. @tjones was telling me the other day that they had some pact tests that all passed, but then the services failed in real life because they'd stubbed out their business logic during pact verification.

bethskurrie
2019-10-18 04:09
Pact people, especially newbies. I'm just having a look at the "was this helpful" results for http://docs.pact.io, and this page rates poorly. I'm not sure why! Does anyone have any opinions? https://docs.pact.io/getting_started/sharing_pacts

abubics
2019-10-18 04:21
It feels like more of a sales page than a helpful information page? Like, it talks about all the benefits (and a tiny bit about the problems it aims to solve), but not much about how to use it, or a workflow, etc

bethskurrie
2019-10-18 04:22
Hm. It is just basically a copy paste of the Pact Broker's readme.

simon.nizov
2019-10-18 10:30
Perhaps an illustration would make the concept clearer?

tkimia
2019-10-18 14:05
I agree with Simon. In my opinion, this page covers too much to be a subpage of the "Getting Started" portion. (You even have a "Getting Started" section on the page itself). Might be good to expand on the basics in this page and move specifics into another page.

travis.anderson
2019-10-18 17:59
has joined #general

me_pact
2019-10-18 19:25
Why does `pact-broker` prefixes the versions with the letter `v`? Very often services are prefixed by the `v` in their version, and when they publish the version to `pact-broker` it's shown as `vv1.2.3` in the frontend. Does it make sense to open a PR to remove this?

bethskurrie
2019-10-18 19:45
OK, I'll have a go at updating it with that on mind. Thanks everyone.

matt.fellows
2019-10-19 00:49
That's interesting. I use the prefix on libs with semantic versions (but not APIs generally). If you can demonstrate the issue it's worth raising, thanks

me_pact
2019-10-19 14:33
For example, this happens with non-semantic versions as well:

me_pact
2019-10-19 14:33
The original tag starts with `4fd...`, but as you can see, the prefix is still there.

slawomir.radzyminski
2019-10-19 19:33
has joined #general

slawomir.radzyminski
2019-10-19 19:34
Hi :slightly_smiling_face: I'm struggling a lot with `State Change Request Failed - ContentType.get(entity) must not be null` errors on pactVerify step. Has anyone experienced this? Some implementation and details in thread :point_down:

slawomir.radzyminski
2019-10-19 19:35
```@Profile("pact") @RestController public class PactController { @RequestMapping(value = "/pactStateChange", method = http://RequestMethod.POST) public void providerState(@RequestBody Map body) { if (body.get("state").equals("No nationality")) { Nationality.setNationality(null); } else { Nationality.setNationality("Japan"); } } }```

slawomir.radzyminski
2019-10-19 19:37
``` project(':example-provider') { apply plugin: 'au.com.dius.pact' jar { version = '1.0.0' } task startProvider(type: SpawnProcessTask, dependsOn: 'assemble') { command "java -Dspring.profiles.active=pact -jar ~/IdeaProjects/Pact-JVM-Example/example-provider/build/libs/example-provider.jar" ready 'Started ContractProvider' } task stopProvider(type: KillProcessTask) { } pact { serviceProviders { ExampleProvider { protocol = 'http' host = 'localhost' port = 8080 path = '/' stateChangeUrl = url('http://localhost:8080/pactStateChange') startProviderTask = startProvider hasPactsFromPactBroker("http://localhost:9292") terminateProviderTask = stopProvider } } }```

slawomir.radzyminski
2019-10-19 19:38
```> Task :example-provider:pactVerify_ExampleProvider FAILED Verifying a pact between Miku and ExampleProvider [from Pact Broker http://localhost:9292/pacts/provider/ExampleProvider/consumer/Miku/version/1.0.0] Given State Change Request Failed - ContentType.get(entity) must not be null Skipping publishing of verification results as it has been disabled (pact.verifier.publishResults is not 'true') Verifying a pact between Nanoha and ExampleProvider [from Pact Broker http://localhost:9292/pacts/provider/ExampleProvider/consumer/Nanoha/version/unspecified] Given State Change Request Failed - ContentType.get(entity) must not be null Given No nationality State Change Request Failed - ContentType.get(entity) must not be null Skipping publishing of verification results as it has been disabled (pact.verifier.publishResults is not 'true') Failures: 0) Verifying a pact between Miku and ExampleProvider - Pact JVM example Pact interaction ContentType.get(entity) must not be null 1) Verifying a pact between Nanoha and ExampleProvider - Default nationality ContentType.get(entity) must not be null 2) Verifying a pact between Nanoha and ExampleProvider - No nationality ContentType.get(entity) must not be null```

slawomir.radzyminski
2019-10-19 19:39
Tests pass from IntelliJ

slawomir.radzyminski
2019-10-19 19:40
Spring boot 2.2.0 pact 4.0.1

matt.fellows
2019-10-19 21:05
Looks like just a display thing. Does it affect API calls via CLI or otherwise?

me_pact
2019-10-20 11:43
I wouldn't say so. I checked the pact-broker code, looks like it's rendered with `v` from the Ruby code only, and not persisted with `v` in the database.

matt.fellows
2019-10-20 20:13
:+1:thanks for looking

me_pact
2019-10-20 21:42
Is there a way of getting a specific revision of a published Pact version through the Pact broker API?

bethskurrie
2019-10-20 21:48
Yes


abubics
2019-10-20 22:15
Good idea to move this to #pact-jvm :)

abubics
2019-10-20 22:17
Just going by the error message, it sounds like something is missing a content type, or the content type in a request doesn't match the body?

abubics
2019-10-20 22:20
What content type does your state change endpoint expect?

me_pact
2019-10-20 22:30
Hey Beth! Looks like this will only return the latest Pact version, but I can't specify a revision of the version. This happens in cases where the version of the Pact is overwritten, which is my case.

me_pact
2019-10-20 22:36
I'm building a integration for Concourse CI, and I would like to point to the most specific version of a resource, in this case a Pact contract revision. I can see that they are stored in the database, but I couldn't find a way to get a specific revision through the API.

bethskurrie
2019-10-21 00:09
don't overwrite things :stuck_out_tongue:

bethskurrie
2019-10-21 00:11
If you're overwriting pacts because you're re-publishing them with the same consumer version, you're going to get race conditions, which make can-i-deploy return different results depending on when it gets executed.

bethskurrie
2019-10-21 00:13
There is a form of the pact URL that uses the *pact* version (not the consumer version) that is like a permalink - it will never change.

bethskurrie
2019-10-21 00:14
`/pacts/provider/PROVIDER/consumer/CONSUMER/pact-version/SHA` but there isn't really a great way of getting that URL.

bethskurrie
2019-10-21 00:14
Can you explain the goal you're trying to achieve?

bethskurrie
2019-10-21 00:15
Or maybe, the problem you're facing that you're trying to get around by doing something this unusual?

bethskurrie
2019-10-21 00:22
Hey Pact people. Here at Pactflow, we're doing some research into whether we could use OpenAPI to provide a Pact-like experience for people who can't/don't use Pact (eg. when there are too many consumers to make Pact feasible) @uglyog has written a blog post about our current thinking here: https://blog.pactflow.io/the-curious-case-for-the-provider-driven-contract/ We're trying to get input from as many OpenAPI users as we can, so to that end, I've put together a short survey. We'd really appreciate your input! We're offering a 10% discount on a year of Pactflow as a sign of our appreciation. https://dius.typeform.com/to/Dd66SC

ruben.perezg
2019-10-21 07:06
I was wondering about this, because we use the _approach 1_... Could you help me understand what issues could you make tests pass, but "break" your contract in production?

bethskurrie
2019-10-21 08:36
@tjones can you remember the details of your example?

ppaduch
2019-10-21 10:32
has joined #general

kalpana.k
2019-10-21 11:28
has joined #general

ppaduch
2019-10-21 12:08
Hi All , I am using javascript wrapper. I am struggling with a basic function eachLike for MessagePact. It seems to be a defect: Pact Matchers are not respected in eachLike, any created contract uses only type matching. The basic example from documentation does not work as expected . In the documentation there is an example https://github.com/pact-foundation/pact-js#match-based-on-arrays: pact.eachLike(obj, { min: 3 }) . It?s written that *Where obj can be any javascript object, value or Pact.Match.*. In the attached example *animalBodyExpectation* we use Pact.Match term, however the contract is built according to ?types? not regexp . I would expect that *gender* would be built using regexp matcher.

roi.otero.morales
2019-10-21 12:27
has joined #general

saranyabalaji13
2019-10-21 12:43
has joined #general

akiro
2019-10-21 13:36
@bethskurrie Thanks for the answer, I will rework my POC to use real data. Also as far as I understand as minus of not using stubs I will have to directly specify important fields (like id for getById to check exactly specific record during validation of contract) within a provider state name to use them in consumers.

me_pact
2019-10-21 16:00
I responded in the other thread in #pact-broker. Speaking of the SHA endpoint, why is it exposed if there is no good way of getting the SHA for the Pacts? This might be a be a good way of solving the issue that I have. Edit: Looks like this is exactly what I need, a unique identification for each Pact, so I don't have to rely on the `createdAt` field. I had to dig the SHAs from the DB, as I'm unsure where else can I get them from.

me_pact
2019-10-21 16:51
Looks like this issue https://github.com/pact-foundation/pact_broker/issues/307 is very similar to what the resource does at the moment.

stevi.deter
2019-10-21 17:15
has joined #general

mohsin
2019-10-21 20:11
<ignore>

oliver.nautsch
2019-10-22 08:08
has joined #general

bartlomiej.twarog
2019-10-23 12:49
has joined #general

mateusz.zalewski
2019-10-23 12:52
has joined #general

bethskurrie
2019-10-24 00:09
@me_pact The pact version sha is primarily used to make sure that the verification results are matched up to the right content. (eg. if someone publishes a pact for consumer version 1, the provider verifies, and during verification, the consumer overwrites the pact for consumer version 1 with different content - we have to make sure that the verification results get associated with the right content, regardless of which consumer version is associated with it.)

bethskurrie
2019-10-24 00:10
During verification, the URL usually used to get a pact is the one that gives the latest one for a tag. Having the "permalink" to the exact pact content is not really a "thing".

bethskurrie
2019-10-24 02:56
@ppaduch it should work. Can you make a executable example using a fork of the example directory in the pact-js repository?

erfana.sikder
2019-10-24 03:43
has joined #general

erfana.sikder
2019-10-24 03:46
hey Pact folks, I have a consumer project in clojure - do you have any demo project in clojure or does pact work with clojure?


uglyog
2019-10-24 03:54
There is also a provider module for Leinigen

ryan.dens
2019-10-24 04:07
any good examples of small services created which accept provider states? https://github.com/pact-foundation/pact-provider-verifier#api-with-provider-states

erfana.sikder
2019-10-24 04:08
awesome thanks

monch1962
2019-10-24 07:10
Hi @bethskurrie we looked at doing that NAB a few months back, but there's are few problems and shortcomings: - OpenAPI is inherently provider-side only; it describes what a provider delivers, and has no way of capturing what consumers are consuming - OpenAPI has no concept of providerState, so the best it can do is e.g. generate a random 9-digit string in response to requests. From the consumer side, you typically want to have a capability to generate different responses based on different sets of request data, but OpenAPI doesn't support that - because OpenAPI is provider-only, you lose traceability between what providers provide and what consumers consume. The impact is that there's no automated mechanism to track what the implications are of e.g. the provider removing a field from a JSON response, or changing the structure of the response. This means you now need a separate tool to help you manage these changes through the lifecycle of the provider - following on from the last point, you can't implement a Pact broker-like capability due to that lack of traceability. The best you can do is have sets of consumer-side tests that hit an OpenAPI-defined stub - again from the same point: it becomes difficult to decommission old versions of provider APIs, because there's no mechanism to track (over time) which consumers are using which versions of those APIs

ppaduch
2019-10-24 13:54
Yes, I can. I will do it and let you know, thanks

matt.fellows
2019-10-24 21:32
Hi Ryan, would you mind elaborating a bit further? Which language are you using? Generally speaking, this libarary is only used where we don?t have natural language bindings (e.g. JS, .NET, Python, Ruby, Go, PHP ?)

ryan.dens
2019-10-24 21:56
Hey Matt, I?m looking to setup and teardown various states on the provider from the pact-jvm maven plugin. As I understand it, my consumer pact specifies some state and the jvm maven plugin specifies a stateChangeUrl which accepts a `ProviderState` describing the state to setup or teardown. The service that receives this request is then responsible for setting up and tearing down the state

ryan.dens
2019-10-24 22:00
We?re not looking to modify our Provider to accept special pact json to setup and teardown state, so I?m looking at setting up a separate service which listens for requests at the ?stateChangeUrl? specified in the maven provider plugin and modifies the state of the provider by connecting directly to the DB, rather than using the Provider?s API

ryan.dens
2019-10-24 22:01
Is that the correct approach? If it is, I?m simply looking for a sample project which has been setup to receive messages from the maven provider plugin about setting up and tearing down state in the Provider?s database

ryan.dens
2019-10-24 22:03
@matt.fellows

matt.fellows
2019-10-24 22:42
I?ll double check, I?m not sure from memory.

ryan.dens
2019-10-24 22:43
Thanks! I have something simple working now, but don?t want to deviate too far from the norms. So far I?ve gotten the maven plugin to send a message to the service describing the desired state, but i haven?t gotten it to send a ?teardown? message, which i presume should happpen after verification?

ryan.dens
2019-10-24 22:44
Perhaps a better question for Ron?

matt.fellows
2019-10-24 22:44
ok cool, I was about to suggest the same thing

matt.fellows
2019-10-24 22:44
hmm Teardown, I?m not sure. the Ruby one doesn?t do that from memory, as each state should be self sufficient

ryan.dens
2019-10-24 22:46
Am i misunderstanding the tear_down step here?


ryan.dens
2019-10-24 22:49
my initial thought was to add the data to the DB necessary to verify this pact but that best practices would dictate I should remove the item from the DB after the pact verification

gajjarbee
2019-10-25 01:06
has joined #general

bethskurrie
2019-10-25 02:20
@monch1962 we've been though exactly the same thought process as you. We think we have a technical solution, but we're trying to work out if there is demand for it. Have you read this? https://blog.pactflow.io/the-curious-case-for-the-provider-driven-contract/

bethskurrie
2019-10-25 02:22
> OpenAPI is inherently provider-side only Providers could write OAS, consumers could write pacts, and the two can be verified against each other using the swagger pact verifier that Atlassian open sourced (or even better, inside the broker itself) > OpenAPI has no concept of providerState This would either have to be defined elsewhere (eg as dredd does it) or added to the OAS with custom extensions. > because OpenAPI is provider-only, you lose traceability between what providers provide and what consumers consume Pact/OAS verification would provide this

ryan.dens
2019-10-25 04:16
update: got this working. There?s a config called `stateChangeTeardown` which adds an `action` attribute to the state change server. This config is documented in the gradle plugin readme, but since I was using the maven plugin I had to dig through source to find it

mangesh.sam18
2019-10-25 08:00
has joined #general

rbhati
2019-10-25 19:20
hello @bethskurrie need a quick suggestion, we have a ecosystem where one of our consumer is an ios app and I need help to under how can we write consumer sider unit test using pact which end up generating pact json files

rbhati
2019-10-25 19:20
any pointers will he highly appreciated

ryan.dens
2019-10-25 21:41
Made a simple example here that works with the pact-jvm maven plugin if others ask about this in the future: https://github.com/ryandens/pact-provider-state

bethskurrie
2019-10-25 23:47
@rbhati try #pact-swift


matt.fellows
2019-10-26 01:44
Awesome, thanks @ryan.dens!

agarwalatrisha1212
2019-10-26 12:22
Java

agarwalatrisha1212
2019-10-26 12:23
Could you share me details about workshop @matt.fellows



matt.fellows
2019-10-26 12:24
Take a read through http://docs.pact.io also if you haven?t already

vince.grossi
2019-10-26 19:41
has joined #general

brandontylerwilliams
2019-10-27 20:15
has joined #general

brandontylerwilliams
2019-10-27 20:25
~Hi all!~

tjones
2019-10-28 00:24
Apologies for the slow response - the problem we had was the whole controller was being stubbed. We were testing the translation from the domain objects to the Pact response

tjones
2019-10-28 00:24
This is good practice, because it's not testing the business logic, but if we had put the stub further down (say, beyond the domain layer), we would have discovered that some of the domain objects we tested in the Pact test could never be produced by any code path

tjones
2019-10-28 00:25
(not sure I explained that well, let me know if you'd like more details)

tjones
2019-10-28 00:25
For practical purposes, I think I prefer option 2

tjones
2019-10-28 00:25
but, for a "pure contract test", option 1 is more correct

bethskurrie
2019-10-28 00:26
I take a pragmatic approach, and default to option 2 unless there are performance issues to make it untenable.

tjones
2019-10-28 00:26
Contract testing isn't provider functional testing - but that doesn't mean your contract tests can't naturally include some functional testing.

tjones
2019-10-28 00:27
I would get worried if you started to try to enumerate your provider functional code paths through a contract test

erfana.sikder
2019-10-28 03:53
Hi, my provider depends on multiple microservices to generate a result and same goes with my consumer it depends on multiple microservices to make a request. In this case, should I mock all the dependencies on additional services using any mock framework? If you have any documentation/resource can you please send me the link. Curious to know what is the right approach in this scenario where the microservice u are testing is dependent on others.

bethskurrie
2019-10-28 03:55
This is always a tricky question to answer. It is definitely recommended to mock downstream dependencies, but if you do, you need to ensure that you are sure that the responses you are mocking are valid ones.

bethskurrie
2019-10-28 03:55
To do this, you would then generally add a pact with the downstream service.

bethskurrie
2019-10-28 03:55
How you do this depends on which language you are using.

bethskurrie
2019-10-28 03:55
Which one is it?


bethskurrie
2019-10-28 04:20
You remember what I've written better than I do @matt.fellows :stuck_out_tongue:

erfana.sikder
2019-10-28 04:22
@bethskurrie the provider is Golang and consumer clojure

erfana.sikder
2019-10-28 04:22
@matt.fellows thanks for the link, having a look at it

bethskurrie
2019-10-28 04:23
Unless Matt has done a heap of work since I last checked, go wraps the generic provider verifier that operates at the HTTP level, so you'll need to either stub out your downstream providers within the code, or provide running HTTP stubs.

erfana.sikder
2019-10-28 04:28
I am thinking of spinning up docker with mocked responses from all the dependencies

matt.fellows
2019-10-28 04:33
Any reason you couldn?t just mock the interfaces in memory?

matt.fellows
2019-10-28 04:33
(that works too, btw, but obviously will have tradeoffs on time/setup etc.)

erfana.sikder
2019-10-28 04:52
I can do in memory as well but I thought docker with setup would be more reliable and for the huge amount of dependencies we have

lalin1982
2019-10-28 10:04
has joined #general

prabhuramchennai
2019-10-28 10:44
has joined #general

lalin1982
2019-10-28 10:44
Hi, I am new using Pact and this trying to define good practices within my team. We currently have one microservice that consumes two different providers, we have created two contracts and we have raised doubts whether the name of the contract should be the same for both or should be different. What would be the best way to define it? Regards,

matt.fellows
2019-10-28 10:54
You don't name the contract, you name the consumers and providers

matt.fellows
2019-10-28 10:55
If it's the same consumer or provider being used in different situations, use the same name

matt.fellows
2019-10-28 10:55
What's the actual problem?

lalin1982
2019-10-28 11:34
I have one microservice that manages user accounts, this is my consumer. The microservice calls two APIs, one to recover user activity (activity-provider) and another to manage subscriptions to external services (external-service-provider), then we have two pacts (one for each provider) and we have the doubt whether to define a consumer for each pact or should be the same. Looking for examples in Github we have seen examples of both approaches.

matt.fellows
2019-10-28 11:40
You just have one consumer the ?user accounts? component. You should have two pacts, but the `consumer` property should be the same in both of them

matt.fellows
2019-10-28 11:41
What you just described sounds like a perfectly normal

matt.fellows
2019-10-28 11:41
> we have the doubt whether to define a consumer for each pact or should be the same What does this mean? How are you creating the pacts without defining a consumer in the first place?

matt.fellows
2019-10-28 11:41
Sorry if I?m misunderstanding something

lalin1982
2019-10-28 11:57
We are still defining the pacts and reading documentation. And we had doubts about how to define it. With the answer you have given me you have clarified all my doubts. Many thanks.

matt.fellows
2019-10-28 12:00
ah cool

matt.fellows
2019-10-28 12:00
sorry you were just speaking sense, so hence my confusion - glad you?re here. All the best! :slightly_smiling_face:

prabhuramchennai
2019-10-28 12:39
Hi, there is often question from my teams on who should create the contract. From the principles I understand it should be the consumers but often the consumers will not know all about the services. If the provider is creating and maintaining the services shouldn't they be creating the Contract/Pact for the first time and then maintained by consumers?

kyle.hammond
2019-10-28 19:13
Warning: long post First, the provider and consumer obviously need to communicate prior to the contract being created at all. The two sides need to work out in general what services the provider will handle. Second, generally the provider exists because of the consumer?s need for it. If there were no consumers that needed the service, there?s no need for a provider at all. From that perspective, it makes sense for the consumer to create and maintain the contract. The contract formalizes the consumer?s needs and expectations for that provider. You said ?often the consumers will not know all about the services?. You?re exactly right; each consumer will only know about their part of the contract with the provider. As far as each consumer contract is concerned, that?s all the service has to provide. If as an implementation detail you have two (or more) consumers that have very similar contracts, then by all means share the provider. When developing the provider you can do so in such as way as to satisfy and test both (or multiple) contracts. A contract is not the same as complete documentation of the provider. Contracts are, by design, very specifically between a single consumer and a single provider. In fact, a single contract is often not the complete documentation of a consumer either. The consumer may reach out to multiple providers in order to perform the consumer?s work. In that scenario, multiple contracts are in place both on the consumer and provider sides. Hope that helps to explain why consumer-driven contracts are the way they are.

monch1962
2019-10-28 20:18
I think there's definitely value in using OpenAPI in combination with Pact, even if only because many large companies already have a big investment in OpenAPI that they don't want to lose. If you can position Pact as an addition to, rather than a replacement for, OpenAPI they're far more likely to give Pact a try. With respect to the the idea of adding vendor/custom extensions to OpenAPI, my personal preference would be to make the providerState "object" (? - is that what you'd call it?) more "formal". I've already got code that can parse Pact's requests/response pairs and generate executable test cases and/or stub configs in any language or framework. (Chasing permission to open source it now...) I'd love it if I could take the same approach to parse a generic Pact's providerState, generate the necessary state data and then execute the test - without writing any app-specific code. As a very simple example, if providerState had to be e.g. an array of SQL CREATE or UPDATE statements, I could extract that SQL, execute it against a datastore to load the necessary data to support a test, then run the test. Unfortunately that wouldn't work for anything but SQL databases, but I'd have a self-maintaining test case that could be created and executed directly out of a Pact.

matt.fellows
2019-10-28 20:27
So, the _pact_ contract is generated by the consumer - our tooling basically enforces this. The only way for it not to be the consumer, were if the Provider team wrote your unit tests for you that tested your code. So by definition, it seems unlikely this would happen

matt.fellows
2019-10-28 20:28
Everything Kyle said stands, but also consider that using tools like OAS doesn?t preclude the use of Pact/CDC either. They are complementary technologies

matt.fellows
2019-10-28 20:28
In fact, we are exploring even further how we support OAS as a first class citizen in this contract testing ecosystem

matt.fellows
2019-10-28 20:29
The most important statement that applies to any mode > First, the provider and consumer obviously need to communicate prior to the contract being created at all.

bethskurrie
2019-10-28 21:07
Great answer @kyle.hammond

acooper106
2019-10-28 22:18
is anyone using pact with spring boot app? I'm trying to use it but we are seeing flaky tests. I have 2 tests and one will pass or fail depending on if its ran 1st or 2nd

bethskurrie
2019-10-28 22:23
Is it the provider? Sounds like the provider state data isn't being cleaned properly between interactions.


prabhuramchennai
2019-10-29 08:42
~Nice answers. Thanks. When it's a new service or when there is a change it makes sense. Suppose there is a team with existing services and which wants to adopt contract testing, that's where the difference starts. With a huge list of contracts to be created, consumer expects the provider.. In the tools like Spring cloud contract, we create the contract file first which can be either~

prabhuramchennai
2019-10-29 08:45
Nice answers. Thanks. 1. When it's a new service or when there is a change it makes sense. Suppose there is a team with existing services and which wants to adopt contract testing, that's where the difference starts. With a huge list of contracts to be created, consumer expects the provider.. 2. In the tools like Spring cloud contract, we create the contract file first which can be either be created by a consumer or provider. Eventhough PACT enforces it the PACT.Json could still be created by the provider and consumer can create a test for it later. Overall, what you say absolutely makes sense but since this will be an additional work for existing services, there's is always this confusion of who creates them. If I read you write, you say that even in this situation it must be the consumer who creates the contract..?


prabhuramchennai
2019-10-29 08:49
sounds interesting if the pact file could be generated from a swagger spec. Is this already developed?

bethskurrie
2019-10-29 08:49
No, sorry.

bethskurrie
2019-10-29 08:50
Again, the pact file would not be generated from the swagger document. That defeats the purpose.

bethskurrie
2019-10-29 08:50
The *test code* that generates the pact would be generated from the OAS.

bethskurrie
2019-10-29 08:50
The point of the contract is not to have the contract - it's to keep two sets of tests in sync.

matt.fellows
2019-10-29 09:52
I think there?s something in that. For us, the _contract_ file is an (important) artifact/side-effect, whereas an OAS is a specification that is useful in its own right

monch1962
2019-10-29 20:45
With respect to @kyle.hammond?s excellent response, let me give an different view. Many companies that work in regulated spaces (e.g. banks, wagering companies, some government departments) are creating APIs designed to be consumed by the general public. Realistically, no consumer is going to create and maintain contract tests for a banking API; the bank is going to publish APIs that they're prepared for consumers to use. The bank _could_ also publish a set of contract tests that those consumers could work with when writing code. These providers _could_ also provide a provider-side sandbox environment (either hosted, or downloadable) that supported execution of that set of contract test cases, helping consumers of their APIs to do their thing without having to create stubs. There's nothing inherent in Pact that makes it consumer-driven

adrian.mace
2019-10-30 01:10
has joined #general

sankalan.13
2019-10-30 06:05
has joined #general

sankalan13
2019-10-30 06:20
Hi @bethskurrie The current product I am testing pulls in game data in real time from a third party provider using APIs and we display it in the UI of our product. I will not be able to set up provider states in the code for the third party API provider. I have multiple services running, the gaming service communicates with the third party provider. Will I be able to write Pact tests between a third party provider and my UI consumer? If yes, how will I be able to set up provider states for certain APIs? (given that the APIs to test is only GET APIs) Could I leave my provider state end point to not do anything and verify the API responses with the third party provider in real time?


sankalan13
2019-10-30 08:10
Yep this helps. I will probably still go for Pact on this case instead of using VCR. Thanks Beth!!

acooper106
2019-10-30 15:01
this is actually the consumer side

acooper106
2019-10-30 15:02
Sounds like the solution is to add an @After teardown section. Any examples of this? What am I cleanning up after each test?

kyle.hammond
2019-10-30 19:50
Excellent points @monch1962. I both agree and slightly disagree. An organization may be creating APIs for the general public, but that organization isn?t creating API just to have an API. During API creation, they step into the role of an API consumer to think about what would be useful to expose in their API. They think about how a consumer could interact with the provider, and then document the API and test to that assumed consumer use. Even if they don?t have an explicit consumer-side application/service whose unit tests would drive the pact file creation, they still created their tests and documentation with a consumer mindset. I would love it if any public API would give me some specific tests that I could run from a consumer-side test that verified I was calling the API correctly without having to call the real API. I don?t know of any place that does that; I can set up sandbox or trial accounts with many places but then I would still be calling the real API; error states are particularly hard to test this way. It would be awesome if we could feed some OAS docs into a mock server (or convert OAS to pact first if needed), then have the consumer test against that. This theoretical mock server would verify that the consumer called the API correctly, but wouldn?t verify how much of the API it called (the consumer doesn?t have to hit every API endpoint).

rbhati
2019-10-30 19:59
I'm having a hard time getting this work, almost at the edge of give up

rbhati
2019-10-30 20:00
as soon as i uncomment line#13 `helloProvider = MockService(provider: "Hello Provider", consumer: "Hello Consumer")` test crash during compile time and no error thrown https://github.com/andrewspinks/PactSwiftExample/blob/master/PactSwiftExampleTests/PactSwiftExampleTests.swift

rbhati
2019-10-30 20:01
@matt.fellows and @bethskurrie ^^

rbhati
2019-10-30 20:20
we are on swift 5

rbhati
2019-10-30 20:56
All i'm trying to do is to write a consumer contract test that should end up generating pact json files that i can share with provider for verification

rbhati
2019-10-30 20:57
total block because of this issue, App build success but test fail and no log no message.

rbhati
2019-10-30 20:58
``` import UIKit import XCTest import PactConsumerSwift class PactSwiftExampleTests: XCTestCase { var helloProvider: MockService? // var helloClient: HelloClient? override func setUp() { super.setUp() helloProvider = MockService(provider: "Hello Provider", consumer: "Hello Consumer") // helloClient = HelloClient(baseUrl: helloProvider!.baseUrl) } override func tearDown() { super.tearDown() } func testItSaysHello() { helloProvider!.uponReceiving("a request for hello") .withRequest(method:.GET, path: "/sayHello") .willRespondWith(status: 200, headers: ["Content-Type": "application/json"], body: ["reply": "Hello"]) print("Hello") } ```

rbhati
2019-10-30 20:58
this is all i'm executing

uglyog
2019-10-30 21:25
The http client library used by your consumer app probably is caching the connections. Each test gets a new mock server, so for every second test the connection in the connection pool will be stale. You need to configure the http client to not cache the connections.

archana.rachuri
2019-10-31 01:46
Hey team I?m pretty much new to pact contract testing and I am setting up the framework in my team. I?m using jest to set it up. Apollo client is the consumer and provider is in graphql. Question: I have implemented contract testing using the jest example works well for one provider with global provider variable in pactSetup.js with beforeAll and afterAll setup in pacttestWrapper.js . Now I have same Apollo client with 2 providers. I am able to set up global provider variable for both providers in the pactSetup.js but I?m kinda stuck on how to setup it in a pactTestWrapper.js for two providers ?

matt.fellows
2019-10-31 02:08
You?re now going to have to manage the different pact providers separately. One approach is to create 2 providers in the pact wrapper (e.g. `provider1` and `provider2`) and then in your tests use each provider as required-


archana.rachuri
2019-10-31 02:37
Thanks @matt.fellows I?ve defined it exactly this way but how do I manage it in pactTestWrapper.js ? beforeAll() and afterAll() ? One approach that I figured out now is to use beforeAll().setup and afterAll().finalize in test file instead of a separate wrapper.js file. You think of any other alternative?

kist
2019-10-31 12:37
has joined #general

rbhati
2019-10-31 16:02
``` dyld: Library not loaded: @rpath/BrightFutures.framework/BrightFutures Referenced from: /Users/rajivbhati/Library/Developer/CoreSimulator/Devices/780359F9-BF84-4A2F-8374-FB1025A260A5/data/Containers/Bundle/Application/D55499E3-771A-4F17-BC42-57FA665D34FE/Brand.app/Frameworks/PactConsumerSwift.framework/PactConsumerSwift Reason: no suitable image found. Did find: /Users/rajivbhati/Library/Developer/CoreSimulator/Devices/780359F9-BF84-4A2F-8374-FB1025A260A5/data/Containers/Bundle/Application/D55499E3-771A-4F17-BC42-57FA665D34FE/Brand.app/Frameworks/PactConsumerSwift.framework/Frameworks/BrightFutures.framework/BrightFutures: no matching architecture in universal wrapper ```

ryan.dens
2019-10-31 16:30
:wave: I have a general question about ?pact nirvana?. We?re in the process of trying to figure out our ideal workflow. Right now, our plan is: 1. a provider publishing pacts to a broker on staging deploy (merging PR to master) 2. webhook to trigger a build which verifies and publishes verification results 3. Using `can-i-deploy` in the provider prior to deploying to make sure that there wasn?t a verification failure However, is there an ?ideal way? for the provider to know, prior to merging a PR to master, if a changed contract will break a build?

ryan.dens
2019-10-31 16:33
The only way I can think of is to publish pacts to the broker on a PR as well, with staging and production contracts tagged as such, but not sure if that is ?correct?

rbhati
2019-10-31 18:56
Any help here


matt.fellows
2019-10-31 20:45
I'm not a iOS developer and nothing stands out to me. If you have a build failure you can reporoduce and share on GitHub is suggest raising an issur

tjones
2019-11-01 00:13
Yes, perfect. This is a common question - are there other places in the documentation that we should add this info?

ryan.dens
2019-11-01 00:38
No pact nirvana seems like the one stop shop for this kinda thing, I just skimmed over it the first couple of times

ryan.dens
2019-11-01 00:42
Perhaps it would makes sense to make a comment in the section about versioning?

monch1962
2019-11-01 05:02
Has there been any discussion around adding an optional "tags" field to each interaction e.g. `{..., "tags": ["smoketest", "nondestructive", "performance", ...], ...}` ? It'd be handy to be able to select different subsets of tests from a Pact contract, for different circumstances

bethskurrie
2019-11-01 06:02
It's been briefly mentioned, but we've never had a strong enough reason for it to be added.

bethskurrie
2019-11-01 06:03
Thanks for the feedback Ryan.

douglasortego
2019-11-01 06:08
has joined #general

monch1962
2019-11-01 06:44
Would "please implement this feature" be enough? :grin: Seriously: what sort of justification would be necessary to add it? I'm happy to put something together

bethskurrie
2019-11-01 06:50
The problem is, we've semantically versioned the pact specification.

bethskurrie
2019-11-01 06:51
And Ruby (and hence js, go, php etc that wrap Ruby) are stuck on an old version because Time and Effort.

bethskurrie
2019-11-01 06:52
So, to add it to everything, we'd either have to add it to the semantically versioned specification, or throw in the towel on the sem versioning and just go wild like HTML.

bethskurrie
2019-11-01 06:53
Personally, I'm all for dropping the spec numbers, as they're holding us back, imo, but I'm not sure others share my view.

monch1962
2019-11-01 06:59
Hmm, OK. In the short term, it sounds like I need to think through the implications of adding a custom tags field if I want to implement a test suites capability across my Pact contracts

marius.maaland
2019-11-01 11:51
Is there currently an issue with the Pactflow broker? I'm getting a `503` error when trying to publish a Pact with tags. Publishing without tags works fine. Publishing *with* tags to a locally hosted Pact broker works fine. I am using `pact-go` to publish the Pact This is the error I am getting: ``` 2019/11/01 11:25:18 [ERROR] service: Failed to tag version b04ade69141427904b87b40f4d14f3e8561f2fb5 2019/11/01 11:25:18 [ERROR] service: of TestClient due to error: PactBroker::Client::Error - <html> 2019/11/01 11:25:18 [ERROR] service: <head><title>503 Service Temporarily Unavailable</title></head> 2019/11/01 11:25:18 [ERROR] service: <body bgcolor="white"> 2019/11/01 11:25:18 [ERROR] service: <center><h1>503 Service Temporarily Unavailable</h1></center> 2019/11/01 11:25:18 [ERROR] service: </body> 2019/11/01 11:25:18 [ERROR] service: </html> 2019/11/01 11:25:18 [ERROR] service: } 2019/11/01 11:25:18 [ERROR] service: One or more pacts failed to be published 2019/11/01 11:25:18 [INFO] 2019/11/01 11:25:18 [INFO] Tagging version b04ade69141427904b87b40f4d14f3e8561f2fb5 2019/11/01 11:25:18 [INFO] of TestClient as "PR-8" ```

marius.maaland
2019-11-01 11:52
Another error that might be related: when I click on "View pact" in the Pactflow UI, I get the following error page

ryan.dens
2019-11-01 14:03
Happy to help! Thanks for having great docs :thumbsup:

toby.brown
2019-11-01 14:48
has joined #general

rbhati
2019-11-01 20:39
Hi @matt.fellows & @bethskurrie, I wipe out everything and reinstall from scratch and it seems like things are working, Appreciate your thoughts and help

matt.fellows
2019-11-01 21:24
:+1:

bethskurrie
2019-11-01 21:27
Hi @marius.maaland, sorry for the slow response, we're in Australia, and Pager Duty didn't report anything overnight.

bethskurrie
2019-11-01 21:27
I'll look into it now.

bethskurrie
2019-11-01 22:06
@marius.maaland I can see two 503s in the ELB metrics from Friday 11:22 and 11:25 UTC (you'll have to convert that to your TZ) which from my calculations is about 30 minutes before you reported it on the slack channel.

bethskurrie
2019-11-01 22:11
I can't see any 503s in the application logs, and our semantic monitor hasn't raised a blip. Can you let me know if you're still seeing the issue? It may just be coincidence that it happened to be those tagging requests, as I can see no errors for any other tagging requests.

bethskurrie
2019-11-01 22:12
Also, i'm kind of confused that the tag publishing failed because I was sure it had retries in it. I'll double check.

bethskurrie
2019-11-01 22:14
Hm, it does. ``` Retry.while_error do pact_broker_client.pacticipants.versions.tag pacticipant: pacticipant_name, version: version, tag: tag end ``` I'm assuming you've only copied part of the logs in then.

bethskurrie
2019-11-01 22:19
I got this error report yesterday @marius.maaland - the resource in that URL doesn't exist, and the code needs to gracefully handle the 404.

marius.maaland
2019-11-01 23:15
hmm no that should be all of the pact publishing logs

bethskurrie
2019-11-01 23:30
:thinking_face:

bethskurrie
2019-11-02 04:21
@marius.maaland what was the name of the tag? We're wondering if it was rejected by the WAF.

bethskurrie
2019-11-02 04:26
That would be the main difference between a locally hosted broker and Pactflow.

bethskurrie
2019-11-02 05:27
OK, looks like there is a line feed in the consumer version of the tag request. Not sure if this is causing the problem, but try stripping it out to see.

forestcarlisle
2019-11-02 19:34
has joined #general

erik
2019-11-04 00:16
has joined #general

mangesh.sam18
2019-11-04 06:31

shero86
2019-11-04 09:06
has joined #general

mahadi087
2019-11-04 09:18
has joined #general

marius.maaland
2019-11-04 09:36
But the fact that it does not exists is a little concerning, since it was just published... Maybe there's a connection between this and the `tag` error above

marius.maaland
2019-11-04 09:37
The tag was `PR-8`

bethskurrie
2019-11-04 09:57
The error text at the end says the pact failed to publish.

bethskurrie
2019-11-04 09:58
What happens when you strip the new line out of the consumer version number @marius.maaland?

marius.maaland
2019-11-04 10:01
oh there is a newline? I didn't realize that. Let me check

marius.maaland
2019-11-04 10:02
True, but this error appeared when I deleted the pact, and republished with no tags, which works.

marius.maaland
2019-11-04 10:07
yup that seemed to do the trick!

marius.maaland
2019-11-04 10:17
Does not seem to be the case anymore then tags are working, so maybe it was that after all

lukembarton
2019-11-04 15:35
has joined #general

rbhati
2019-11-04 16:25
Hey @matt.fellows any pointer for : `Error setting up pact: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.`

alan.nichols
2019-11-04 16:45
has joined #general

rbhati
2019-11-04 18:01
background: After, I got success to make pact example work and not throw exception I move to next step and follow exact same steps in my actual project, and i'm getting this exception, i looked into `pact-mock-service control-start` but unable to find details around how to use https

fbromley
2019-11-04 18:12
has joined #general

rbhati
2019-11-04 19:36
i create a certificate and now i'm getting: ``` pact-mock-service control-start -o --ssl --sslcert=_wildcard.joor.local.pem --sslkey=_wildcard.joor.local-key.pem --host=pact.joor.local --port=5123 /usr/local/Cellar/pact-ruby-standalone/1.69.0/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.1.1/lib/pact/mock_service/server/spawn.rb:21:in `call': ERROR: Port 5123 already in use. (Pact::MockService::Server::Spawn::PortUnavailableError) from /usr/local/Cellar/pact-ruby-standalone/1.69.0/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.1.1/lib/pact/mock_service/cli.rb:185:in `start_server' from /usr/local/Cellar/pact-ruby-standalone/1.69.0/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.1.1/lib/pact/mock_service/cli.rb:123:in `control_start' from /usr/local/Cellar/pact-ruby-standalone/1.69.0/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' from /usr/local/Cellar/pact-ruby-standalone/1.69.0/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' from /usr/local/Cellar/pact-ruby-standalone/1.69.0/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' from /usr/local/Cellar/pact-ruby-standalone/1.69.0/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' from /usr/local/Cellar/pact-ruby-standalone/1.69.0/lib/app/pact-mock-service.rb:15:in `<main>' ```

rbhati
2019-11-04 19:37
no matter what port i mentioned I get same error

rbhati
2019-11-04 19:37
i even tried without specifying a port # but still same error

bethskurrie
2019-11-04 19:43
Cool. I've raised an issue in the pact broker client code to handle new lines better.

rbhati
2019-11-04 19:56
a working example of starting server specifying : `certificate , port and host name` will be helpful

rbhati
2019-11-04 20:06
@bethskurrie, @matt.fellows any pointers on above ^^


rbhati
2019-11-04 21:09
Never mind i find the solution, in pace of equal use space :exploding_head: , pact is painful for sure :ghost:

bethskurrie
2019-11-04 21:20
Typically, in a CLI spaces are used for separating the argument from the value. Unfortunately the output of the CLI help command puts equals in. I'm not sure why.

bethskurrie
2019-11-04 21:20
You don't need to use the control server. Just start the service with the service or start command.

bethskurrie
2019-11-04 21:21
The control server is for a flow that isn't used by any libraries at the moment.


bethskurrie
2019-11-04 21:24
Generally, it's much easier to make the ssl configurable, and run the specs without it if you can.

bethskurrie
2019-11-04 21:25
It's not a meaningful part of the contract.

bethskurrie
2019-11-04 21:28
Your question is not very clear @mangesh.sam18. It seems that you are asking for help understanding how pact works. Have you read everything in https://docs.pact.io/getting_started/how_pact_works

bethskurrie
2019-11-04 21:28
If that isn't clear, I'm not sure how better to explain it.

mangesh.sam18
2019-11-05 07:11
@bethskurrie Thanks for your reply. I Will understand the concepts of pact first.

neelofer.tamboli
2019-11-05 08:25
Is there anyway we can check for test coverage from Contract tests? Test coverage in both ways: 1. Lines or % code covered by contract test 2. Number or % of APIs covered by contract test

matt.fellows
2019-11-05 08:27
How do you measure test coverage now? Just use that, Pact just works within whatever test framework you use

matt.fellows
2019-11-05 08:28
As for API test coverage, we can't really know this in advance easily. Short answer is no, but we'd like to help more in this space

neelofer.tamboli
2019-11-05 08:38
Thank you.

matt.fellows
2019-11-05 08:50
Ideas welcome :thinking_face:

bethskurrie
2019-11-05 08:51
What would you compare it to?

lukembarton
2019-11-05 09:32
Is returning a mock from a provider the right way to satisfy a provider test? I'm working on a project where there is a disconnect between the API output and the mock that the provider returns during the pact test. A provider test was failing, but the API was working fine, the issue being that the mock response returned when the provider was under test was out of date and needed updating. Is this a common workflow?

bethskurrie
2019-11-05 09:33
You need a downstream contract, and tie that contract with the mock for the upstream contract.

bethskurrie
2019-11-05 09:34
There's some notes on it somewhere that Matt found recently.


bethskurrie
2019-11-05 09:34
Read the gist it mentions

lukembarton
2019-11-05 09:37
the direction of up and down streams in software talk always make me laugh - you never know which variant you're dealing with

bethskurrie
2019-11-05 09:45
Ha, true!

neelofer.tamboli
2019-11-05 10:01
I was thinking maybe swagger spec if available.

lukembarton
2019-11-05 10:03
ok so we are indeed mocking `CService`. My problem is that the mock doesn't actually look like the kind of thing that `CService` returns. It's 'enforced' through the type system -- the mock is of type `CServiceResponse` but the problem is that `CServiceResponse` type can't adequetly constrain the shape of the response that `CService` returns (which eventually ends up as a `ProviderResponse` and is expected to satisfy the contract with the consumer)

lukembarton
2019-11-05 10:14
(for those curious about the details as to why, it's due to go's `nil` types - an array/slice of strings `[]string` will initialise to `nil` which `json.marshal`s to `null` so you might create a mock of type `CServiceResponse` with `[]string`'s initialised as `nil` which then end up being `json.marshal`ed to `null` -- and the only way to force them into a real empty array/slice of strings`[]string{}` (which will marshal to `[]` as required by the consumer contract) is to pass the object through a function which creates _real_ empty slices, but unfortantely appears to be completely unenforcable through the type system and thus why the mock satisfies the type checker but fails to satisfy the contract that the consumer expects)

matt.fellows
2019-11-05 10:48
What would you want to know by doing that? (FYI we are working/researching a separate swagger process if you're interested in chatting further)

neelofer.tamboli
2019-11-05 10:56
Yes I'd like to discuss further. To ensure teams are following test pyramid and teams themselves know they are testing everything and nothing important is missed or delete unused code.

samuel.hodgkinson
2019-11-05 16:11
Does anyone know which DSLs for pact support V3 spec?

luchillo17
2019-11-05 16:13
Has anyone tried to use Pact with sockets? like for example with http://Socket.io?


greg.pappas
2019-11-05 17:40
has joined #general

crajcan
2019-11-05 19:55
has joined #general

bernardoguerr
2019-11-05 20:20
has joined #general

crajcan
2019-11-05 21:30
Does anyone know of any documentation on how to use the Pact Mock Service Docker container with the "@pact-foundation/pact" consumer library for js? Namely, do I need to replace the call to `provider.setup()` if I already have the dockerized mock service running? `provider.addInteraction()` won't work without it but `provider.setup()` is redundant in this case, right?

matt.fellows
2019-11-05 21:59
It?s complicated but something like that might work. Pact JS is not really designed that way, so you?ll probably need to bend it to make it work. May I ask why you would want to do that?

stevi.deter
2019-11-05 22:04
I would also like to know how to make this work, or how it's recommended to actually work. Trying to get this into our CI/CD pipeline and haven't yet had any luck actually getting our jest consumer tests to work outside the dev laptop.

crajcan
2019-11-05 22:05
Well, locally I was just running the mock server on localhost, and had no problems, but I'm trying to setup the consumer CI tests (on circleci) and was having trouble opening another port on the container my consumer tests were running in. After some googling (new to docker too) it seemed like spinning up another container for the mock server would work nicely, but perhaps I should go back to trying to run both processes on the one container?

matt.fellows
2019-11-05 22:07
Pact has the option to dynamically choose an available port and return that to you in a Promise from `setup()`. You can then configure your client with the correct host/ip combination there. This is the recommended approach (see the e2e example in the readme for how to do this)

matt.fellows
2019-11-05 22:08
So yes, I would do this. If you start the service up externally, you then need to manage versions of the service yourself, the state of the server and so on

matt.fellows
2019-11-05 22:08
ideally, the mock server is hidden from you completely and is implementation detail

crajcan
2019-11-05 22:08
interesting. I'll give it a shot


matt.fellows
2019-11-05 22:22
@stevi.deter it?s not recommended for Pact JS at all. It?s really there for the case you need to run the mock service and don?t have a language DSL to do it. Basically a DIY Pact

matt.fellows
2019-11-05 22:22
You would need to manage the lifecycle of it all

matt.fellows
2019-11-05 22:23
Could you explain why you might want this also?

crajcan
2019-11-05 22:46
@matt.fellows That seems to have worked rather nicely! Thanks for the help.

crajcan
2019-11-05 22:51
Also, I can't speak for Stevi of course, but my original intention was to spin up and tear down a dockerized mock service in every ci run, not to maintain a long-running external instance. After researching how to assign another port on the first container, it seemed a lot of docker users were suggesting just to spin up a second container rather than run two processes in the first. I guess I then assumed that was what the mock service docker image was for. Thanks again for the assistance.

stevi.deter
2019-11-05 22:56
Trying to implement step 4.B of Pact Nirvana, run my Pact tests and publish them to the Pact Broker as part of the build pipeline. Our pipeline is transitioning to Jenkins, so focused on that. It's currently all dockerized - tests are run as part of the Dockerfile build, then trying to actually run the pact tests.

stevi.deter
2019-11-05 22:58
Don't know how much it's complicated by the fact that our testbed service is trying to run its pact tests against three separate providers.

matt.fellows
2019-11-06 00:30
What language are you using? I still don?t see a need to have a separate docker container for this, the language (JS/JVM whatever) should take care of this for you.

matt.fellows
2019-11-06 00:30
I?d suggest keeping it simple for now

sivasateesh9
2019-11-06 04:11
has joined #general

siaynoqmage
2019-11-06 04:45
Hey Pact-ers :slightly_smiling_face: It?s been a while? I resurrected my initiatives around using contract testing and based on one of our APIs I have a few questions :slightly_smiling_face:

siaynoqmage
2019-11-06 04:47
sooo, one of the response fields of a REST API is the ?current date? - how do I write the consumer pact for this? ``` .willRespondWith() .status(200) .headers(headers) .body("{\"date\": ????, \"otherField\": \"XYZ\"}") ```

siaynoqmage
2019-11-06 04:48
(this is mainly because the data contruct is shared and we CAN query data by date or just for ?today?)

siaynoqmage
2019-11-06 04:48
seems to be, ?response? is always static in a pact definition - is that a correct assumption?

tjones
2019-11-06 04:51
No, response is not always static. In general, you want to avoid static responses as much as possible

siaynoqmage
2019-11-06 04:51
so how do I define a Pact in this case?

tjones
2019-11-06 04:51
You'll want to use matchers for whatever framework you are using

tjones
2019-11-06 04:51
The matchers will let you specify what kind of responses you accept

siaynoqmage
2019-11-06 04:52
oh, I thought matchers are for _requests_

tjones
2019-11-06 04:52
is that Pact-JVM? I think there's a date matcher

siaynoqmage
2019-11-06 04:52
coming from ?wiremock? :smile:

tjones
2019-11-06 04:52
Matchers are best used in the response

siaynoqmage
2019-11-06 04:53
OK, where do I find documentation for the available matchers? (I used JVM, but I think Javascript will be used eventually)

tjones
2019-11-06 04:53
The example request you give Pact will be what is sent to your provider during verification

tjones
2019-11-06 04:54
https://docs.pact.io/getting_started/matching <-- this explains the purpose of the matchers

tjones
2019-11-06 04:54
hold on, I'll see if I can get you the JVM / js matcher links

siaynoqmage
2019-11-06 04:55
cool


siaynoqmage
2019-11-06 04:57
ah, I think I found this (or similar) for JVM

siaynoqmage
2019-11-06 04:58
but it seems my scenario here isn?t valid? like I _should_ expect a `date()` to be sent back - but I _should not_ enforce current date in the verification part?

tjones
2019-11-06 04:59
Ideally the pact describes the shape of the data, not the specific content

siaynoqmage
2019-11-06 04:59
hmmm? contractually it doesn?t matter what the date is, right?

tjones
2019-11-06 04:59
Correct

tjones
2019-11-06 04:59
it being todays date is provider functionality, which isn't part of the contract

siaynoqmage
2019-11-06 05:00
so that has to be covered elsewhere (other test phase)?

tjones
2019-11-06 05:00
So your Pact would say "hey, this bit is a date expressed in this format"

siaynoqmage
2019-11-06 05:00
maybe provider internal unit test?

tjones
2019-11-06 05:00
yep, I would do it in a unit test in the provider

siaynoqmage
2019-11-06 05:00
hmmm, that?s actually cool, how contract testing enforces better software design principles :smile: :smile:

tjones
2019-11-06 05:01
if for some reason you really want to cover it with Pact, you could have a provider state that says "Todays date is 1/12/2019", then define specific data in the contract

tjones
2019-11-06 05:01
but that's the kind of test the documentation encourages you not to write - because, as you already said, that kind of test isn't the responsibility of the contract

siaynoqmage
2019-11-06 05:02
I see


siaynoqmage
2019-11-06 05:02
thanks for the quick response :slightly_smiling_face:

tjones
2019-11-06 05:03
You're welcome

tjones
2019-11-06 05:03
there's a documentation page about the kind of data to bake in to the contract, as well

tjones
2019-11-06 05:04
I'm just trying to find it

tjones
2019-11-06 05:05
aha - it's the "Best Practice" section in the matching page I sent earlier:



tjones
2019-11-06 05:06
We're working on improving the documentation, so if there's anything unclear after reading those (or if you already read those links but they didn't help), it's very useful to know

siaynoqmage
2019-11-06 05:11
awesome, thanks a bunch!

greg.pappas489
2019-11-06 06:50
has joined #general

samuel.hodgkinson
2019-11-06 10:34
Nice, thanks anto

vivek.prahlad
2019-11-07 04:22
has joined #general

antonello
2019-11-07 09:17
Are all the dius people on holiday? :slightly_smiling_face:

matt.fellows
2019-11-07 09:18
Should we be? :laughing:

antonello
2019-11-07 09:20
haha. :grin: I have noticed less activity than usual in the last couple of days, but more selfishly @greg.pappas has found and fixed a pact-jvm issue (well, there is a PR) and we were hoping in a release soon.

bethskurrie
2019-11-07 09:22
Cup day.

antonello
2019-11-07 09:22
Right! :slightly_smiling_face:

bethskurrie
2019-11-07 09:22
Long weekend. "The horse race that stops the nation".

antonello
2019-11-07 09:22
So my intuition was right!

bethskurrie
2019-11-07 09:23
It's on the first Tuesday of November, and many people take the Monday off and make it a 4 day weekend.

bethskurrie
2019-11-07 09:23
Yes.

antonello
2019-11-07 09:27
On a different note, there has been an interesting move (one that the client I am working with wanted to get to but didn?t get time to work on it sooner) in the provider verification approach for some of their consumers. Inspired by what http://gov.uk are (or were?) doing, we?re now creating and publishing a jar that contains the provider verification tests and the code necessary to run them, so that the consumer?s pipeline can get immediate feedback on the provider verification.

bethskurrie
2019-11-07 09:28
Well that's clever!

antonello
2019-11-07 09:28
The verification runs for both the head of `master` branch and the version matching what?s in production (plus for a matching feature branch if it exists).

matt.fellows
2019-11-07 09:29
I think right move did something like that

matt.fellows
2019-11-07 09:29
(just doing the bed routine, back a little later but couldn't help myself)

antonello
2019-11-07 09:29
the tag verified is obviously only the one that matches the consumer?s pipeline that is running.

antonello
2019-11-07 09:30
I was there with them when they started using pact and I do remember that it was always the intention!

antonello
2019-11-07 09:30
They created a diagram that explains it much better. I?ll ask if it?s ok to share it.

bethskurrie
2019-11-07 09:30
We should add that as a suggested workflow in the docs.

matt.fellows
2019-11-07 09:42
Ahh ok. Maybe it was just the stubs they shared

matt.fellows
2019-11-07 09:43
I'd need to go back and look at Harry's talk

matt.fellows
2019-11-07 09:46
In case having a public holiday for a horse race wasn't enough, we also get one off for AFL grand final (both Victorian public holidays) :laughing:

matt.fellows
2019-11-07 09:50
But I've also been rather quiet on here. Had baby #2 a few weeks back so have just had a little less time / head space

bethskurrie
2019-11-07 09:51
Sleep

matt.fellows
2019-11-07 09:52
I'm actually about 20 mins away from dead batteries I think. I really shouldn't be so stubborn and still head to gym before work :grimacing:

bethskurrie
2019-11-07 09:53
I can't tell if you mean literal dead batteries or metaphorical ones.

bethskurrie
2019-11-07 09:53
Or, if we're speaking American, literal or literal...

matt.fellows
2019-11-07 09:54
Metaphorical

antonello
2019-11-07 09:54
Congratulations on :baby: #2 Matt!

kv
2019-11-07 11:02
has joined #general

ml
2019-11-07 14:23
has joined #general

luchillo17
2019-11-07 16:03
Is there a way to use Pact with http://Socket.io?

siaynoqmage
2019-11-07 22:33
is that a websocket based framework?

iammrrhodes
2019-11-07 22:36
has joined #general

iammrrhodes
2019-11-07 23:58
Ive a question... when i run my provider tests... and they pass.... my tagging doesn't seem to be saving to the broker.... im not sure what im not doing ...

tjones
2019-11-08 00:23
Yes. You can use a message pact to handle websockets. I've personally not done it, but you might find some inspiration in: https://github.com/pact-foundation/pact-js/tree/master/examples/messages

tjones
2019-11-08 00:24
Which platform? You might need to configure the publication of the verification results

iammrrhodes
2019-11-08 00:35
I'm using JavaScript, with gitlab-ci,

ayip
2019-11-08 02:01
has joined #general

vitaliy.grigoruk
2019-11-08 07:33
provider app versions are not tagged when you publish verification results, @iammrrhodes You need to explicitly create a provider version tag

vitaliy.grigoruk
2019-11-08 07:34
However, it would be nice to have such a feature

cbergstrom
2019-11-08 07:37
has joined #general

ml
2019-11-08 08:03
coincidently at the same problem. Can you point me to the documentation on how to `explicitily create provider version tag`?

vitaliy.grigoruk
2019-11-08 08:07
``` curl -XPUT -H "Content-Type: application/json" \ -u $PACT_BROKER_USERNAME:$PACT_BROKER_PASSWORD \ ${BROKER_URL}/pacticipants/${PARTICIPANT}/versions/${VERSION}/tags/${TAG} ```

vitaliy.grigoruk
2019-11-08 08:08
you can figure it out in HAL API browser.

bethskurrie
2019-11-08 08:59
@iammrrhodes provider tagging should be supported now. Are you using the latest version of pact-js?

bethskurrie
2019-11-08 09:00
@ml which implementation are you using? We need to add this if it's not in there.

bethskurrie
2019-11-08 09:02
Ok, I take it back - I can't see it in the pact-js documentation. Let me raise an issue for it. I'm sorry, I thought it was already there.


iammrrhodes
2019-11-08 09:33
Ok, thank you. I assume for now I need to be using other means.

bethskurrie
2019-11-08 09:33
Yeah, sorry about that.

bethskurrie
2019-11-08 09:33
The way Vitalii described will work.

iammrrhodes
2019-11-08 09:39
I?m assuming the CLI will work too?

bethskurrie
2019-11-08 09:39
Yes.


felipe
2019-11-08 16:46
has joined #general

felipe
2019-11-08 16:47
Hello! Anybody working with pacts and elixir?

rbhati
2019-11-08 20:22
Excellent news i knock this huddle out as well, and I decided to contribute to respective pact readme's based on my learning. Hope that's ok

rbhati
2019-11-08 20:23
@bethskurrie, @matt.fellows next i'm setting up pact broker and I'm using the docker-compose as described in https://github.com/pact-foundation/pact_broker

rbhati
2019-11-08 20:24
wonder if there are any example's that I can refer to know how to stitch the consumer test to push result to pact brocker in swift

jks
2019-11-08 20:59
has joined #general

matt.fellows
2019-11-08 22:20
I would use the CLI tools from https://github.com/pact-foundation/pact-ruby-standalone/ to publish to the broker, or simply use API calls as described at https://docs.pact.io/pact_broker/publishing_and_retrieving_pacts

mpglover
2019-11-09 02:32
I've used the standalone pact broker with it a bit. Also been tentatively messing with building a native elixir library for it but haven't had a lot of time for that recently.

sliu7
2019-11-11 05:53
Hi! I'm trying to implement pact in .NET .. not sure if I've overlooked some basic info, but how can I configure the provider to verify all the contracts associated with it? I'm able to successfully verify it when I specifically mention the consumer name but couldn't figure out how to run it for all contracts. Thanks in advance!

abubics
2019-11-11 06:09
Hi :slightly_smiling_face: Try in #pact-net

bethskurrie
2019-11-11 09:23
@sliu7 it seems that this might not be available in pact-net yet.


felipe
2019-11-11 10:39
I ended up putting the pact verifier cli in a docker image and verifying from there

felipe
2019-11-11 10:39
Against a spinned up instance

jgfarias42
2019-11-11 13:23
has joined #general

acooper106
2019-11-11 13:39
Are there any examples of this?

ismael_rosas_sandoval
2019-11-11 14:43
has joined #general

rrosa171
2019-11-11 16:03
has joined #general

rrosa171
2019-11-11 16:14
Hello, I am having the most confusing Pact issue. I've two tests, locally they pass when run together, fail on their own. On the CI (GitLab) the first one always fails where the second one passes. After debugging them, it seems there is a "SocketTimeout" exception thrown when http client tries to make a GET request.

rrosa171
2019-11-11 16:15
I have run out of ideas, trying to solve it for the last two weeks. The tests were working perfectly fine until I edited some of the code in completely different part of the project.

felipe
2019-11-11 17:39
Sounds like wrong test data setup

rrosa171
2019-11-11 18:05
@felipe What can I do to check my setup?

rrosa171
2019-11-11 18:05
I can't really share the code, it's closed source

felipe
2019-11-11 18:05
It?s an app related thing. You have to check which data is missing

felipe
2019-11-11 18:05
And how your setup differs

felipe
2019-11-11 18:05
That?s what it sounds like

rrosa171
2019-11-11 18:06
I am not sure how to check it, to be perfectly honest,

rbhati
2019-11-11 18:20
Hi @matt.fellows, @bethskurrie Thanks for helping so far i think the last and final mystery pac<t> is webhook in pact Brocker. following are my success steps: 1. Setup pact broker: a. clone `git@github.com:DiUS/pact_broker-docker.git` to local b. run `docker-compose -f docker-compose.yml up` 2. Wrote a consumer side contract test in ios repo 3. Once test execute it post pact json to pact broker using CLI tool 4. Add webhook as : ``` { "consumer": { "name": "Brand App" }, "provider": { "name": "Hyperion" }, "request": { "method": "POST", "url": "https://<user>:<password>@jenkins.server.com/job/contract.test.pact/buildWithParameters", "headers": { "Accept": "application/json" } }, "events": [ { "name": "contract_content_changed" } ] } ``` Problem statement: I made change in consumer side and push new version of pact.json to pactbroker nothing happened Moreover I see no option to execute webhook to check if its really going to work as when a new version of pact push to broker

rbhati
2019-11-11 18:23
And when I click `No run' i get below page and I have no clue what to do next The goal is pretty simple use pact-broker to trigger job if there is change in pact json. Otherwise I have to replace pact broker with git git repository to achieve same goal

rbhati
2019-11-11 18:23
Please help @bethskurrie @matt.fellows ^^

rbhati
2019-11-11 19:51
After I click `http://localhost/webhooks/jwfoN13ZXNR6yaMJoQne6Q/execute` I get below error: ``` { "request": { "headers": { "accept-encoding": "gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "accept": "application/json", "user-agent": "Ruby" }, "url": "https://rbhati:11a228678b4ef47c016701a0edc455bce3@jenkins.server.com/job/contract.test.pact/buildWithParameters" }, "message": "For security purposes, the response details are not logged. To enable response logging, configure the webhook_host_whitelist property. See /doc/webhooks#whitelist for more information.", "logs": "[2019-11-11T19:47:43Z] INFO: HTTP/1.1 POST https://user:token@jenkins.server.com/job/contract.test.pact/buildWithParameters\n[2019-11-11T19:47:43Z] INFO: accept-encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\n[2019-11-11T19:47:43Z] INFO: accept: application/json\n[2019-11-11T19:47:43Z] INFO: user-agent: Ruby\n[2019-11-11T19:47:43Z] INFO: null\n[2019-11-11T19:47:43Z] ERROR: Error executing webhook jwfoN13ZXNR6yaMJoQne6Q. For security purposes, the response details are not logged. To enable response logging, configure the webhook_host_whitelist property. See /doc/webhooks#whitelist for more information.\n[2019-11-11T19:47:43Z] INFO: Webhook execution failed\n", "success": false } ```

rbhati
2019-11-11 19:57
i can trigger the same job with same command via postman


rbhati
2019-11-11 20:15
I tried it and I still missing direction

psychopomp3x
2019-11-11 20:27
has joined #general

rbhati
2019-11-11 20:30
i have no idea how to set the `webhook_host_whitelist`, am I supposed to overwrite `pact_brocker-docker/pact_broker/config.ru`

rbhati
2019-11-11 20:30
total lost in setting up webhook again

uglyog
2019-11-11 21:13
The issue above has a comment at the bottom for a fix for their http client. You?ll need to work out which client is being used.

matt.fellows
2019-11-11 21:26
Is there a valid certificate installed on your broker? You don't need to whitelist https URLs

matt.fellows
2019-11-11 21:28
Also, we are based in Australia and so we're all asleep a few hours ago - there is no need to constantly @ us

matt.fellows
2019-11-11 21:29
If the certificate is self signed then you'll need to ensure the certificate authority is properly configured otherwise your broker won't be able to initiate the outbound call

matt.fellows
2019-11-11 21:30
Also check the broker logs on case of anything helpful there

bethskurrie
2019-11-11 21:30
@rbhati The Pact Broker Docker README contains documentation on configuring the webhook whitelist https://github.com/pact-foundation/pact-broker-docker#webhook-whitelists

bethskurrie
2019-11-11 21:30
Please ask your questions in the relevant channel eg. #pact-broker

matt.fellows
2019-11-11 21:32
Which language are you using? Can you ask it in that channel so you get targeted help? Also, consumer or provider test?

bethskurrie
2019-11-11 21:33
There are other people who can help you who may be awake if you ask in the right place.

matt.fellows
2019-11-11 21:33
Either way, my suggestion is to create the simplest version that you can to reproduce the problem, and then sharing with the community here.

rbhati
2019-11-11 21:48
hey Beth are you saying I need to pass environment variable PACT_BROKER_WEBHOOK_SCHEME_WHITELIST as part of docker compose, because that actually where I'm lost how to set this

matt.fellows
2019-11-11 22:33
You?ll need to use an environment variable in your docker-compose setup to do that


sliu7
2019-11-11 22:36
Thanks! :slightly_smiling_face:

bethskurrie
2019-11-11 22:40
Look in the example docker-compose file. You'll see some existing environment variables. Put in the same place.

bethskurrie
2019-11-11 23:03
added an integration to this channel: https://pact-foundation.slack.com/services/BQE9MSRH6

2019-11-11 23:04
Yay! Unlimited knowledge is now at your finger tips! Use the `/gitbook [search query]` command to search through https://docs.pact.io/.

bethskurrie
2019-11-11 23:05
I've turned on the gitbook search plugin ^^. Probably best to try it out under your own user in Direct Messages.

felipe
2019-11-12 04:38
Its not about pact it?s about the software you are testing. You have to know it and check the logs

felipe
2019-11-12 10:05
Hi all! I?m using pact as Json and I wanted to know if it?s possible to transfer properties between interactions in one pact. Does anybody have any idea or experience with that?

bethskurrie
2019-11-12 10:12
Thanks Matt!

ingo.griebsch
2019-11-12 12:02
has joined #general

ingo.griebsch
2019-11-12 12:14
Hi all, we are just investigating PACT and want to use it for our CDC. The first thing we want to understand is if there is a complete documentation about the structure of a pact/interaction and what is necessary/possible to describe. We found https://github.com/pact-foundation/pact-specification and the description of the different versions but at a first glance it looks more like an overview instead of a detailed documentation of every aspect. We also had a look at the JSON schemas but it seems that only v1 and v2 are implemented at the moment. Therefore it would be really nice if someone could give us some hints and/or points us to the places we are currently searching for. :slightly_smiling_face:

roman.g.rodriguez
2019-11-12 12:37
has joined #general

fabio.iglesias
2019-11-12 13:44
has joined #general

bart.schotten
2019-11-12 14:27
No, I don't think that's possible. Interactions are meant to be completely independent.

bart.schotten
2019-11-12 14:30
The JSON schema for V3 is indeed missing, but another way to learn about the details of the specification is to look at the testcases: https://github.com/pact-foundation/pact-specification/tree/version-3/testcases

bart.schotten
2019-11-12 14:31
The question is if you really *need* to know that level of detail though, unless you are creating your own Pact library.

ingo.griebsch
2019-11-12 14:32
Maybe not, we probably first need to understand more how to work with PACT.

ingo.griebsch
2019-11-12 14:33
We are currently doing a API first approach which means that we are sitting together to define the necessary API together. This currently results in several groovy files for Spring Cloud Contract.

ingo.griebsch
2019-11-12 14:33
Now we want to switch to PACT but to keep the process.

ingo.griebsch
2019-11-12 14:33
Therefore we thought if we could write down the PACTs while talking about the API.

ingo.griebsch
2019-11-12 14:35
And that resulted in the question what we need to provide and what are the things we could provide. Spring Cloud Contract is explaining it's DSL in detail therefore you don't need a tool/test/whatever to create a contract. You only need a text-editor.

ingo.griebsch
2019-11-12 14:36
Another nice thing would be to have an editor/tool which allows to 'click together' the PACTs. Like http://editor.swagger.io/ for example. But we did not found any editor until now.

ingo.griebsch
2019-11-12 14:55
@bart.schotten Could I explain myself?

bart.schotten
2019-11-12 14:58
Yeah I think such an editor would not be a bad idea at all. Only problem is that Pact does not really have one DSL. Each library may have a different DSL to generate the contract, as long as the resulting artifact conforms to the spec.

ingo.griebsch
2019-11-12 15:02
But if I would use one of the libraries and put a UI on top I should be fine if I now what the library needs to generate the pacts.

bart.schotten
2019-11-12 15:03
Sure that would be theoretically possible

ingo.griebsch
2019-11-12 15:03
I hope not only theoretically :slightly_smiling_face:

ingo.griebsch
2019-11-12 15:03
But such thing is not available right now, correct?

ingo.griebsch
2019-11-12 15:04
So we still need to find a way how to define the interactions while discussing the cases... :thinking_face:

bart.schotten
2019-11-12 15:06
No as far as I know it's not available now.

fabio.iglesias
2019-11-12 15:55
Hello :slightly_smiling_face: I am learning with @ingo.griebsch about PACT and I was wondering about Pacts structure. Maybe somebody can clarify. Given that a Pact contains several interactions is a Pact sufficient to cover a whole API of a service? Is there any way of organising deeper whithin a Pact its interactions (for example under each endpoint criteria)? Or would it be convenient to use more than one Pact for a given pair of consumer/provider? Thank you in advance!

abubics
2019-11-12 22:58
@ingo.griebsch The workflow for Pact is consumer-driven, and the pact file is a side-effect or output of exercising the API client through running tests. This is why there's no editor for the pact file; it's only an artifact :slightly_smiling_face:

abubics
2019-11-12 23:00
The design is that one pact file should cover all functionality of a consumer-provider pair. As a consumer-driven contract, it should only cover the needs of a consumer, so it may not be exhaustive on API functionality.

dschwartz
2019-11-12 23:46
has joined #general

fabio.iglesias
2019-11-13 09:03
Thank you, this helps me getting a brighter picture of the concept

fabio.iglesias
2019-11-13 09:12
Then I understand that PACT is not suitable for any provider-driven approach, or would it also work from that perspective?

rlabok
2019-11-13 21:37
has joined #general

abubics
2019-11-13 23:33
the base philosophy is to avoid building things that no one is using, but

abubics
2019-11-13 23:34
you can still build the provider first . . . you just have to drive the functionality through a sample consumer, which has dubious value :slightly_smiling_face:

abubics
2019-11-13 23:34
I've done it that way plenty of times, and it does help, but it's still not as good as an irl consumer

neelofer.tamboli
2019-11-14 06:01
Hi. I was wondering if there was any progress or update on this? This is something we are quite interested in.

bethskurrie
2019-11-14 06:03
@neelofer.tamboli which part? We don't have a time frame for the OAS contract testing flow yet, as we're still gauging interest. There's a post on it here: https://blog.pactflow.io/the-curious-case-for-the-provider-driven-contract/

bethskurrie
2019-11-14 06:04
If you're interested, it would be great if you could fill out this survey here: https://dius.typeform.com/to/Dd66SC

bethskurrie
2019-11-14 06:04
There are no plans for any coverage tools at this stage.

neelofer.tamboli
2019-11-14 06:07
Ok, thank you for the update. Will look into it.

m.kwiecien
2019-11-14 09:58
has joined #general

m.kwiecien
2019-11-14 10:48
Hi All. I have problem with *nullValue* in *PactDslJsonBody* (). I get Request mismatch: [BodyMismatch(expected=null, actual=null, *mismatch=Expected null (JsonNull) to be the same type as null (JsonNull)* when I run test so the pact is not created. From logs I see that expected request looks exactly the same as received. I I use *pact-jvm-consumer-junit5* version 4.0.0 and RestTemplate from *spring* org.springframework:spring-web:5.2.0 Anyone had such problem or know how to resolve it?

iamjoemooney
2019-11-14 11:00
has joined #general

bustamcnasty
2019-11-14 15:41
has joined #general

stevi.deter
2019-11-14 15:59
Just to follow up, the e2e example helped me figure out what I was missing and now I can run my consumer verifications and publish results as part of the docker build just like I was hoping! Thanks!

uglyog
2019-11-14 20:50
Please raise an issue for that at the Github project

kiranpatel11
2019-11-14 23:08
How to generate Pact file without writing a test case? I am dealing with multiple monolith consumer systems which are not capable to write pact tests using pact libraries(e.g. SFDC, BPEL engines). We are considering writing the pact separately using one of the supported language(pact-jvm or pact-js) and use it to 1. spin up mock server for consumers. 2. verify provider implementation. Is anyone using PACT in this way successfully? How is the challenge of keeping tests and code in synch addressed ?

rbhati
2019-11-14 23:26
Guys I'm super excited to let you know that I got pact setup, 1. Consumer side write test in swift 2. Push json to Pact Broker 3. Webhook in pact Broker sense change trigger Jenkins Job <-- Broker authentication in Progress 4. Jenkins run provider test [pact verifier] over kubernetes push result back to Broker 5. Broker push notification to CI pipeline - stop/proceed with build . <-- Pending Wonder if you have any enhancement in this setup, what if provider make changes??

bethskurrie
2019-11-14 23:28
Awesome Ray. The pact verification should also be part of the provider's default build. If the provider changes, then the pacts get run as part of the provider's own build.


matt.fellows
2019-11-14 23:52
So http://docs.pact.io has a section on generating Pacts not from test cases. TL;DR you should avoid it-

matt.fellows
2019-11-14 23:53
One option might be to have a tool that can ?capture and replay? what your engines do, and convert those into pact files

matt.fellows
2019-11-14 23:53
but I would think hard before doing this, because it will be hard to use some of the more useful features like matchers and so on, which make the tests way less brittle

kiranpatel11
2019-11-15 00:27
Thanks Matt, I am considering to use PACT DSL to write PACT interactions, but I consider that is not tests, Tests are where we assert the consumer's code output using the mocks defined in pact. Think of it as 2 seperate repo - consumer tests, pact interactions. Thinking of integrating them and keeping in synch using some CI pipeline magic.

kiranpatel11
2019-11-15 00:28
It would be interested to see if anyone else has attempted such scenario and been successful with it

felipe
2019-11-15 05:35
We started with it a month ago like this: - central repo for all pacts where all devs write them in json by hand - provider ci pipeline spins up the application with test data and verifies the pacts with the Ruby cli

matt.fellows
2019-11-15 05:38
> - central repo for all pacts where all devs write them in json by hand Can you explain why you do this? This is almost certainly a bad idea

rbhati
2019-11-15 22:53
hi @bethskurrie I found this http://blog.pact.io/p/d7c9601f-e2ca-4208-b1c0-f02eaf96c3c2/ and wonder if there are any examples you can point to displaying the difference and how to use pending state

kiranpatel11
2019-11-17 23:57
@matt.fellows @bethskurrie Do you guys think it makes sense to generate pact file from something like Karate Tests https://github.com/intuit/karate ?

bethskurrie
2019-11-17 23:57
Yes

bethskurrie
2019-11-18 00:06
As long as they're tests for real consumer code.

bethskurrie
2019-11-18 02:16
Pact Broker users, I'm about to release pagination for the index page (finally!). If you have enough pacts on your index page that you'd appreciate pagination, can you tell me how many pacts you have total, and what default page size you think would be useful.

kiranpatel11
2019-11-18 03:43
I would prefer auto-scolling than pagination, with option of text search filter

kiranpatel11
2019-11-18 03:45
We do have ~250 pacts

bethskurrie
2019-11-18 04:11
It's taken me 6 years to get pagination :stuck_out_tongue:

bethskurrie
2019-11-18 04:12
You make a good point though.

bethskurrie
2019-11-18 04:13
At the moment, the UI is server side rendered, and I do not have the time or energy to re-write it to be client side rendered, hence, pagination was the simplest option.

kiranpatel11
2019-11-18 04:14
I would consider text search filter is more useful than pagination or auto-scrolling

kiranpatel11
2019-11-18 04:14
I believe its relatively easier to impl as well, don't you ?

bethskurrie
2019-11-18 04:15
yes

kiranpatel11
2019-11-18 04:15
may be a candidate for backlog item

bethskurrie
2019-11-18 04:15
I wish there was a "OSS feature prioritisation tool" where you could work out which things were the most important to the most people.

bethskurrie
2019-11-18 04:15
Linked to github issues.

kiranpatel11
2019-11-18 04:17
that's good backlog item for github :wink:

bethskurrie
2019-11-18 04:18
:laughing:

bethskurrie
2019-11-18 04:18
Can you pop the name filter feature in the issues?

bethskurrie
2019-11-18 04:18
Hopefully it won't take me another 6 years...

kiranpatel11
2019-11-18 04:19
sure

felipe
2019-11-18 05:26
@matt.fellows : I know is not the best idea but I decided it for two aspects: We have only one provider so I integrated the pacts in the integration tests. My team is very bad at writing tests and getting motivated about it. So I just gave them the pact spec and told them to write them. What is exactly a bad idea? What would you do different?

bethskurrie
2019-11-18 05:28
@rbhati it's in beta currently. If you're using pact-js you can contact Matt Fellows to be part of the user group that is testing it out.


kiranpatel11
2019-11-18 05:32
@felipe I see two issues with this 1. Writing tests are easy, but keep it maintained is hard, so if teams are not motivated enough they are not going to get a value out of PACT. 2. I would prefer team use PACT DSL instead of writing it from scratch. In the end, you will have to see if your are really detecting compatibility issues through PACT and cutting down on your need of integration tests.

matt.fellows
2019-11-18 05:33
Well said Kiran

felipe
2019-11-18 06:02
You are right. But maybe I explained too less of the context. We have 3 consumers (two frontend and one app) which have no automated tests at all and the the developers are not very experienced with it. I?m introducing automated tests slowly but they are not that good right now. They still complain about the backend team changing structures and not telling them. So in told them they should write the pacts and commit them to a central repo and the backend would take that repo and validate them. That?s the story behind it. Of course I would prefer them to have automated tests for all integrations and be able to generate and publish the pacts from there but they are just not experienced with automated tests and if I tell them to get into it and into pact, it would be the overkill...

felipe
2019-11-18 06:08
So it?s kind of a manual process but I think it will fulfill our need in the short term and later on we will generate the pacts when we have automated tests for the consumers

kiranpatel11
2019-11-18 06:34
@felipe The tests should be used to ensure 1. consumer is using the API correctly 2. provider is behaving as per consumer expectations. You can't do just one of these (by nature), you would still have high probability of integration issues, and that defeats the purpose

kiranpatel11
2019-11-18 06:37
In your case, it seems you are not doing #1, and #2 can be outdated anytime. Another point is - why write pact file from scratch without assertions on consumer side !!

felipe
2019-11-18 08:05
If the consumer devs write the pacts is because the are doing that based on the api they are using. That would cover one in a very unautomated way. And #2 can be outdated anytime yes. This is what we have with the time and experience we can invest in (!!!!)

bethskurrie
2019-11-18 08:10
Well, give it a go and let us know what value you get from it.

felipe
2019-11-18 08:12
That?s the plan. Whenever we start with automated tests we will most probably change it

marco
2019-11-18 08:59
has joined #general

iammrrhodes
2019-11-18 11:31
I've a general versioning question here... on my consumer pipeline, I am tagging the consumer with a git sha... and then on my provider, I am doing the same when verifying the, using the git sha for my provider version.... someone on my team has just ask me ... "should we be publishing the PACT files even if they have not changed on the consumer..." and I'm just reading the docs and looking at examples, and I'm slightly confused now, from what I read in the docs, it says the pact file has a version? but this is hidden?

bernardoguerr
2019-11-18 12:43
The versioning of the pact files is taken care of behind the scenes for you, and you don't need to care about it. You version your applications, and when you publish a pact for a specific application version, it will figure out if it is a new contract or not. So even if you have a CI step to publish on your consumer every time, you don't need to worry about figuring out whether something has changed or not. The Pact Broker will do that for you. Which means the "contract_changed" webhook (triggering a provider build) won't be run unless there was an actual change to the contract

antonello
2019-11-18 13:00
Could it be configurable?

squarism
2019-11-18 19:31
has joined #general

felipe
2019-11-18 20:51
Hi! I ve an elixir provider and want to validate Json pacts v3 against it. Which is the best way? The ruby cli supports only pacts v2 Thanks

rbhati
2019-11-18 21:52
@bethskurrie i need a suggestion, I had pactman_verifier [https://pypi.org/project/pactman/] to verify pact; And I wonder if I can achieve same goal of validating pact [available on pact-broker] via pact-python

bethskurrie
2019-11-18 22:07
@rbhati can you please ask in the relevant channel for the language and stop tagging me for every question? We're happy to help, but we do have limits. Firstly, I am not the maintainer of either of those libraries. Secondly, if the maintainers got tagged for every question, we'd never have time to do any work. We have a community of experienced Pact users who can answer your questions.

bethskurrie
2019-11-18 22:10
Not sure if there's a way yet.

bethskurrie
2019-11-18 22:11
You can verify them, but you won't get any unsupported matching rules.

bethskurrie
2019-11-18 22:12
We do have someone working on v3 support at the moment though.

rbhati
2019-11-18 22:14
got it, thanks for all your help :slightly_smiling_face:

matt.fellows
2019-11-18 22:28
Yep. So short answer: Always publish contract from CI, don?t worry about trying to detect if it has changed You probably want to read this if you haven?t already: https://docs.pact.io/best_practices/pact_nirvana

bethskurrie
2019-11-19 02:27
Yeah, easily. I'll probably add a drop down box for the size next to the pagination control.

bethskurrie
2019-11-19 02:58
@antonello I used your anonymize data set to ensure that the pagination code can handle the "view latest tags" index mode with a lot of data. With pages of 30 rows, your database has 643 pages :laughing:

bethskurrie
2019-11-19 03:03
@rbhati here is an example of the existing workflow compared to the new workflow with pending pacts.

kiranpatel11
2019-11-19 04:00
@bethskurrie Created https://github.com/pact-foundation/pact_broker/issues/318 Let me know if more details needed.

291636938
2019-11-19 06:13
has joined #general

291636938
2019-11-19 06:19
Hi @channel, I using version 3 of pact and is able to generate the pact json file and do the consumer test, but when I turn to run the provider test, it came out error with message "Exception: No tests found matching Method", I use the springboot 2.x , pact 3.6.0, and my demo project is located at https://github.com/wuhuanxing/pact_demo , Ive struggled it for few days, really hope some one can help me , Thank very much!

bethskurrie
2019-11-19 06:28
Thanks for putting together that demo @291636938. Try asking in the #pact-jvm channel.

291636938
2019-11-19 06:30
sorry for putting in the wrong place , thank you for mind~

felipe
2019-11-19 06:31
Hi all! im trying to verify pacts with the gradle plugin but im getting always a 400 bad request from nginx. From postman with https://myurl.com:443/service/path works perfectly. im out of ideas this is my gradle ```plugins { id "java" id "http://au.com.dius.pact" version "4.0.3" } task('getToken') { doLast { } } pact { serviceProviders { wmsBackend { protocol = 'https' host = 'http://myserviceurl.com' port = 443 path = '/' //insecure = true requestFilter = { req -> req.addHeader('Authorization', 'Bearer sometoken') } hasPactsWith('WmsFrontend') { pactFileLocation = file("$rootDir/../pacts/frontend") } hasPactsWith('Plentymarkets') { pactFileLocation = file("$rootDir/../pacts/plentymarkets") } } } reports { defaultReports() // adds the standard console output markdown // report in markdown format json // report in json format } } ```

felipe
2019-11-19 06:35
My pact makes a boring get: ```"request": { "headers": { "Authorization": "Bearer token", "Content-Type": "application/json" }, "method": "GET", "path": "/api/v1/entity/entty2/1", "body": {}```

bethskurrie
2019-11-19 06:36
Best to ask in #pact-jvm @felipe

matt.fellows
2019-11-19 07:03
Get with an empty body as an object

matt.fellows
2019-11-19 07:04
Is that intended?

felipe
2019-11-19 07:45
Will do. Thanks

felipe
2019-11-19 09:50
Hi all! im trying to use matchers but they are being ignored and my body is match to equality. Do you have any idea how to restrict that to the matchers? ```{ "consumer": { "name": "Get Warehouse" }, "provider": { "name": "wms" }, "interactions": [ { "description": "Get Warehouse", "request": { "headers": { "Authorization": "Bearer XXX", "Content-Type": "application/json" }, "method": "GET", "path": "/something/SOMEPATH/warehouses/" }, "response": { "status": 200, "body": { "total_results": 1, "warehouses": [ { "active": true, "city": "Berlin", "country": "Germany", "fax": "56270492786", "id": 1, "line1": "Test Address Line 1", "line2": "Test Address Line2", "name": "Test warehouse", "phone": "56270492786", "state": "Berlin", "tenant_id": 1, "zip_code": "7591538" } ] } }, "matchingRules": { "$.body.total_results": { "match": "type" }, "$.body.warehouses": { "min": 1, "match": "type" }, "$.body.warehouses[*].id": { "match": "type" }, "$.body.warehouses[*].city": { "match": "type" }, "$.body.warehouses[*].country": { "match": "type" }, "$.body.warehouses[*].fax": { "match": "type" }, "$.body.warehouses[*].line1": { "match": "type" }, "$.body.warehouses[*].line2": { "match": "type" }, "$.body.warehouses[*].name": { "match": "type" }, "$.body.warehouses[*].phone": { "match": "type" }, "$.body.warehouses[*].state": { "match": "type" }, "$.body.warehouses[*].tenant_id": { "match": "type" }, "$.body.warehouses[*].zip_code": { "match": "type" } } } ], "metadata": { "pactSpecification": { "version": "4.0.0" }, "pact-jvm": { "version": "4.0.3" } } }```

felipe
2019-11-19 09:50
it says: Failures: 0) Verifying a pact between Get Warehouse and wmsBackend - Get Warehouse returns a response which has a matching body Verifying a pact between Get Warehouse and wmsBackend - Get Warehouse returns a response which has a matching body=BodyComparisonResult(mismatches={$.total_results=[BodyMismatch(expected=1, actual=6, mismatch=Expected 1 but received 6, but im clearly matching it to type

bethskurrie
2019-11-19 09:51
For the verification?

bethskurrie
2019-11-19 09:51
Only JVM supports v4 on provider.

felipe
2019-11-19 09:51
im using JVM

bethskurrie
2019-11-19 09:51
Hm, should work then!

felipe
2019-11-19 09:51
id "http://au.com.dius.pact" version "4.0.3"

bethskurrie
2019-11-19 09:52
If you can create a reproducible code example, you can raise an issue in pact JVM repo.


bethskurrie
2019-11-19 09:53
Also, best to ask questions related to pact JVM in the #pact-jvm channel

felipe
2019-11-19 09:53
the matchers are there to avoid the hard coded data in the response the right? (asking for a friend)

bethskurrie
2019-11-19 09:53
We try to keep the general channel for cross cutting concerns.


bethskurrie
2019-11-19 09:54
The matchers stop the tests being brittle.

felipe
2019-11-19 09:54
cool thanks

bethskurrie
2019-11-19 09:54
We don't generally really care about specifics, just that the shape of the doc matches.

felipe
2019-11-19 09:55
can I add matchers to objects and it would macth everything in there or I have to match every single attribute?

bethskurrie
2019-11-19 10:00
You should just have to put the matcher on the parent, and all children inherit it

felipe
2019-11-19 10:01
in all versions?

bethskurrie
2019-11-19 10:01
Yes

bethskurrie
2019-11-19 10:01
Unless @uglyog has changed anything in v4

ncritah
2019-11-19 10:26
has joined #general

felipe
2019-11-19 11:45
is there any way to combine matchers in json? i want to make null or type

felipe
2019-11-19 11:45
i cannot find anything in the specification

matt.fellows
2019-11-19 11:50
that?s because it?s explicitly not allowed



bart.schotten
2019-11-19 11:56
But I agree that it should definitely not be used in that way

matt.fellows
2019-11-19 12:02
I think @bethskurrie had something to say about this. But yes

ncritah
2019-11-19 14:49
Trying to use pact with Karma and Mocha but without much success. I have updated my karma conf to match the example shown and the rest of my code is as shown below ```*====client.js====* const validate = (host) => { const { url, port } = host; return axios .request({ method: 'GET', baseURL: `${url}:${port}`, url: `/test/111`, headers: { Accept: 'application/json' }, }); }; *====test.js====* describe('Pacting away', () => { let provider; const port = 1331; before(done => { provider = new PactWeb({ consumer: 'KarmaMochaConsumer', provider: 'KarmaMochaProvider', port: port, host: 'http://localhost', }); setTimeout(done, 1000); provider.removeInteractions(); }); after(done => provider.finalize().then(() => done())); describe('', () => { before(done => { provider .addInteraction({ state: 'provider can validate entries', uponReceiving: 'a request to validate 111', withRequest: { method: 'GET', path: '/test/111', headers: { 'Content-Type': 'application/json', }, }, willRespondWith: { status: 200, headers: { 'Content-Type': 'application/json', }, body: { message:"Success" }, }, }) .then(() => { done(); }); }); it('should return 200 for 111', done => { validate({url: 'http://localhost', port: port}).then(response => { expect(response.status).to.equal(200); done(); }, done); }); }); });``` When I run the tests, it hangs after this log > `INFO [pact]: Pact Mock Server running on port: 1331` and when I manually try to access the endpoint in my terminal using curl, I get `{"message":"No interaction found for GET /test/111","interaction_diffs":[]}`

uglyog
2019-11-19 20:50
There is no V4 version (yet). How did that pact file get created?

uglyog
2019-11-19 20:52
The matching rules are in the incorrect format. That file will be treated as a V3 pact file, but the matching rules look like they are in the V2 format.

bethskurrie
2019-11-19 21:28
@ncritah can you ask in the pact-js channel please?

bethskurrie
2019-11-19 21:29
Usually when we see issues like that it's a timing issue with promises and callbacks.

bethskurrie
2019-11-19 21:29
I'm not a js expert though.

bethskurrie
2019-11-19 21:31
That snuck in while I was on mat leave, and it has been regreted @bart.schotten!

bethskurrie
2019-11-19 21:31
@felipe is this one of your handcoded ones?

bethskurrie
2019-11-19 21:32
I think it would be easier to write a fake pact test in Java than hand code it.

ncritah
2019-11-19 21:35
I just found `pact-js` a couple of minutes back and posted there but couldn't delete this

bethskurrie
2019-11-19 21:56
Please don't do it @felipe. If you can't control the data during provider verification, then contract testing isn't the right tool for you.

bethskurrie
2019-11-19 21:56
If you don't know if the element should be there, then leave it out of the expectations.

bethskurrie
2019-11-19 21:57
Thanks for the good answer @bernardoguerr!

bethskurrie
2019-11-19 21:58
@iammrrhodes which bit of the docs is unclear, and what could we do to make it clearer?

iammrrhodes
2019-11-19 22:02
Hey Beth, I'm not sure if I'm just struggling to figure out how the documentation fits to my use case... I'm being told by someone in my organisation how we _should_ be doing it, but I'm then trying to validate their instructions with actual PACT documentation... so I don't think it's a failing of documentation, maybe just my internal contradictions.

iammrrhodes
2019-11-19 22:04
I've spent the evening watching all the things I can find on PACT, but no one seems to go into detail on versioning and environment tags (which is what we're being told to do)

iammrrhodes
2019-11-19 22:04
and thankyou for the responses everyone, I'm very grateful.

bethskurrie
2019-11-19 22:17
There's a good page on it in the docs.

iammrrhodes
2019-11-19 22:17
I've read it several times.

bethskurrie
2019-11-19 22:18
Let us know, or submit a PR, if you can add some clarity.

iammrrhodes
2019-11-19 22:19
I need to get my head around it first, I need to figure out if what I'm being told to do is right or not in my current team...

matt.fellows
2019-11-20 02:33
> what I?m being told to do is right or not in my current team... What are you being told? If it would be useful, we?d be happy to help with any thinking for those who ar esuggesting it

ft1704602
2019-11-20 04:02
has joined #general

ft1704602
2019-11-20 04:18
Hi, I?ve just found out Pact CDC tests. It?s very interesting. I would like to know if my publisher api involves another external public api, is it still appropriate to use pact for testing? The basic flow is: consumer<->publisher<->externalApi.

tjones
2019-11-20 04:20
Yes, you have two choices: 1. you can describe the pact as consumer -> external API (essentially treating the publisher as part of the consumer)

tjones
2019-11-20 04:21
2. You can have two pacts, one from consumer -> publisher, and one from publisher -> externalAPI

tjones
2019-11-20 04:21
I think option 2 is probably best, but it depends on the relationship between the consumer and the publisher

tjones
2019-11-20 04:22
During provider testing for your publisher , you would mock out the externalAPI

tjones
2019-11-20 04:22
(probably by mocking the code that calls it)

ft1704602
2019-11-20 04:24
So every time the consumer modify the pact, I might need to modify the external api mock response ? It seems very bad for maintainability.


bethskurrie
2019-11-20 04:25
If you use type based matching, it shouldn't be.

bethskurrie
2019-11-20 04:26
Compare it to your other option - e2e integration tests.

bethskurrie
2019-11-20 04:28
Remember, you should only really need one or two interactions per endpoint.

tjones
2019-11-20 04:36
You're not mocking the external API responses

tjones
2019-11-20 04:36
you're mocking the code that calls the external API from within the publisher codebase

tjones
2019-11-20 04:37
This is the same pattern as would be used if your publisher (say) wrote to a database

ft1704602
2019-11-20 04:37
for example: the consumer sends 1, the provider uses an external api mock to get external response ?one?, then append 1 to one and return one1. If in the next pact somehow the input becomes 2, i have to modify the mock to return two, right? I want to know this because the external api returns a very complex object, so I don?t want to modify the mock often.

ft1704602
2019-11-20 04:39
@tjones but my publisher api have to interact with external api response to generate the response.

bethskurrie
2019-11-20 04:59
@ft1704602 have a read of this, and the gist that it links to


bernardoguerr
2019-11-20 12:14
Can I ask what exactly do you mean by environment tags? Careful about tagging with environments, I ran into that trap before. To me tagging should be more about differentiating production vs non production, not necessarily tagging with environments like dev, test, etc.

roi.otero.morales
2019-11-21 13:56
Hello everyone! is there a way to not fail `pactPublish` when there is no folder containing pacts? (I want to run pactPublish even if the Repo doesnt have consumers and only providers to have a standarized pipeline) `Execution failed for task ':pactPublish'.` > `http://java.io``.FileNotFoundException: /<somepath>/build/pacts`

vitaliy.grigoruk
2019-11-21 14:26
why don?t you wrap it yourself with a check if files/folder is there?

vitaliy.grigoruk
2019-11-21 14:27
in most of use-cases people would like to be aware if they try to publish pacts that do not exist?

roi.otero.morales
2019-11-21 14:45
Hey, thanks for the answer, I will try to wrap it, the thing is that the pactPublish task comes from the pact puglin, and not from a task defined in my file, so i am having troubles adding the condition to only be run if folder exists. my gradle skills are not the best if you have any suggestion is welcome :smile:


brendan.j.donegan
2019-11-21 16:00
has joined #general

vijay.chinthala
2019-11-21 18:46
has joined #general

vijay.chinthala
2019-11-21 19:03
Hi, I am facing Authorization error while executing pactVerify, the API expect the Authorization Bear token in the header; can someone please help pointing me to some example how to pass the Authorization

vijay.chinthala
2019-11-21 19:07
```10:28:28.630 [DEBUG] [http://au.com.dius.pact.provider.ProviderClient] Response: {statusCode=401, headers={X-Content-Type-Options=[nosniff], X-XSS-Protection=[1; mode=block], Cache-Control=[no-cache, no-store, max-age=0, must-revalidate], Pragma=[no-cache], Expires=[0], Content-Length=[52], Date=[Thu, 21 Nov 2019 18:28:27 GMT]}, contentType=application/json; charset=UTF-8, data={"message":"Null or Empty Authorization","code":401}}```

pavel.azarau
2019-11-21 19:10
has joined #general

vijay.chinthala
2019-11-21 19:12
@felipe I see you have used Authorization in the header, can you please help with some example code how did you generate the token, I had issues with Authorization while executing pactVerify

vijay.chinthala
2019-11-21 19:12
```10:28:28.630 [DEBUG] [http://au.com.dius.pact.provider.ProviderClient] Response: {statusCode=401, headers={X-Content-Type-Options=[nosniff], X-XSS-Protection=[1; mode=block], Cache-Control=[no-cache, no-store, max-age=0, must-revalidate], Pragma=[no-cache], Expires=[0], Content-Length=[52], Date=[Thu, 21 Nov 2019 18:28:27 GMT]}, contentType=application/json; charset=UTF-8, data={"message":"Null or Empty Authorization","code":401}}```

noel.chin
2019-11-21 19:37
has joined #general


vijay.chinthala
2019-11-21 20:24
Thank you for this information

vijay.chinthala
2019-11-21 20:24
I am using gradle and Junit5, is there an example that I could use in gradle

felipe
2019-11-21 21:08
Remind me tomorrow please

noel.chin
2019-11-21 21:30
Is anyone currently stubbing the response from an external auth api instead of modifying the auth token present in the PACT file?

bethskurrie
2019-11-21 21:53
That's the way I would do it, personally

bethskurrie
2019-11-21 21:54
Much easier. And token is usage is unlikely to get much benefit from contract testing.

bethskurrie
2019-11-21 21:55
It's functionality that's unlikely to change, and will be quickly picked up by higher level tests if it's wrong.

bethskurrie
2019-11-21 21:56
@vijay.chinthala consider if it would be easier to stub out the auth.

bethskurrie
2019-11-21 21:57
It's often something that doesn't benefit much from contract testing, as it's generally pretty stable, doesn't change much, and is often hard to provide valid values when verifying.

bethskurrie
2019-11-21 21:57
It's also something that will get picked up pretty easily and quickly in e2e tests.

bethskurrie
2019-11-21 21:59
Really? What problems did you have with tagging all the envs @bernardoguerr? It's the way I would do it.

vijay.chinthala
2019-11-21 22:04
Thanks Beth

vijay.chinthala
2019-11-21 22:04
I have tried this in my gradle file and it worked..

vijay.chinthala
2019-11-21 22:04
``` hasPactWith('learningService') { pactFile = file('build/pacts/learningServiceClient-learningServiceProvider.json') // stateChangeUrl = new URI(PACT_BROKER_URL + '/v1/pactstates').toURL() // stateChangeUsesBody = true requestFilter = { req -> // Add an authorization header to each request // because of our system needs login first req.addHeader('Authorization', 'Bearer ' + System.getProperty('PACT_BROKER_TOKEN') ) } }```

vijay.chinthala
2019-11-21 22:06
I have used requestFilter in the gradle script and it worked fine

vijay.chinthala
2019-11-21 22:06
```hasPactWith('learningService') { pactFile = file('build/pacts/learningServiceClient-learningServiceProvider.json') // stateChangeUrl = new URI(PACT_BROKER_URL + '/v1/pactstates').toURL() // stateChangeUsesBody = true requestFilter = { req -> // Add an authorization header to each request // because of our system needs login first req.addHeader('Authorization', 'Bearer ' + System.getProperty('PACT_BROKER_TOKEN') ) }``` }

vijay.chinthala
2019-11-21 22:06
Thanks for your help

bethskurrie
2019-11-21 22:10
That confuses me. Why would the request have the pact broker token added to it?

bethskurrie
2019-11-21 22:10
The replayed request goes to the provider, not the pact broker

vijay.chinthala
2019-11-21 22:19
yes that is correct I have script included in the serviceProviders { } just for testing purpose I am using the local pactFile to test pactVErify

vijay.chinthala
2019-11-21 22:21
and please ignore the naming conversion, it should be named as PACT_SERVICE_PROVIDER_TOKEN

matt.fellows
2019-11-21 22:35
Request filter is probably the way to go

crummynz
2019-11-21 23:36
has joined #general

roi.otero.morales
2019-11-22 09:57
Thanks for your help, finally i end up doing this: ```task pactPublishIfProducedPacts(description: 'Wrapper to only execute the pactPublish task if the repository contains consumers', group: 'Verification') { if (new File("$buildDir/pacts").exists()) { dependsOn pactPublish } }```

roi.otero.morales
2019-11-22 09:57
Not pretty but works?

noel.chin
2019-11-22 13:15
yeah that's what I was thinking as well. Are you using a library like nock to stub the requests?

bernardoguerr
2019-11-22 15:07
@beth: In our case, in the beginning there was a lot of focus on running this on each environment (dev, test, stage, prod). In reality, all we really need, in my opinion, is a distinction between what's in production, and what's in master. Because as far as I understand it, in the end what matters more is what version of code (commit sha) you're testing against, not in which environment (except whether it's in prod or not). Especially if you're testing against local (undeployed) versions of the API's, which I think is ideal. I think environments would only matter if you were testing against deployed versions of the API's. But if you're going for a CI/CD model, then that version of code (commit) should be being promoted through environments, and then in one of those, you would run your Pact tests (even if it was against a deployed version), and then promote it to the next stage. If you're testing it with Pact against each deployed environment, imo you're not really using it just for contract testing, but more like a rather expensive backend system-wide test. Anyway that was the final understanding I've reached of it now. So, TLDR: versioning for identifying *what* piece of code is running, tagging for identifying *where* it is running (*ie prod vs non-prod, potentially branches too)* Do you think that's wrong, Beth?

dschwartz
2019-11-22 16:47
I've read from several sources that CDC testing is not recommended for public apis - what about APIs which have both internal and external consumers - does supporting contracts for internal consumers create difficulty in managing the public API overall?

felipe
2019-11-22 17:44
you have to make sure that you dont have the authorization header in you pacts

felipe
2019-11-22 17:44
that was making trouble with mine

felipe
2019-11-22 17:46
`plugins {` id "java" id "`http://au.com``.dius.pact" version "4.0.3"` } import groovy.json.JsonSlurper def protocolInput = 'https' def hostInput = '`http://some.url.com``'` def portInput = 443 def token = "none" def getToken(username, password, protocol, host, port){ println "generating token" def BODY='{"grant_type": "password","username" : "'+username+'","password" : "'+password+'","scope" : "default"}' def p = ['curl', "-X", "POST", '-H', "Accept: application/json", "-H", "Content-Type:application/json", '--data', BODY, "$protocol://$host:$port/xxx/xxx/auth"].execute() p.waitFor() def json = new JsonSlurper().parseText(p.text) println "got token ${json.access_token}" return json.access_token } task('setup') { doLast { println "#######setup#######" delete fileTree('build/reports') { include '**/*.*' } def protocol = getOrDefault('PROTOCOL', protocolInput) def host = getOrDefault('HOST', hostInput) def port = getOrDefault('PORT', portInput) token = getToken('xxx', 'xxx', protocol, host, port) println "######setup done#####" } } pact { serviceProviders { wmsBackend { protocol = getOrDefault('PROTOCOL', protocolInput) host = getOrDefault('HOST', hostInput) port = getOrDefault('PORT', portInput) path = '/' startProviderTask = setup insecure = true requestFilter = { req -> println req req.addHeader('Authorization', "Bearer $token") } hasPactsWith('WmsFrontend') { pactFileLocation = file("$rootDir/../pacts/frontend") } } } reports { defaultReports() // adds the standard console output markdown // report in markdown format json // report in json format } } def getOrDefault(name, defaultValue){ return project.hasProperty(name) ? project.getProperties().get(name) : defaultValue; }

felipe
2019-11-22 17:46
thats my gradle

justaburneremailforso
2019-11-22 18:43
has joined #general

justaburneremailforso
2019-11-22 18:44
We are starting to use PACT in our team but are running into a strange issue. When we run mvn pact:verify we are getting this error:

justaburneremailforso
2019-11-22 18:46
"Request failed - Connect to localhost:8080 failed: localhost 127.0.0.1 failed: Connection refused connect:"

justaburneremailforso
2019-11-22 18:48
However when we run mvn clean test, the test passes. I don't know why this is happening as we are not using localhost:8080 anywhere in our consumer or provider code or anywhere in our pom. We suspect it's coming from the maven pact provider dependency in the pom but that is a bit of a guess. The application is not a spring boot application either. Any idea where we are going wrong?

bethskurrie
2019-11-22 19:36
@bernardoguerr whatever works for you! Just want to make sure I understand your workflow. So, you re-run the verification step before deploying to each stage? How do you know which version of the pact is in which environment?

uglyog
2019-11-23 00:27
`mvn pact:verify` is for verifying a runner provider. localhost:8080 is the default host and port for that. If you are using unit tests, you don't need to run that.

felipe
2019-11-23 05:12
Hi all! I?m Using the gradle verifier and I would like to know if there is any way to integrate the reports into Jenkins (pipeline). Thanks in advance

justaburneremailforso
2019-11-23 10:49
Is there a way to pass authentication details with a mvn clean install to the broker? We have switched on authentication on our broker so need to pass credentials in order to publish or verify the contracts. So far I haven't found the combination of arguments and pom changes to allow mvn clean test to update the verification status on a broker with authentication turned on.


justaburneremailforso
2019-11-24 23:25
Thanks!

justaburneremailforso
2019-11-24 23:27
Hello all, More of a general question, but what is the normal use case for using mvn pact:verify versus just a mvn clean test? Both will update the broker if configured correctly but I'm not sure why to use one over the other. Our tests are mostly annotated with @State on the provider side but seem to run the consumer side tests.

abubics
2019-11-25 00:18
no, if you have a consumer you're in control of, contract tests can help, and shouldn't cause any conflicts with external consumers :thumbsup:

abubics
2019-11-25 00:19
but it might highlight changes earlier . . . so you might end up wanting to make breaking changes sooner than your external consumers

pradeep.murthy
2019-11-25 07:22
has joined #general

pradeep.murthy
2019-11-25 07:29
Hi, All, we are in the process of using PACT within our projects. We really find PACT to be useful. However we have a general question as to whether the PACT is really being used by others at all in different companies, as the usage stats show as 0 here https://mvnrepository.com/artifact/au.com.dius/pact-jvm-consumer-junit

brendan.j.donegan
2019-11-25 09:46
Hi - I have a particular interaction that I'm a bit unsure how to deal with - basically the provider is returning as part of a the response, an 'dictionary' (slash object) of users, keyed by their ID. The number of users can vary so I want to be able to write the contract in such a way that it doesn't matter how many are returned. This essentially amounts to an object with a variable number of keys. Is there a good way to express this using matchers?

bart.schotten
2019-11-25 14:18
That will just work by default. Extra keys/properties are always allowed. You just need to have one or two keys as an example, which you could set up in the provider state.

john.hamlett
2019-11-25 14:28
has joined #general

ryan.dens
2019-11-25 14:41
For what its worth, my company uses the pact-jvm-consumer-junit, so it seems like those stats aren?t accurate

paul.simms
2019-11-25 16:20
has joined #general

paul.simms
2019-11-25 16:22
Good afternoon, We are implementing PACT consumer driven contract tests which is working well between the back-end services. We have micro-services with the following architecture: web-ui <-> graphQL <-> n * back-end services However there are questions on how to implement this through the graphQL layer. In reality this is a consumer of the back-end services, and a provider to the web-ui. As the consumer, GraphQL doesn't have the domain information for the actual required json that is initiated from the web-ui service. Then the web-ui service doesn't test against the back-end providers (as the graphQL layer is its provider) - and it hasn't got that association / knowledge of the back-end services. Is it that graphQL should create a PACT interaction with each back-end provider containing all its potential values with each service. Then this demonstrates that those interfaces remain compliant. Thus the real request (interaction) from the user (web-ui) has pacts with the GraphQL service (with mocks of the back-end services), so implicitly would work all the way through the stack. Has anyone got advice of how this works across this aggregation layer?

ryan.dens
2019-11-25 16:29
also worth noting that we proxy maven central via our own internal maven repository. I imagine many enterprises which use these tools are in similar situations, so these statistics can?t always be accurate. Makes sense that most ?hobby? projects wouldn?t need consumer driven contract testing

dtobiasalmont09
2019-11-25 17:21
has joined #general

dtobiasalmont09
2019-11-25 17:22
I am working with Pact Node and was trying to find a way to verify the consumer tests without having to publish to the shared broker. Not seeing good examples of this so we can add it to a jenkins pipeline

megha.agrawal
2019-11-25 19:10
has joined #general

vijay.chinthala
2019-11-25 23:38
Thank you Felipe, I got the same idea and except that I got the token generated in the java code and used the same in the pct script

bethskurrie
2019-11-26 01:29
Pact top tip: Ron and I have just come back from a chat with a Pact user (we'll call him "Dave") who ended up pulling out his Pact tests because they were too painful. The reason their Pact tests were painful was that Dave was using them for UI tests. Don't be like Dave! Use Pact to test the "back door" of your consumer, and keep your pact tests fast, maintainable, and easy to debug.


ambergkim
2019-11-26 05:26
has joined #general

vijay.chinthala
2019-11-26 08:38
I have another question what is the best practice to promote the pact tests, let's say I am making changes in the feature branch and I wanted promote to DEV, QA, INT, STG the nPRG

vijay.chinthala
2019-11-26 08:39
can this be managed through tags, or does it required different pact broker environment needed?

bethskurrie
2019-11-26 08:55
Tags

bethskurrie
2019-11-26 08:55
As each version gets promoted through the environments, you tag the application version resource in the broker with the name of the environment.

bethskurrie
2019-11-26 08:56
This is what allows you to use the `can-I-deploy - -to ENV` command

johnny.nilsson83
2019-11-26 09:23
has joined #general

matt.fellows
2019-11-26 09:42
Wow. That page really drills home the point!

bethskurrie
2019-11-26 09:47
@matt.fellows it may be overkill now!

bethskurrie
2019-11-26 09:48
I wanted to put the word "UI" in a top level heading so it was more prominent. But then it's basically 3 points saying the same thing.

bethskurrie
2019-11-26 09:48
I'll try and condence it at some point.

bethskurrie
2019-11-26 09:53
Seamus has found that not many people read the best practices page though.

matt.fellows
2019-11-26 10:03
Yeah. Perhaps we need a bit to remind people who've been here for > x weeks :laughing:

me1352
2019-11-26 12:47
has joined #general

resapu021
2019-11-26 13:41
has joined #general

megha.agrawal
2019-11-26 18:33
Hi I am able to successfully run the provider tests when the pact file is stored locally but getting 401 error when the pact file is store in pact broker. I am using python. Here is the command I am using ```pact-verifier --pact-url="http://your-pact-broker/pacts/provider/PROVIDER/consumer/CONSUMER/latest" --custom-provider-header='Authorization: Bearer mytoken' --provider-base-url="http://localhost:8080"``` Where am I doing wrong?

justaburneremailforso
2019-11-26 19:22
I actually have another question. You said mvn pact verify is for verifying a runner provider. What does that mean? Does it mean it expects to be run against something that is already up and running beforehand? For example does it expect some sort of mocked or real service or something to already be running on localhost:8080 before running mvn pact verify?

prabha_kannusamy2
2019-11-26 19:39
has joined #general

uglyog
2019-11-26 20:56
It?s for when you have the spring boot app running first, and then verify against that

vijay.chinthala
2019-11-26 22:22
returns a response which has status code 200 (OK) has a matching body (OK) Skipping publishing of verification results as it has been disabled (pact.verifier.publishResults is not 'true') BUILD SUCCESSFUL in 31s 8 actionable tasks: 3 executed, 5 up-to-date

vijay.chinthala
2019-11-26 22:22
I am always getting this Skipping publishing of verification results

bethskurrie
2019-11-26 22:23
Well, have you configured it to publish the results?

vijay.chinthala
2019-11-26 22:23
setting this System.setProperty("pact.verifier.publishResults", 'true') but no luck

vijay.chinthala
2019-11-26 22:23
hi Beth, yes

bethskurrie
2019-11-26 22:24
Sorry, I don't know how the pact js api works.

bethskurrie
2019-11-26 22:24
I didn't think it was a system property though

bethskurrie
2019-11-26 22:24
I thought it was a property in the verification configuration.


bethskurrie
2019-11-26 22:27
Best to ask in the pact python channel

bethskurrie
2019-11-26 22:27
The custom auth header is not for the broker though

bethskurrie
2019-11-26 22:27
That's for the provider.

bethskurrie
2019-11-26 22:28
You need to use --broker-token

megha.agrawal
2019-11-26 22:29
ok. Thanks. I will try that

bethskurrie
2019-11-26 22:29
Also, are you using that exact url?

bethskurrie
2019-11-26 22:29
You need to put your own consumer and provider in

megha.agrawal
2019-11-26 22:29
I did

vijay.chinthala
2019-11-26 22:29
I am using gradle and I have set the System property like advised in the forums

vijay.chinthala
2019-11-26 22:29
do I need to use Pact JS?

bethskurrie
2019-11-26 22:30
The verifier should allow you to give it the broker url and the provider name and just give you the pacts automatically.

bethskurrie
2019-11-26 22:30
If it doesn't, I'll raise an issue


bethskurrie
2019-11-26 22:30
Can you remove that preview?

bethskurrie
2019-11-26 22:31
I can't follow the conversation on mobile

megha.agrawal
2019-11-26 22:31
I am getting error when using --broker-token

megha.agrawal
2019-11-26 22:31
Error: no such option: ---broker-token

bethskurrie
2019-11-26 22:31
Oh, you're using pact JVM

vijay.chinthala
2019-11-26 22:31
yes

bethskurrie
2019-11-26 22:31
Ask in the pact JVM channel then.

bethskurrie
2019-11-26 22:31
Also, make sure you're using the latest version.

bethskurrie
2019-11-26 22:32
The provider tag publishing is only available in the latest version.

megha.agrawal
2019-11-26 22:32
```pact-verifier --pact-url="http://your-pact-broker/pacts/provider/PROVIDER/consumer/CONSUMER/latest" --broker-token='mytoken' --provider-base-url="http://localhost:8080"```

megha.agrawal
2019-11-26 22:32
I tried this

bethskurrie
2019-11-26 22:32
OK, its out of date.

bethskurrie
2019-11-26 22:33
I'll raise an issue

megha.agrawal
2019-11-26 22:33
thanks

megha.agrawal
2019-11-26 22:35
How will I know when this issue is fixed?

bethskurrie
2019-11-26 22:35
Follow the issue on github

ben.quinteros
2019-11-26 22:35
has joined #general

bethskurrie
2019-11-26 22:35
i'll post the link in a minute

megha.agrawal
2019-11-26 22:36
thanks


megha.agrawal
2019-11-26 22:44
Thanks Beth.


vijay.chinthala
2019-11-26 22:49
I see

vijay.chinthala
2019-11-26 22:50
I think here I need to access the correct URL of pact from broker and can set the version

vijay.chinthala
2019-11-26 22:50
I could set the version for consumer pactPublish

megha.agrawal
2019-11-26 22:51
:+1:

niciqy
2019-11-27 02:54
has joined #general

niciqy
2019-11-27 02:56
Does anyone has got experience with Pact and graphQL?

johnny.nilsson83
2019-11-27 08:02
Is there any, good, video that describes Pact, how to use it, and how to get started?

artemabezruchko
2019-11-27 08:58
has joined #general


viktor.justo449
2019-11-27 09:46
has joined #general

matt.fellows
2019-11-27 09:54
There's a few listed on the docs site too. It's probably not up to date with the very most recent tho

matt.fellows
2019-11-27 09:55
@hstene did a talk last year at NDC which was quite food

matt.fellows
2019-11-27 09:55
And @bethskurrie did one at YOW in Australia. Both worth a watch

justaburneremailforso
2019-11-27 17:03
Ok, thanks, that clears things up. Is there a way to change the default from localhost:8080 to something else?

timothy.proffitt
2019-11-27 17:05
has joined #general

timothy.proffitt
2019-11-27 17:08
hi @matt.fellows - were those talks recorded and are they available to watch?




matt.fellows
2019-11-27 21:20
:point_up:

matt.fellows
2019-11-27 21:21
you ask and it shall be - @yousafn!

timothy.proffitt
2019-11-27 21:21
thanks @yousafn

lenient315
2019-11-28 03:46
has joined #general

hstene
2019-11-28 06:28
You are too kind, Matt! :slightly_smiling_face:

johnny.nilsson83
2019-11-28 07:47
Hi, Our biggest issue is that the data we test on is consumed. "Accept an offer once, and the offer is gone" type of data. Is there a way to setup mock responses in Pact from some kind of gui outside of the applications making it possible to manually browse a webpage based on the mocked responses from the pact server?

fariasporras
2019-11-28 08:14
has joined #general

fariasporras
2019-11-28 08:18
Hello everyone, I have a question for you. It is possible to load pact files from a HTTPS URL using pact stub server in a docker container? Thanks in advance

fariasporras
2019-11-28 10:46
Hello again, Someone knows, why with pact-stub-server matchingRules it works, but with pact-stub-client marchingRules it doesn't work!

fariasporras
2019-11-28 11:04
WARN: Ignoring unsupported matching rules

matt.fellows
2019-11-28 11:06
Oh, and when I said "food"... I obviously meant burger :laughing:

uglyog
2019-11-28 11:19
pact-stub-client only supports V2 Pact spec, while pact-stub-server supports V3

fariasporras
2019-11-28 11:38
I create the pact-file using unit test and creating rules with PactDslJsonBody. How can i use v2 with PactDslJsonBody or how create a pact with V2 specs through unit test in JAVA?

fariasporras
2019-11-28 11:53
Basically, my problem is that I have to load my pact file with https and ssl. So with pact-stub-server i can't deploy in https with ssl cert and ssl key and I try to use pact-stub-client, but my pact file has V3 Pact specs. Thanks in advance

alexjjseppala
2019-11-28 19:16
has joined #general

uglyog
2019-11-28 21:01
What are you using to create the pact file? If you?re using the pact-jvm DSLs then you can provide the specification version.

uglyog
2019-11-28 21:05
For instance, PactProviderRule constructor takes the spec version as a constructor parameter

uglyog
2019-11-28 21:10
Have you tried with the latest version?

uglyog
2019-11-28 21:12
Are you asking if the is a GUI to setup pact files, are are you asking if you can run a GUI off a pact mock server? You can for the latter case.

bethskurrie
2019-11-28 23:17
Is there any way to make the scheme configurable in dev @fariasporras?

fariasporras
2019-11-29 07:39
I am using JUnit 5, JDK 8, pact-version 3.6.4. on the other hand i am using DslPart and PactDslJsonBody to generate the body with stringMatcher for the matching rules.

johnny.nilsson83
2019-11-29 09:43
I think I am asking both questions. And I recon you have answered both as well, or am I wrong? I'd like a way to prepare a pact-file that is not through testcase-code only, and when that pact-file is done, I'd like to run a GUI off of that

felipe.costa
2019-11-29 13:35
has joined #general

c.talek
2019-11-29 18:08
has joined #general

c.talek
2019-11-29 18:16
Hey there, i'm running through the docs for pact workshop using golang. My OS is windows, I'm using the win32 version of https://github.com/pact-foundation/pact-ruby-standalone/releases/tag/v1.72.2, I have golang installed and am running visual studio code w/all required addons. I was able to get through steps 1-8 no problem. All make/run commands worked. When I get to step 9 (and beyond) which adds authorization, I get this error $ make consumer --- Installing Pact CLI dependencies Sorry, you'll need to install the pact-ruby-standalone manually. make: *** [Makefile:4: install] Error 1 happens also on provider. Any idea on how to fix it? Pact is installed + added to PATH https://github.com/pact-foundation/pact-workshop-go/tree/step9

tenso2006
2019-11-29 21:16
has joined #general

uglyog
2019-11-29 23:39
I haven?t come across any tool like that

matt.fellows
2019-11-30 00:28
I noticed a few issues with the workshop yesterday Talak, I'll take a look today and see if it addresses this. Thanks for raising

lucas.salsaon2
2019-12-01 02:31
has joined #general

punithrajhd
2019-12-02 10:47
has joined #general

wjtlopez
2019-12-02 13:30
has joined #general

wjtlopez
2019-12-02 13:36
Hey guys. I'm playing around with Pact: i've got two consumer tests for the same provider, one is a RequestResponsePact and the other is a MessagePact. Each test is ran in different builds, so whichever occurs second just overwrites the first pact uploaded to my broker. Wondering if there's a way around this, does the broker not support consumer pacts of different types for the same provider? Thanks

bart.schotten
2019-12-02 15:11
No, sadly it does not. The workaround we use it to to append "-events" to the provider name in case of message pacts. That way they will both be stored on the pact broker. I guess you could also choose to differentiate the consumer names.

wjtlopez
2019-12-02 15:40
Thanks @bart.schotten

c.talek
2019-12-02 16:48
Still learning pact, one thing I'm not 100% clear on.. is this a replacement for unit tests? In the workshops at least they provide the same amount of coverage by testing an endpoint using a mocked service.. My assumption is yes they replace unit tests that mock services to test endpoints/states and unit tests themselves are only beneficial for services that do not communicate with other services

andrew.williams439
2019-12-02 17:13
has joined #general

alan.nichols
2019-12-02 17:29
In my case (an iOS app) they've replaced a large number of our unit tests but not all. We still have unit tests for things like malformed json where we want to make sure we're handling things correctly / defensively, but wouldn't ever publish a contract. Not an expert but maybe this helps

c.talek
2019-12-02 19:03
Thanks, thats helpful, hoping to hear other scenarios as well

mohsin
2019-12-02 19:31
Hi, question about adding users to pactflow: It asks me to send an email to to be able to add users to our broker. Am I not allowed to manage my own users?

ryan.dens
2019-12-02 19:36
I found this message useful for understanding how to use pact tests: https://pact-foundation.slack.com/archives/C5F4KFKR8/p1574731798296800. I think these tests can replace unit tests in the consumer code which sends the message or the provider code which de-serializes the message, but that they shouldn?t feed into tests of other parts of the system. Test the ?handshake? and then let the other components of the consumer and provider test the business logic

bethskurrie
2019-12-02 20:42
@mohsin that API is in our backlog, it's just not completed yet. #startuplyf

bethskurrie
2019-12-02 20:44
I think @alan.nichols expressed it well. I tend to use pact tests as unit tests for the "client" class that makes the calls to the provider, but then I tend to have extra tests for things that wouldn't go in the contract, or would be very hard to test in a contract, exactly like Alan does.

bethskurrie
2019-12-02 20:46
eg. if there is some value that could be one of an enumeration of 20 different values, I probably wouldn't test all 20 in the contract. I'd do one or two, and then have a test that shows how my code would behave if it got an unexpected value (eg. would it throw an error, would it ignore it, would it handle it dynamically...)

uglyog
2019-12-02 20:46
@bethskurrie :point_up:

bethskurrie
2019-12-02 20:46
On the provider side, the verification tests behave more like black box, full stack tests, depending on how much you want to stub out.

bethskurrie
2019-12-02 20:47
Sorry @wjtlopez, this is something that we've discussed for ages as needing, but it's not yet supported.

bethskurrie
2019-12-02 20:47
We do intend to support it however.

bethskurrie
2019-12-02 20:48
I'll raise an issue in the Pact Broker so it's in the forefront of my mind.

bethskurrie
2019-12-02 20:48
Actually, now I think about it, there is already an issue.


bethskurrie
2019-12-02 20:50
Is anyone awake at the moment?

wjtlopez
2019-12-02 20:50
Great, thanks. As a side note, not sure you're aware, but if I upload 5 pacts for a http consumer, and then overwrite it with a messaged based pact for the same consumer/provider, the 6th and all the previous ones are overwritten. It's odd that the previous versions are also changed

bethskurrie
2019-12-02 20:50
We're working on some animations for explaining how pact works, and I'd like some feedback on a couple of options that we're working on.

wjtlopez
2019-12-02 20:51
Haven't looked into it but just a curious thing I noticed

mohsin
2019-12-02 20:54
I?m awake. I better be as I?m at work on Pacific Time :slightly_smiling_face:

matt.fellows
2019-12-02 22:43
@mohsin are you on the free plan? There is a 1 user limit on the free plan, but we can get you going on a trial if you?d like to explore. And yes, we have user management on our near-nerm roadmap

bethskurrie
2019-12-02 22:43
Will pm you

kiranpatel11
2019-12-02 23:08
I am in

bethskurrie
2019-12-02 23:08
:thumbsup::skin-tone-3:

mohsin
2019-12-02 23:09
I?m on the paid plan.

marco
2019-12-03 07:09
If you want some more eyes & thoughts, I'm available too :slightly_smiling_face:

vitaliy.grigoruk
2019-12-03 08:54
ping me if you need more :eyes: on it

bethskurrie
2019-12-03 09:22
@mohsin you can check out our roadmap here https://blog.pactflow.io/pactflow-feature-roadmap/

matt.fellows
2019-12-03 09:42
You peeps are so awesome

bethskurrie
2019-12-03 09:46
@megha.agrawal if you're comfortable coding python, I'm sure the maintainer would love a PR for this. It should be a very simple change.

wjtlopez
2019-12-03 10:21
Hello again. I've been spiking out Pact and think i've read most of the documentation but the provider setup remains a little unclear. I understand that it can be configured with the Maven plugin, or we can write specific tests (spring boot style). I would prefer to avoid the plugin approach as I don't want to set up provider states via urls, but with the alternative approach I wonder how others set up their tests so that there's always something that breaks the build if we aren't fulfilling a contract. As soon as you have one specific api test in place, then any other api contract failures will be flagged. But if you don't have a specific api test, how do you set up a catch all type test?

wjtlopez
2019-12-03 10:27
To further clarify my question: when you create a new Provider, which as of yet has no consumers, how do you configure it without the plugin so that when a consumer creates a Pact, the Provider starts failing because it's not fulfilled one of the states required

alan.nichols
2019-12-03 10:44
@bethskurrie this is exactly the approach we have taken ```I probably wouldn't test all 20 in the contract``` We have many calls with enums as Ints. Our contracts only say that we expect anything with type Int. The other unit and Integration tests can cover off specific examples.

christian.johann.eder
2019-12-03 11:03
has joined #general

christian.johann.eder
2019-12-03 12:15
Hi all, I've also been toying with Pact in a project, but ran into 2 issues which led us to implement something custom lightweight Pact-like, instead of using Pact directly. I now wanted to ask if there is any movement in those areas. 1. We're using protobuf serialization. Following the corresponding slack channel clears things up for me regarding the current state of affairs 2. We're not using HTTP, but rather something TCP-ish. Is anyone using Pact with non HTTP Apis?

wjtlopez
2019-12-03 14:45
Can someone please put me out of my misery: can I use the maven plugin to publish verification results without having used it to verify the pacts? I'm verifying pacts with provider side spring boot tests. Now I want to publish that to my broker, but configuring the maven plugin and running publish does nothing. How do I publish verifications to my broker?

ryan.dens
2019-12-03 14:54
Running `pact:publish` with the maven plugin will attempt to publish contracts you?ve created locally (which don?t exist on the provider side) which is why you aren?t see anything happen. The maven plugin also has no way of knowing whether or not your verification was successful. However, you can much more easily publish verification results with the pact-jvm-provider-spring extension that you?re already using to run your verification. Simply set the java system property `pact.provider.version` to the version of the provider that is running the verification (taken from the pact-jvm-provider-spring README https://github.com/DiUS/pact-jvm/tree/master/provider/pact-jvm-provider-spring)

wjtlopez
2019-12-03 15:03
Thanks @ryan.dens I finally found a way to do it: passing through two relevant environment variables to my maven test command

megha.agrawal
2019-12-03 17:05
@bethskurrie I need more info on the change. I?m not sure what change is required ?

bethskurrie
2019-12-03 19:43
The python code calls a CLI under the hood @megha.agrawal. It just needs the --broker-token passed through to it.


bethskurrie
2019-12-03 19:49
That's for verifying pacts. I can't find where the publishing code is.

matt.fellows
2019-12-03 20:28
I can't speak for maven because I haven't used it, but for question number 2 take a look into the docs on tagging. This is how you safely introduce new changes into the system without breaking everything and annoying your provider teams :laughing:

israel.santiago75
2019-12-03 23:46
has joined #general

bheemreddy181
2019-12-04 03:39
I can contribute a bit too

idamasce
2019-12-04 13:46
has joined #general

bernardoguerr
2019-12-04 16:26
Me too! Ping me if still need someone

wjtlopez
2019-12-04 17:06
Does anyone know where I can find what benefit there is in using pactflow over doing it yourself? I can't see much on the website which helps understand why you'd choose to pay for pactflow and I'd like to find out so I can present it at work and let them decide. All I can see is that it has a nicer UI? Thanks

vitaliy.grigoruk
2019-12-04 19:21
Well, you don?t need to operate an additional service + no infra costs

bethskurrie
2019-12-04 19:24
@wjtlopez here's some info on the extras https://pactflow.io/oss/

bethskurrie
2019-12-04 19:26
As time goes on, the number of extra features in Pactflow will increase. Here is our roadmap https://blog.pactflow.io/pactflow-feature-roadmap/

bethskurrie
2019-12-04 19:28
The OSS Pact Broker makes Pact "work", while Pactflow is designed to make Pact work *at scale*.

wjtlopez
2019-12-04 19:32
Thanks @bethskurrie will check it out

bethskurrie
2019-12-04 19:53
Have PMed you @bheemreddy181. Will also PM you @bernardoguerr, thanks

yamuna.rani
2019-12-05 06:34
has joined #general

yamuna.rani
2019-12-05 06:35
Hi Team

yamuna.rani
2019-12-05 06:36
How to change the tenant ID?

matt.fellows
2019-12-05 06:45
Of I could embellish the above, what you get with Pactflow over and above the OSS broker: ? New UX (nicer and easier to use than the server-side rendered templates in OSS) ? Authentication via local user accounts, Github, Google or another OIDC/SAML provider ? Secrets management (i.e. fully encrypted secrets for use in automation etc. that are also redacted from all logs/UI etc.) ? Webhooks management screens ? Detailed verification results displayed in the UI (when a contract breaks a provider build, you can see in the UI what specific components of the interaction failed) ? Audit API (business plans and above) to be able to track changes for security / auditing purposes ? User management with RBAC is coming soon (Q1 next year) In addition to this, you'll be helping to support the growth of the Pact ecosystem through our work on Pactflow. For example, in Q1 next year we'll have v3.0 and XML support in JS/Typescript interface and our Pending Pacts feature is currently in active development.. You can also see a bit more into our roadmap at https://blog.pactflow.io/pactflow-feature-roadmap/

bethskurrie
2019-12-05 06:45
Addressed via PM.

abhilash.giridharan
2019-12-05 07:22
has joined #general

karl
2019-12-05 10:37
has joined #general


wjtlopez
2019-12-05 10:46
Thanks guys that's really helpful. Can I suggest you make it more easy to access in the website? I can't actually see how to navigate to the /oss page. As a user I would have jumped straight to a top level section called 'why choose pactflow'

karl
2019-12-05 10:49
https://github.com/pact-foundation/pact-js/tree/master/examples/messages <- only suggests that pub/sub is supported and not an asynchronous request-response pattern is

adam.ashton
2019-12-05 10:49
has joined #general

karl
2019-12-05 10:52
https://github.com/pact-foundation/pact-js#using-pact-js <-- Using Pact JS Pact supports synchronous request-response style HTTP interactions and asynchronous interactions with JSON-formatted payloads.

karl
2019-12-05 10:53
We can write manual asynchronous request-response tests but that would mean instead of writing one consumer and one provider test, we need to write two consumer and two provider tests

bethskurrie
2019-12-05 11:06
Hi @karl

bethskurrie
2019-12-05 11:10
So, unfortunately what you're describing is the best we've currently got for messages. We had a go at designing "synchronous message pact" but realised that, unlike HTTP, where you can have a generic mock service that works for all languages and http clients (as all http is the same) creating a synchronous message mock would have to be done on a language by language, library by library basis.

bethskurrie
2019-12-05 11:11
We still want to do it, but it's going to be a lot of work.

bethskurrie
2019-12-05 11:11
We'll probably start with synchronous lambdas in js.

bethskurrie
2019-12-05 11:12
What is your messaging tech?

bethskurrie
2019-12-05 11:13
(Sorry, you won't hear much more from me now as it's night time in :flag-au:, but I'll check this thread in the morning)

karl
2019-12-05 11:13
node, ws and we are looking at implementing asyncapi, seems to be supported by some big companies.

karl
2019-12-05 11:13
No worries! :slightly_smiling_face:

bethskurrie
2019-12-05 11:14
Asyncapi is just the documentation format isn't it?

bethskurrie
2019-12-05 11:15
What is the message protocol you're using?

fariasporras
2019-12-05 13:02
Hi, how can i define a matchersRule for a specific integer using specs v2 into a PactDslJsonBody? thanks in advance!

fariasporras
2019-12-05 13:04
I got generate a specs v2 with junit5 using: @PactTestFor( pactVersion = PactSpecVersion.V2 )

fariasporras
2019-12-05 13:05
Now i need to generate a matcher rule for an integer into PactDslJsonBody, because this don't work for specs v2: DslPart dslPart = new PactDslJsonBody() .integerType("age", 14) .stringMatcher("age", "(12)|(14)", String.valueOf(14)) ...

fariasporras
2019-12-05 13:06
Thanks in advance

karl
2019-12-05 15:25
oh sorry. websockets!

c.talek
2019-12-05 15:55
General question as well, has anyone tried integrating pact tests with a monolithic app that is being split apart into microservices? Just looking for written experiences/any headaches.. Said monolith is very API rich however due to it's size, the entire product needs to be installed in order to access said API's.. microservices are being created around it and while contract testing is great to bind microservice to microservice, it's tricky when dealing with the monolith.. only solution I found would be to have an always-online/installed monolith; upgraded frequently & injected to place it in states required for interacting with contract tests, and off we go.. Eventually the entire monolith will be broken out but until that point our tests will need to reflect the state of our product.. which will end up being more integration tests for the monolith and more contract/unit for what we can break out..

fariasporras
2019-12-05 16:26
hi @bethskurrie how pact-stub-server running with HTTPS with docker? thanks in advance!

bethskurrie
2019-12-05 19:07
Try in #pact-jvm @fariasporras

michael.bardouille
2019-12-05 19:50
has joined #general

michael.bardouille
2019-12-05 19:54
We are exploring using contract testing for our services and are currently attempting a proof of concept. However we have reached a stumbling block in our provider test as the service we are validating against requires an auth token in the request payload. If we generate a token and modify the contract the provider test passes. If we don't the tests fails. I was wondering if anyone can point us in the direction of some resources that could help us get around this blocker as we would like to avoid having to generate a valid token for every contract test we potentially look to set up.

ryan.dens
2019-12-05 20:05
It seems the answer is using request filters or provider states per: https://docs.pact.io/faq#how-do-i-test-oauth-or-other-security-headers

bethskurrie
2019-12-06 00:23
@michael.bardouille @ryan.dens I've just thrown this together https://docs.pact.io/best_practices/provider/handling_auth

khoatran
2019-12-06 00:32
has joined #general

khoatran
2019-12-06 00:39
Hi guys/gals, are there examples on how to integrate pact for messages for ruby

matt.fellows
2019-12-06 01:48
It?s a good point. It was actually a deliberate link from OSS web properties / assets, but we should do that too

matt.fellows
2019-12-06 01:48
Thanks

bethskurrie
2019-12-06 02:44
@khoatran I think only one side is done for Ruby, consumer or provider, I can't remember.

bethskurrie
2019-12-06 02:44
Let's have a chat in #pact-ruby

khoatran
2019-12-06 05:27
thanks Beth

jpatron20
2019-12-06 08:48
has joined #general

igalbenardete
2019-12-06 09:43
has joined #general

karl
2019-12-06 11:34
Hi I've got a question regarding async and protocols

karl
2019-12-06 11:35
In contracts tests, should I involve testing the actual connection, websocket in this example. Or should we only be concerned about the messages?

matt.fellows
2019-12-06 11:55
I would not test the websocket specific bit in a Pact test. At least, not as our library stands today. The messages is all we care about and you can (and perhaps should) have separate tests that check your websocket bits work independently of the messages

karl
2019-12-06 12:32
But how would I know that the consumer has the relevant http headers when a connection attempt is established? If the producer requires a JWT token and the consumer doesn't provide one then the two are incompatible?

karl
2019-12-06 12:33
What I wrote above is however supported in the sync version of pact due to pact actually spinning up a mock server with the given header specifications.

karl
2019-12-06 12:35
As far as I see it the async area in pact is only a contract between functions inside both applications. Providers function will give a specific object that the Consumers function can accept. But this doesn't help if the two can't even connect to begin with. Do you understand what I mean?

karl
2019-12-06 12:36
(I'm thinking out loud here, I love pact so far lol)

karl
2019-12-06 12:38
(one connection test should be enough since all of the messages can then use this one connection)

adi.chikara
2019-12-06 15:53
has joined #general

adi.chikara
2019-12-06 19:12
Is there an example of Pact being used for wrapper APIs on top of ERP solutions?

akkoubak
2019-12-06 20:23
has joined #general

akkoubak
2019-12-06 20:30
Hello, I am currently using a .Net implementation of pact. I signed up for a PactFlow broker account that I can publish results to using PowerShell. However, I am unable to connect to my broker to verify Pact, and I am getting a 401: {Error reading file from <https://MyBroker/pacts/provider/MyProvider/consumer/MyConsumer/latest> HTTP request failed: status=401....} I attempted both http and https protocols for .PactUri values. I also fetched my API token in my PactVerifierConfig { CustomHeader = new KeyValuePair<string, string>("Authorization", "Bearer xxxxx")}. Any idea on where to go from here?

akkoubak
2019-12-06 21:08
I have a feeling the issue has to do with CustomHeader

bethskurrie
2019-12-06 23:30
Which pact stub server are you using @fariasporras?

bethskurrie
2019-12-06 23:30
If it's the rust one, I don't know

bethskurrie
2019-12-06 23:32
If it's the one from the pact-cli docker image, then you then these are the options https://github.com/pact-foundation/pact-mock_service/blob/master/README.md#with-ssl

bethskurrie
2019-12-06 23:32
The Ruby one (above) only supports v2 though

keshavpra
2019-12-07 03:33
has joined #general

khoatran
2019-12-08 19:51
Has anyone tried pact to test an AWS step function? We've got service A exposing a lambda function and service B consuming the lambda function through a step function, i.e. function invocation in a config file instead of code.

neil
2019-12-08 23:40
Instead of using a custom header, you can use ```.PactUri("<http://pact-broker/pacts/provider/Something%20Api/consumer/Consumer/latest>", new PactUriOptions("my_bearer_token"))```


matt.fellows
2019-12-09 01:28
Oooh that?s a good question. I think it?s definitely doable, given that it emits JS. I haven?t thought on it hard enough to know if it would be useful, but my gut feeling is yes

matt.fellows
2019-12-09 01:28
@uglyog thoughts?

uglyog
2019-12-09 01:30
Yes, it would be definitely doable. Step functions are great because they get an event as input, and return one as output which is passed into the next step. So JSON in, JSON out, no side effects

uglyog
2019-12-09 01:31
You should be able to use the Message Pact to verify the output with the next input

matt.fellows
2019-12-09 01:31
What do you mean my ?no side effects??

bethskurrie
2019-12-09 01:31
except we don't have synchronous message pact yet!

uglyog
2019-12-09 01:32
As in the output gets passed to the next step, nothing outside step functions effects it

matt.fellows
2019-12-09 01:32
right, yes. Otherwise? pretty useless step functions

matt.fellows
2019-12-09 01:32
like Haskell 1.0

uglyog
2019-12-09 01:32
It's not synchronous, it's a step in a state machine

matt.fellows
2019-12-09 01:33
the output goes to another lambda

uglyog
2019-12-09 01:33
Also, the whole state machine works similar, JSON in and then JSON out

matt.fellows
2019-12-09 01:33
(or the same, but is the input to another scenario)

matt.fellows
2019-12-09 01:33
(that comment was for Beth?s remark)

ivangsa
2019-12-09 10:44
has joined #general

akkoubak
2019-12-09 15:44
@neil thx for the answer, but PactUriOptions in my case takes only takes a minimum of two arguments (for username and password). Severity Code Description Project File Line Suppression State Error CS7036 There is no argument given that corresponds to the required formal parameter 'password' of 'PactUriOptions.PactUriOptions(string, string)' tests C:\Users\AAkkoub\Documents\ManagerMobileAzure\HelloWorld\PactAzureProj\Provider\tests\ProviderApiTests.cs 76 Active

gordo
2019-12-09 22:18
has joined #general

neil
2019-12-10 00:34
@akkoubak If you update to the latest nuget package, you?ll have the additional options

khoatran
2019-12-10 00:44
thanks all for your inputs. Can anyone give some more details. I'm pretty clueless now.

akkoubak
2019-12-10 02:08
@neil It turned out I was using an older version of pactnet. I updated my version, and switched my target framework, and it worked. Thank you for your help!

bethskurrie
2019-12-10 09:51
@khoatran I'm assuming your step functions are written in node?

bethskurrie
2019-12-10 09:53
It sounds to me like you'd need both an input and an output, and at the moment pact-js for messages only allows you to specify the output.

bethskurrie
2019-12-10 09:54
If you look at the pact-js docs, you'll find a section on message pact

bethskurrie
2019-12-10 09:55
The way message pact works is that we ignore the protocol, and just test the payloads

bethskurrie
2019-12-10 09:58
But we'd need the input and the output

bethskurrie
2019-12-10 10:30
Ideally you should be testing the business logic of the function, without actually hitting any AWS specific code.

bethskurrie
2019-12-10 10:30
Without having to deploy.

bethskurrie
2019-12-10 10:31
Disclaimer, I've never written a step function! So I'm talking from theory here.

james.hattersley-dyke
2019-12-10 10:46
Hi all, I've a bit of an annoying problem with our CD set up. I've got everything working using webhooks etc. it's to do with versioning. So in our pipelines, before a Provider is merged to master in git the verification step runs as a unit test and it has one version number say `1.4.1` after the merge it's bumped to `1.4.2` automatically, thus creating a detached unverified version of the provider because the verification step doesn't happen again, and if it did and where to fail, it'd leave built docker images laying around etc. What happens is Consumers come along and their CI pipeline executes `can-i-deploy --a my-consumer --verison consumer-version --to master --latest` or something like that... it's got no way of knowing the provider version has jumped following it's changes and because the verification hasn't happened again i.e the contract hasn't changed, the only way to reverify is manually. Has anyone got any advice on how to handle this, aside from either double tagging the pact with both provider verisons or re-running the verification post merge? It's a bit odd I know, but the versioning of our apps changed to solve one problem we where having, thus creating another!

james.hattersley-dyke
2019-12-10 12:53
I've also thought as well as running `can-i-deploy` on the consumer side I could solve the above by always running a verification on every consumer build. That might cause other problems down the line tho

gaurav.singh55
2019-12-10 13:06
has joined #general

fariasporras
2019-12-10 14:36
yes, i tried with pact-stub-server v0.3.1 --> https://hub.docker.com/r/pactfoundation/pact-stub-server/

fariasporras
2019-12-10 14:38
ok, i tried with pact-stub-server v0.3.1, but i can´t load my contract with https using this -> https://hub.docker.com/r/pactfoundation/pact-stub-server/ Thanks in advance.

prabha_kannusamy2
2019-12-10 15:33
Hi All, I am trying to run pact validation with swagger.yaml file. In swagger file there is a security definition for my api like "security: - apiKey: []". But when i run the pact test it is complaining "[ERROR] GET on path '/api/v1/user-dashboard/user' requires security parameters. None found."

gabrieltnishimura
2019-12-10 16:48
has joined #general

bethskurrie
2019-12-10 19:43
@prabha_kannusamy2 try asking in the #swagger-validator channel

bethskurrie
2019-12-10 19:44
The swagger validator is a tool written by Atlassian employees and open sourced, so the core pact maintainer group can't really help you with it.

bethskurrie
2019-12-10 19:46
That's a tricky one @james.hattersley-dyke

bethskurrie
2019-12-10 19:49
If you're using can I deploy for both consumer and provider anyway, I'd say, rerun the provider verification after merge, but add an `|| true` so that it never fails the build

bethskurrie
2019-12-10 19:50
It will most likely pass if the previous one passed, and if it fails, it will be caught by the can I deploy step.

khoatran
2019-12-10 19:54
thanks Beth. Sorry I didn't get the notification on your reply and thus the late reply

khoatran
2019-12-10 19:54
the step function is written in a cloud formation template, i.e. yaml

bethskurrie
2019-12-10 19:58
The new "pending pacts" feature might help with this.


bethskurrie
2019-12-10 20:00
It's currently being beta tested.

bethskurrie
2019-12-10 20:03
@karl you're right, the current support isn't sufficient. We hope to have better support for websockets in the future, however, it's not on the immediate road map. Sorry!

prabha_kannusamy2
2019-12-10 20:23
Actually it is failing in pact Validation , when trying to see the YAML has security defined for the api as apiKey, but i am not sure how to send it in pactVerification .com.atlassian.oai.validator.pact.ValidatedPactProviderRule$PactValidationError: Validation failed. [ERROR] PUT on path '/api/v1/advisor-dashboard/crmKey/update' requires security parameters. None found. [INFO] PUT on path '/api/v1/advisor-dashboard/crmKey/update' defines a response schema but no response body found. at com.atlassian.oai.validator.pact.ValidatedPactProviderRule.validatePactDef(ValidatedPactProviderRule.java:98) at com.atlassian.oai.validator.pact.ValidatedPactProviderRule.access$000(ValidatedPactProviderRule.java:27)

matt.fellows
2019-12-10 21:02
That still looks to be the use of the atlassian tool. It has its own Pact validation but it's not Pact

uglyog
2019-12-10 22:27
Output is downstream to the next step or thing, not back

bethskurrie
2019-12-10 22:27
But don't you need to give it an input?

uglyog
2019-12-10 22:29
Sigh, let's discuss this with a whiteboard.

bethskurrie
2019-12-10 22:29
Yes teacher :joy:

rbhati
2019-12-10 22:37
hi all & @matt.fellows, @bethskurrie: need directions on following situation: [i'm unable to find designated slack channel for pact-provider-verifier] I'm executing `pact-provider-verifier` with `--verbose` in shell to do pact validation at provider side Problem: How can i get the request/response printed in case of failure. When it fails all i get is below, I have no clue what got sent and what got received. `Failures:`  `1) Verifying a pact between my-consumer and my-provider Given This-is-given request to fetch accounts with POST / returns a response which has status code 200`    `Failure/Error: expect(response_status).to eql expected_response_status` `   `     `expected: 200`        `got: 500` `   `     `(compared using eql?)`  `2) Verifying a pact between my-consumer and my-provider Given This-is-given request to fetch accounts with POST / returns a response which has a matching body`    `Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example` `   `     `Actual: POST body missing. Did you forget use body-parser middleware?` `   `     `Diff`     `--------------------------------------`     `Key: - is expected`          `+ is actual`      `Matching keys and values are not shown`

bethskurrie
2019-12-11 03:21
@rbhati there's a log file

bethskurrie
2019-12-11 03:21
You can tell it where to go in the options.

james.hattersley-dyke
2019-12-11 09:41
Thanks Beth, we went with the reverification on the provider build but not waiting on the outcome as it'll have already passed as you say. Basically nothing changes in the code, just a version gets incremented once it's merged into master.

karl
2019-12-11 11:35
It's ok Beth and thanks for answering, it's nice to know that yous are aware!

bernardoguerr
2019-12-11 15:00
I'm assuming one of the steps of the step function is the invocation of the lambda function, then receiving that input. I think the point at which you would test is not the step function itself, but whatever is the next step in the step function that consumes that message. That is, there should be code that runs against the lambda's output and uses it as input (potentially in another lambda, for example). The step function is just orchestrating it

bernardoguerr
2019-12-11 15:01
do you have the step function diagram, or some architecture diagrams of the services?

bethskurrie
2019-12-11 20:12
I'm guessing it just doesn't support running with https. You could raise an issue requesting it.

theriaultnicolas
2019-12-12 03:10
has joined #general

michael.donkhin
2019-12-12 15:57
has joined #general

sam774
2019-12-12 18:59
has joined #general

sam774
2019-12-12 20:54
Does anyone have any experience running the pact-cli docker image on gitlab? Simple example but if locally I was to run: `docker run --rm pactfoundation/pact-cli help` as a simple example, what we're doing there is passing a command to the container. The entry point for the pact-cli image is running a shell script, which effectively proxies the command you pass into the container. In Gitlab, the operating model is slightly different and you can't specify a command to the image in the same way, and so: ` mypactjob: image: pactfoundation/pact-cli:latest script: - help ` Then this isn't going to work.

travis.anderson
2019-12-12 21:21
Hello everyone, I have a question about how exactly request filters work when testing with OAuth headers? Specifically, on the consumer side of testing does the authentication actually get checked? Or is the whole process on both consumer and provider side essentially stubbed out?

vitaliy.grigoruk
2019-12-12 21:33
Hi Travis. On the consumer side, you can verify that headers are set and that pact mockserver receives requests with necessary headers. Then on provider?s side, when your contract is gonna be verified against a running provider, you?ll need to override auth headers. Pact provides a way to do this for each request verifier checks, but you need to generate valid auth tokens yourself for this.

travis.anderson
2019-12-12 21:55
Hi Vitalii, thanks for getting back to me. So from what I understand, I will need to get those valid auth tokens (probably programmatically by a request to the auth service). On the provider side, override the header with a valid token from that response, and on the consumer side do the same?

bethskurrie
2019-12-12 22:06
I wrote a page about options regarding this the other day!


bethskurrie
2019-12-12 22:08
Hi @sam774

bethskurrie
2019-12-12 22:09
I'm the maintainer of the Pact cli docker image.

bethskurrie
2019-12-12 22:09
I'm not familiar with gitlab, so I don't quite understand the constraint.

bethskurrie
2019-12-12 22:09
Are you saying, you can't pass an argument to the container?

bethskurrie
2019-12-12 22:10
Could you build your own image based on the pact-cli to call the task you're interested in without any args?

travis.anderson
2019-12-12 22:24
Oh awesome! So I guess my question is: is there any authentication that needs to happen on the consumer side tests? Or is that dependednt on how the individual app handles auth?

sam774
2019-12-12 22:31
Hi Beth. That should be possible, I'll give it a try thanks! Will attempt to get a sample repo up tomorrow :grin:

bethskurrie
2019-12-12 22:31
You put in any authentication you want to use on the provider side.

bethskurrie
2019-12-12 22:32
Let me know how you go

bethskurrie
2019-12-12 22:32
It's very hard to give generic advice, because only you know what is covered where in your test suites.

bethskurrie
2019-12-12 22:34
You could put in a hard coded token if you wanted to stub the auth code on the provider to accept a hard coded token.

bethskurrie
2019-12-12 22:35
If you reckon you'll just stub the whole thing, or turn off auth, then there's not much point putting it in the consumer side.

bethskurrie
2019-12-12 22:35
It might lead to a false sense of confidence if it's not actually being used. "oh, it's in the contract, it must be right!"

travis.anderson
2019-12-12 23:31
Oh! I think I understand. So as long as I set up the provider with the proper interactions to produce a 401, I can grab a valid token and override the request on the provider side. I'll give that a shot and see what happens I guess :man-shrugging:

bethskurrie
2019-12-12 23:33
:+1:

pact
2019-12-13 10:10
has joined #general

sam774
2019-12-13 14:21
Hey Beth. Thanks for the pointer. I managed to get this working, thankfully without having to build an additional image. Sample repo at https://gitlab.com/my-pact-experiments/pact-provider My Gitlab job needs to looks like this: > test: > stage: test > image: > name: pactfoundation/pact-cli:0.1.0-1 > entrypoint: [""] > services: > - name: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA} > alias: app > script: > - cd /pact > - | > bundle exec bin/pact verify \ > --provider_base_url http://app:8081 \ > --provider-states-setup-url http://app:8081/provider-states \ > --wait 10 That is running the Java web app built in a previous job as a service (an additional container on the side), and setting pact-cli to be the main image run for this job. I'm overriding the entrypoint to be [""] so that gitlab can start it correctly. Then, in the script section, I can effectively recreate what's done in the pact-cli entrypoint, of cd'ing to the /pact dir and running the verify step :slightly_smiling_face: The bit I've missed out here is that I'm not using Pact broker (another rant for another time). The gitlab runner will actually clone your repo into this docker container, and so it's easy to point at local pact files. Just add: $CI_PROJECT_DIR/<location-of-pact-file>

michael.donkhin
2019-12-15 09:01
Hi all,

michael.donkhin
2019-12-15 09:09
I have a question regarding a strange behavior of Pact Broker: for the can-i-deploy endpoint, I receive a 'falsy' result when the provider tests for the consumer I am currently querying have newer verification results in another branch. The situation is like this: Consumer build in a 'master' branch is trying to check if deployment is possible, using the consumer version and the 'master' tag. A matching provider version verification exists on 'master' tag, but can-id-deploy returns _`"deployable": null`_ result with a message: '_There is no verified pact between version 'xxxxx' of Consumer and the latest version of Provider with tag master (no such version exists)_' This is because there is a newer version of Provider on a feature branch with a changed pact contract. Is it the expected behavior? In this case it's hard to understand why, because it breaks the 'master' branch build each time there is a newer version on a feature branch.

bethskurrie
2019-12-15 09:11
@michael.donkhin turn on the verbose mode and get the URL that the request is making

bethskurrie
2019-12-15 09:11
Paste that into a browser and have a look at the table that gets returned.

bethskurrie
2019-12-15 09:12
The feature branch pact won't affect this result unless you've published it with the same consumer version ID.

bethskurrie
2019-12-15 09:13
Or, with the master tag.

bethskurrie
2019-12-15 09:13
Also, can you provide the actual command you're using to do can I deploy.

michael.donkhin
2019-12-15 09:15
I'm using direct REST call from a Rest client: `http://<my pact broker address>/can-i-deploy?pacticipant=<Consumer>&version=<Consumer Version>&to=master`

bethskurrie
2019-12-15 09:16
Hm. You won't get a table with that query

bethskurrie
2019-12-15 09:16
You'll need to run the cli

michael.donkhin
2019-12-15 09:21
BTW, here is the result I get: `{` `"summary": {` `"deployable": null,` `"reason": "There is no verified pact between version <Consumer Version> of <Consumer> and the latest version of <Provider> with tag master (no such version exists)\nThere is no verified pact between the latest version of <Higher Level Consumer> with tag master (<Higher Level Consumer Version>) and version <Consumer Version> of <Consumer>",` `"success": 0,` `"failed": 0,` `"unknown": 2` `},` `"matrix": [` `{` `"consumer": {` `"name": "<Higher Level Consumer>",` `"version": {` `"number": "<Higher Level Consumer Version>",` `"_links": {` `"self": {` `"href": "http://<pact broker address>/pacticipants/<Higher Level Consumer>/versions/<Higher Level Consumer Version>"` `}` `}` `},` `"_links": {` `"self": {` `"href": "http://<pact broker address>/pacticipants/<Higher Level Consumer>"` `}` `}` `},` `"provider": {` `"name": "<Consumer>",` `"version": null,` `"_links": {` `"self": {` `"href": "http://<pact broker address>/pacticipants/<Consumer>"` `}` `}` `},` `"pact": {` `"createdAt": "2019-12-03T14:52:27+00:00",` `"_links": {` `"self": {` `"href": "http://<pact broker address>/pacts/provider/<Consumer>/consumer/<Higher Level Consumer>/version/<Higher Level Consumer Version>"` `}` `}` `},` `"verificationResult": null` `}` `]` `}`

michael.donkhin
2019-12-15 09:21
One moment, I'll try the CLI

michael.donkhin
2019-12-15 09:31
I get the same result from the CLI

michael.donkhin
2019-12-15 09:35
And here are the conflicting versions of the pact, as I understand:

michael.donkhin
2019-12-15 09:36
The second line is the version of the provider that has a changed contract

bethskurrie
2019-12-15 09:36
I don't see a tag on the provider version

michael.donkhin
2019-12-15 09:37
you are right...

bethskurrie
2019-12-15 09:37
You've got a consumer with a master tag, but that version has not been verified by a version of the provider with a master tag.

bethskurrie
2019-12-15 09:37
What lib are you doing the provider verification with?

bethskurrie
2019-12-15 09:38
Provider tagging has only been recently added to all the libs. You may need to upgrade to the latest Pact version.

michael.donkhin
2019-12-15 09:40
it's pact for .Net, and I all the other providers tagged, this is the only one that isn't

bethskurrie
2019-12-15 09:41
Strange

michael.donkhin
2019-12-15 09:41
probably some bug in the build pipeline

bethskurrie
2019-12-15 09:41
Is it possible that's one an old version?

bethskurrie
2019-12-15 09:41
Hm, but it would blow up if it got args it didn't recognise.

michael.donkhin
2019-12-15 10:05
It's a problem in my configuration, I see that the tagged versions of providers are for those services that are consumers by themselves

michael.donkhin
2019-12-15 10:08
So I have implicit provider tags for consumers, but no tags at all for providers

michael.donkhin
2019-12-15 10:09
Another question, if I may: the verification above will still fail because of the 'upstream' consumer, should the new 'pending pact' feature solve this?

bethskurrie
2019-12-15 19:07
@michael.donkhin the verification will still fail, and you won't be able to deploy, but it won't break the provider's build.

bethskurrie
2019-12-15 19:07
It depends what you mean by "solve".

michael.donkhin
2019-12-16 07:48
Well, I guess we'll need to figure out how exactly we'd like to integrate contract tests in our pipeline...

michael.donkhin
2019-12-16 07:49
Thanks a lot for your help! Appreciate it very much!

bethskurrie
2019-12-16 08:03
You're welcome @michael.donkhin

michael.donkhin
2019-12-16 08:22
Sorry, one more question: is there an API allowing to retrieve the 'reason' for can-i-deploy failure in a structured manner, instead of a text? I mean - the matrix provides information about existing contracts, but not about absent ones, so I would like to somehow filter the reasons based on the matrix and decide which are relevant for me and which are not. For example, if there is an unverified contract with a consumer, but two more 'non-existent' verifications with downstream providers, I would like to evaluate the number of unverified vs. number of non-existent contracts which comprise the overall number of failure reasons.

michael.donkhin
2019-12-16 08:22
Is matrix structure good enough for that?

bethskurrie
2019-12-16 08:49
No. Can you explain what you're trying to achieve?

bethskurrie
2019-12-16 08:53
Actually, yes, I think it is.

bethskurrie
2019-12-16 08:53
In the summary.

bethskurrie
2019-12-16 08:54
Have a look at the json. It has a count for missing, failed, and succeeded.

michael.donkhin
2019-12-16 09:40
Yes, but in the example above, there are two 'unknowns' where one of the is from 'higher level' consumer, while another doesn't exist at all. That's the number which meaning I'd like to understand more when I read the file. Currently I don't see any option except going over the matrix and subtracting the number of 'unknown' verifications in matrix from the overall 'unknowns'. Which still doesn't provide me with a definitive answer what is absent, except by looking at 'reasons'.

bethskurrie
2019-12-16 09:41
You sound like you're trying to do something unusual. What are you trying to achieve?


nerea.tamayo
2019-12-16 10:39
has joined #general

michael.donkhin
2019-12-16 14:27
:slightly_smiling_face: I'm trying to implement my own logic of parsing the results of can-i-deploy call and decide if I can deploy a given service builds based only on its providers' verification outcome, not consumers'.

christian.johann.eder
2019-12-16 15:39
I've got a question regarding these test cases for the V2 specification: https://github.com/pact-foundation/pact-specification/blob/version-2/testcases/request/body/missing%20body.json https://github.com/pact-foundation/pact-specification/blob/version-2/testcases/request/body/missing%20body%20no%20content%20type.json Don't these test cases break Postel's Law? They expect the *requests* to match although the actual requests contain a bofy and the expected request doesn't. Did I get the philosophy wrong?

christian.johann.eder
2019-12-16 15:49
And another one that I'm curious about: https://github.com/pact-foundation/pact-specification/blob/version-2/testcases/response/body/unexpected%20index%20with%20not%20null%20value.json Shouldn't this be allowed (match the expected response) since the actual response is only sending *additional* data back to the consumer that the consumer didnt expect?

greig.baird
2019-12-16 16:51
has joined #general

bheemreddy181
2019-12-16 19:42
Do we have to really set a port for each provider mock server we are creating on the consumer side? Can we handle this internally to pick any port which is available on that environment ?

uglyog
2019-12-16 21:18
That exactly how the robustness principle (aka Postel?s law) works. We ignore the additional fields, being liberal in what we receive.

christian.johann.eder
2019-12-16 21:38
Then why does the test case (in my last link, so the response test case) say match: false? I would expect it to say match:true And: the first two links are links to request test cases.

christian.johann.eder
2019-12-16 21:40
I interpreted the test case files to be read as: this *actual* request (or response, depending on the folder of the test case) *matches* the *expected*

bethskurrie
2019-12-16 22:44
Why is that @michael.donkhin?

bethskurrie
2019-12-16 22:57
@bheemreddy181 it depends which implementation

bethskurrie
2019-12-16 22:57
Best to ask in the relevant channel.

bheemreddy181
2019-12-16 23:05
I did put it in #pact-ruby

michael.donkhin
2019-12-17 09:47
More like management requirements

bethskurrie
2019-12-17 09:48
So, providers are allowed to break consumers, but consumers must work with providers?

michael.donkhin
2019-12-17 09:49
Something like: providers can be moved to the master branch even if they do not implement the consumer requirements yet

bethskurrie
2019-12-17 09:51
Have you read the pending pacts blog post yet?

michael.donkhin
2019-12-17 09:57
Yes, I read it. However, I don't believe the implementation is already done for the .Net version

bethskurrie
2019-12-17 09:57
It can be quite easily if it's not

bethskurrie
2019-12-17 09:57
it's just an upgrade to the latest version of the underlying lib.

michael.donkhin
2019-12-17 09:58
any example of existing implementation? maybe I'll submit a pull request


bethskurrie
2019-12-17 09:58
I'm sure neil would love a PR.

bethskurrie
2019-12-17 09:59
However, I'm not sure if it will fix your workflow, because it won't change the can-i-deploy results, it will just ensure that your provider build can't be broken by unimplemented requirements added by a consumer.

michael.donkhin
2019-12-17 10:22
What I want to achieve is block merging of customers into the master branch until there are matching providers, which requires (as I understand) to run can-i-deploy on feature branches against 'master'. Successful build is a prerequisite for PR in our environment. But this will also block the hybrid consumer-provider services because they will block themselves.

bethskurrie
2019-12-17 10:23
so, you can just provide the explict names.

bethskurrie
2019-12-17 10:23
If you are a consumer, you know your providers.

bethskurrie
2019-12-17 10:24
if you give the names explicitly, it will ignore all the other dependencies.

michael.donkhin
2019-12-17 10:24
do you mean - for can-i-deploy calls?

bethskurrie
2019-12-17 10:24
yes


bethskurrie
2019-12-17 10:24
oh, sorry, not that

michael.donkhin
2019-12-17 10:24
yes


michael.donkhin
2019-12-17 10:26
this one is new for me, let me see

michael.donkhin
2019-12-17 10:27
does it use the can-i-deploy endpoint behind the scenes?

bethskurrie
2019-12-17 10:28
No, it uses the matrix endpoint, which is more complex.

michael.donkhin
2019-12-17 10:28
I ask it because currently I cannot integrate the CLI inside the build

bethskurrie
2019-12-17 10:28
You can call the endpoint directly though - the params are just a bit more complex

michael.donkhin
2019-12-17 10:29
the matrix endpoint?

bethskurrie
2019-12-17 10:29
make the query you want using the CLI, turn on verbose, and then copy the URL that it makes.

michael.donkhin
2019-12-17 10:29
OK, thanks fro your time, I'll check it

bethskurrie
2019-12-17 10:29
Yes, to the matrix endpoint. the can-i-deploy endpoint is a simplified version of the matrix, which only accepts the simplest format (consumer, version, to tag)

bethskurrie
2019-12-17 10:30
I will eventually get round to making the can-i-deploy endpoint support the multiple provider format.

khoatran
2019-12-18 00:58
Hi Bernard, sorry for the late reply. Please find below the step function diagram

khoatran
2019-12-18 00:58
I'm after testing the signature of the 'SendMessage' step

loveshjain88
2019-12-18 01:52
has joined #general

loveshjain88
2019-12-18 01:54
Hi All, I am using Pact JVM and trying to add header for every request when provider verifies it I added @TargetRequestFilter according to https://github.com/DiUS/pact-jvm/tree/master/provider/pact-jvm-provider-junit#modifying-the-requests-before-they-are-sent-version-323245 but it is not getting called?

christian.johann.eder
2019-12-18 09:05
anyone who can explain to me how the test case files are to be interpreted, if not the way I did? And if I did it right, why the test cases seem to neglect Postel's law, or what I am interpreting wrong? @matt.fellows or @bethskurrie (since you seem to also have worked on the spec testcases)?

bethskurrie
2019-12-18 09:05
Hi Christian. Are you writing a new pact implementation?

christian.johann.eder
2019-12-18 09:06
I was rolling my own for a customer project that wasnt using JSON over HTTP, and am trying to make it PACT compliant.

christian.johann.eder
2019-12-18 09:06
So, yes

bethskurrie
2019-12-18 09:07
Interesting. What protocol?

christian.johann.eder
2019-12-18 09:07
We are using protobuf serialized payload over a TCP-ish peer to peer protocol

bethskurrie
2019-12-18 09:08
Have you been part of the protobuf channel conversations?

bethskurrie
2019-12-18 09:09
BTW, the first link, it fails because the actual request has more data in it than it should.

bethskurrie
2019-12-18 09:09
We are strict with what we send out, so unexpected data is not allowed.

christian.johann.eder
2019-12-18 09:09
yes, but those still wont help that project, since its still just related to HTTP APIs (but with protobuf bodies).

bethskurrie
2019-12-18 09:10
The test case is named in a misleading way. It should be "unexpected body".

christian.johann.eder
2019-12-18 09:10
I get the Postels law - what I dont get is why the Request test case I linked states that an *actual* request that contains a body should match an *expected* request without a body. To me, this seems like a violation of said Postels law

bethskurrie
2019-12-18 09:11
It does indeed.

christian.johann.eder
2019-12-18 09:12
As far as i interpret postels law, if a consumer doesnt state that he will send a body in the request (=expected), but then sends a body (=actual), those should NOT match

christian.johann.eder
2019-12-18 09:12
but the test case says "match: true"

bethskurrie
2019-12-18 09:12
Looks like a bug to me

christian.johann.eder
2019-12-18 09:12
Thanks ^^

christian.johann.eder
2019-12-18 09:12
I am not crazy

christian.johann.eder
2019-12-18 09:12
there are several of those test cases

christian.johann.eder
2019-12-18 09:13
also, the other way around: response test cases where an actual array contains more elements than expected. In my opinion, these should match. But the test case says they shoudl not

bethskurrie
2019-12-18 09:13
Probably got copy pasted. @uglyog am I also missing something?

christian.johann.eder
2019-12-18 09:14
I found at least something between 5-8 such test cases, would have to look up for more details

bethskurrie
2019-12-18 09:14
The array thing, they match if there is a matcher used to say, ignore array length.

bethskurrie
2019-12-18 09:14
I don't know how pact JVM passes then.

bethskurrie
2019-12-18 09:15
The first one looks fine to me though.

christian.johann.eder
2019-12-18 09:15
ah - ok, so for arrays (if no matcher is defined for the array length) the length has to be exactly the same, also for responses? I thought we should accept more data than expected here as well, similar to getting more properties than expected on an object.

christian.johann.eder
2019-12-18 09:15
which one do you mean?

bethskurrie
2019-12-18 09:15
It has to have a matcher.

christian.johann.eder
2019-12-18 09:16
k, ok, got the array thing

christian.johann.eder
2019-12-18 09:16
and regaridng the body test cases, do you think this one here is correct? https://github.com/pact-foundation/pact-specification/blob/version-2/testcases/request/body/missing%20body.json

christian.johann.eder
2019-12-18 09:16
If so, please explain

bethskurrie
2019-12-18 09:16
In hindsight, there are things we would do differently, but unfortunately that's the way it made at the time, so they all have to work the same.

bethskurrie
2019-12-18 09:17
The missing body one is weird.

bethskurrie
2019-12-18 09:18
It might have been that that was a quirk of the original Ruby impl, and when the spec was retrofitted to match existing behaviour, that's what came out.

christian.johann.eder
2019-12-18 09:18
If you want to, i can link you all the test case files my implementation fails where I think the test case might be wrong. would that helpß

christian.johann.eder
2019-12-18 09:18
?

bethskurrie
2019-12-18 09:18
The thing is, even if they are wrong, all the impls will also be wrong together.

christian.johann.eder
2019-12-18 09:19
... meaning I would probably have to make my implementation wrong as well if i want to make it compatible :slightly_smiling_face:

bethskurrie
2019-12-18 09:19
You might need to choose between being spec compliant and being "right"

bethskurrie
2019-12-18 09:20
When it was first written, nobody knew it was going to turn into a Thing, so there are inconsistencies.

christian.johann.eder
2019-12-18 09:21
would be great if someone would confirm that indeed those testcases are purposefully "wrong" - or are you already sure on that?

christian.johann.eder
2019-12-18 09:36
But anyway thanks already for your insights!

christian.johann.eder
2019-12-18 09:37
I think I am going to give the users of my library the choice of being Pact compliant (this being the default) and "right"

christian.johann.eder
2019-12-18 16:02
I've got another question regarind this one here: https://github.com/pact-foundation/pact-specification/blob/version-2/testcases/response/body/objects%20in%20array%20type%20matching.json What exactly does a "type match" on an object mean? Does it mean that two objects are structurally the same, i.e. a deep check that they have the same properties with the same types?

paul.simms
2019-12-18 16:39
We are in the same situation. We are currently pushing to add pact tests to the new microservices, and yes it is far harder for us to add into the monolith. We have (almost) managed in a couple of key interfaces, but are handling most of them through other testing from the existing monolith (UI, RestAssured, Unit). Not ideal.

v.melnychuk12
2019-12-18 18:43
has joined #general

uglyog
2019-12-18 21:38
If the examples are wrong, we should fix them

bethskurrie
2019-12-18 22:10
@christian.johann.eder yes. It does a deep match to ensure the keys and types are the same.

rahul.singh2
2019-12-19 06:58
has joined #general

rahul.singh2
2019-12-19 07:00
Hi Guys, I am pretty new to PACT. Can someone please help me to setup PACT on my machine and how to write my first test?

matt.fellows
2019-12-19 07:02
Welcome! what have you tried so far? What language?

matt.fellows
2019-12-19 07:05
(btw it?s just Pact, not PACT. It?s not an acronym)

rahul.singh2
2019-12-19 07:08
I have read so many articles on google regarding Pact but didn't get any article which explains step by step procedure to install and setup the same. Any language would be fine to me, just want to start by installing it :slightly_smiling_face:

rahul.singh2
2019-12-19 07:08
will appreciate your help!



christian.johann.eder
2019-12-19 07:10
@uglyog as far as I understood Beth, the testcases / examples are not wrong as in "different from how Pact works". They are just wrong as in "break Postels Law".

christian.johann.eder
2019-12-19 07:10
@bethskurrie thanks!

rahul.singh2
2019-12-19 07:11
thanks! will go through and will ping for any questions if i will have :slightly_smiling_face:

richard.staehler
2019-12-19 17:36
has joined #general

c.talek
2019-12-19 18:43
Random questions, for teams using pact broker, do your project managers leverage the tool to determine version compatability matrix's ? This assumes you only leverage unit/contract testing and don't consider anything heavier beyond that

c.talek
2019-12-19 18:44
I assume for your runs you basically keep a constant running monolith that gets periodically upgraded to validate your pacts?

uglyog
2019-12-19 22:25
The tests are written with the context of the Pact mock server and verifier. When the mock server is matching a body, it will be strict. When the verifier is matching the response from the provider, it will be less strict. This follows the robustness principle from the perspective of the Pact framework, not in isolation.

antonello
2019-12-19 22:39
Not sure I follow...

matt.fellows
2019-12-20 01:05
Perhaps you?re alluding to the approach where various teams get together as part of an integration cycle and use this sort of matrix to determine which component is in what environment and what?s been tested?

christian.johann.eder
2019-12-20 13:23
Yes - if I understoof correctly, the tests in the "request" folder are written from the perspective of the Pact mock server, and the tests in the "response" folder in the perspective of the verifier - right? Nevertheless, I think that the inconsistencies as discussed with Beth still apply

c.talek
2019-12-20 14:39
Correct :point_up:

wesleythomaswilliams
2019-12-20 14:39
has joined #general

sumeshs572
2019-12-20 21:18
has joined #general

sumeshs572
2019-12-20 21:19
Hi all I am unable to find our pact cradle plugin dependency jar in any repository

matt.fellows
2019-12-21 00:08
Maybe try the #pact-jvm

matt.fellows
2019-12-21 00:08
Can you show the problem? Where are you searching for example

sumeshs572
2019-12-21 01:17
Sure I will let you know the details and also check the issues on pact-Jvm

taisedias
2019-12-22 21:50
has joined #general

ak.bhartiya
2019-12-23 13:19
has joined #general

plessmann
2019-12-23 14:25
has joined #general

vasile.pop
2019-12-23 14:42
has joined #general

ak.bhartiya
2019-12-23 18:29
Hi, i have been stuck with following situation.. Having api(/user) support 2 operation. 1. with post method creates a new user and return status code 200, and Created user id 2. With get method /user/{user-id} return user details How its possible to write contract test for both operation. How can i use user-id created with post method in get method.

matt.fellows
2019-12-23 22:08
@ak.bhartiya Each Pact test runs in isolation from every other test (i.e. it?s stateless in that sense). > How its possible to write contract test for both operation. How can i use user-id created with post method in get method You don?t do it this way in Pact. You simply have 2 tests, one for each scenario (the post and the get). Look up provider states to understand this further.

matt.fellows
2019-12-23 22:08
Just so we?re clear, what you want to cover is a totally normal use case, it?s just that you do it differently with Pact.

shilpa3006
2019-12-24 04:34
has joined #general

kbsachin01
2019-12-24 18:07
has joined #general

bethskurrie
2019-12-24 19:33
Yes, that's right.

sayboras
2019-12-28 00:32
has joined #general

sridevi_akshayapatra2
2019-12-30 01:14
has joined #general

sridevi_akshayapatra2
2019-12-30 02:15
Hi, I have a question regarding the PACT test for PUT method

sridevi_akshayapatra2
2019-12-30 02:15
I have to write a PACT test for PUT request method which has a path param, do I need to add any path param in the JSON file

sridevi_akshayapatra2
2019-12-30 02:16
Its throwing me assertion error saying expected status 200 and actual status 405

matt.fellows
2019-12-30 02:16
You absolutely need to include path params in the contract

sridevi_akshayapatra2
2019-12-30 02:17
Can you please assist me on how to add the path param

matt.fellows
2019-12-30 02:19
What language? And what have you tried?

matt.fellows
2019-12-30 02:19
We are talking about query strings yes?

sridevi_akshayapatra2
2019-12-30 02:21
Its Java and I am using JSON file for the request and response, in the JAVA test file i have used the annotation @PactFolder to include the Json file

sridevi_akshayapatra2
2019-12-30 02:21
In JSON i have added the consumer provider request response etc,

matt.fellows
2019-12-30 02:21
Have a look at the docs and see if there is anything related to query or path params

sridevi_akshayapatra2
2019-12-30 02:23
Do you want me to check here https://docs.pact.io/


matt.fellows
2019-12-30 02:24
You want the docs for Java don't you? It's all on the GitHub repository

sridevi_akshayapatra2
2019-12-30 02:26
Thanks will check

sridevi_akshayapatra2
2019-12-30 03:02
Hi, I am unable to figure out on how to add the path param even after going through the above mentioned link

sridevi_akshayapatra2
2019-12-30 03:02
My JSON has the following code

sridevi_akshayapatra2
2019-12-30 03:03
"request": { "method": "PUT", "path": /test/1234/testing", "headers": { "temp": "111", "Accept": "application/json", "Content-Type": "application/json" },

sridevi_akshayapatra2
2019-12-30 03:03
In the path, 1234 is the path param

sridevi_akshayapatra2
2019-12-30 03:03
how can I use matchPath for this

matt.fellows
2019-12-30 03:06
You might be better off asking this in the #pact-jvm channel

matt.fellows
2019-12-30 03:07
Also, show the code not the json file, and the actual errors you are getting

sridevi_akshayapatra2
2019-12-30 03:09
I can't show the code as it is confidential

matt.fellows
2019-12-30 03:10
Then all I can point you too are docs

matt.fellows
2019-12-30 03:10
How can I help correct if I can't know what you're doing?

matt.fellows
2019-12-30 03:11
Could you try creating an example with the problem that isn't confidential?

sridevi_akshayapatra2
2019-12-30 03:11
anyway the error i am getting is java.lang.AssertionError: 0 - Expected a response type of 'application/json' but the actual type was 'text/plain' 1 - assert expectedStatus == actualStatus | | | 200 | 405 false 2 - Expected a header 'Content-Type' but was missing

sridevi_akshayapatra2
2019-12-30 03:11
sure I can try creating an example

sridevi_akshayapatra2
2019-12-30 03:12
My main question is can we write pact for PUT method also, for me its working fine for POST and DEETE methods

matt.fellows
2019-12-30 03:13
Its the same for all. It's more likely your test case isn't actually making the request you told it to (i.e. a put to the path you registered)

sridevi_akshayapatra2
2019-12-30 03:16
I have 3 endpoints, the only difference is the POST and DELETE endpoints are straight forward but the PUT endpoint has a path param in the URI

matt.fellows
2019-12-30 03:17
Is this consumer or provider side?

matt.fellows
2019-12-30 03:18
If provider side, 405 is method not allowed. So it suggests your provider doesn't allow a PUT on that path (or at all)

sridevi_akshayapatra2
2019-12-30 03:20
Provider side

sridevi_akshayapatra2
2019-12-30 03:22
Its a PUT endpoint

sridevi_akshayapatra2
2019-12-30 03:22
could you please tell me what do you mean by provider doesn't allow a PUT on the path

matt.fellows
2019-12-30 03:28
We'll Pact will make a request to the path you have in that pact file. If your provider doesn't allow a PUT that's the HTTP response code I'd expect to see

matt.fellows
2019-12-30 03:28
Does your provider allow a PUT to that path?

sridevi_akshayapatra2
2019-12-30 03:31
yes it is allowing

sridevi_akshayapatra2
2019-12-30 03:31
our endpoint is consumed by othere services too

matt.fellows
2019-12-30 03:37
Did you delete your previous post? In any case, you need to investigate why your provider is not returning a 200 on that path. It's returning a 405 Without detailed logs and evidence that endpoint is responding to a request with that exact path I'm not sure how much I can help you

sridevi_akshayapatra2
2019-12-30 03:39
I didnt delete any of my posts

sridevi_akshayapatra2
2019-12-30 03:40
Here is the stacktrace I can provide you with

sridevi_akshayapatra2
2019-12-30 03:40
java.lang.AssertionError: 0 - Expected a response type of 'application/json' but the actual type was 'text/plain' 1 - assert expectedStatus == actualStatus | | | 200 | 405 false 2 - Expected a header 'Content-Type' but was missing at au.com.dius.pact.provider.junit.target.BaseTarget.getAssertionError(BaseTarget.java:90) at au.com.dius.pact.provider.junit.target.HttpTarget.testInteraction(HttpTarget.java:125) at http://au.com.dius.pact.provider.junit.InteractionRunner$2.evaluate(InteractionRunner.java:236) at http://au.com.dius.pact.provider.junit.RunStateChanges.evaluate(RunStateChanges.java:31) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at au.com.dius.pact.provider.junit.InteractionRunner.run(InteractionRunner.java:168) at http://au.com.dius.pact.provider.junit.PactRunner.runChild(PactRunner.kt:123) at http://au.com.dius.pact.provider.junit.PactRunner.runChild(PactRunner.kt:51) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

matt.fellows
2019-12-30 03:46
Thanks. The error is clear to me

sridevi_akshayapatra2
2019-12-30 03:46
Really

matt.fellows
2019-12-30 03:46
Yes

matt.fellows
2019-12-30 03:47
It's what I explained earlier. Maybe try a request to that endpoint not using Pact and see how it responds

matt.fellows
2019-12-30 03:48
Also, can you enable debug logs to see the request/ response

sridevi_akshayapatra2
2019-12-30 03:49
Do you mean direct hitting the endpoint in postman

matt.fellows
2019-12-30 03:51
Yes, That could help.

matt.fellows
2019-12-30 03:51
Ideally from your junit test starting the server in the same way

matt.fellows
2019-12-30 03:52
Something like rest assured or just with a simple HTTP client and long the request+ response

matt.fellows
2019-12-30 03:54
I have to run, but come back with some logs showing the request response and I'm sure someone will be able to help

sridevi_akshayapatra2
2019-12-30 03:56
ok sure....thanks for your help

sridevi_akshayapatra2
2019-12-30 04:12
I am getting 200 as response when i directly run the endpoint and JNUIT is also successful, only failing is while running PACT

sridevi_akshayapatra2
2019-12-30 04:12
If anyone has any solution please let me know...thanks in advance

matt.fellows
2019-12-30 04:25
Can you please show the request / response for the working hand failed examples?

sridevi_akshayapatra2
2019-12-30 13:58
Hello

sridevi_akshayapatra2
2019-12-30 14:53
Request is - { "acc1": ["111"], "acc2": ["222"], "acc3": ["333"], "version": "V10" } Response is - Status Code: 200 Message - Updated Successfully

sridevi_akshayapatra2
2019-12-30 14:53
Is this what you are asking me

matt.fellows
2019-12-31 02:38
I need the full path, method etx

matt.fellows
2019-12-31 02:39
I'd like to compare the request Pact makes to your server and the response, against what you sent to the server and it's response so we can compare

matt.fellows
2019-12-31 02:39
So the full http request and response

knkarthik20
2019-12-31 09:53
has joined #general

anshu1987
2019-12-31 10:22
has joined #general

uwe.regenhardt
2020-01-02 15:02
has joined #general

brent_jackson
2020-01-02 21:31
has joined #general

swaroopshere
2020-01-03 00:32
hello! im wondering if there is support for 'valueFromProviderState' usage in pact-jvm-consumer-java8 library? I am trying to define a json body in a POST request that takes certain string values dynamically

tjones
2020-01-03 00:33
Might be best to ask in #pact-jvm

tjones
2020-01-03 00:33
Oh, I see you already did. Sorry!

swaroopshere
2020-01-03 00:34
thank you for your response Tim, yeah i did post it on that channel, I will further clarify my question there :slightly_smiling_face:

gerrymcgovern
2020-01-03 15:49
Hi Guys ? I am attempting to create some pact tests for a service that consumes messages from a message queue. Would I be correct in thinking that for services like this setting up provider states is not a concern? My thinking is that unlike http services where you have a consumer and a provider, for services that consume messages from a queue you really only need to worry about testing how the services handles the message. Is this correct?

stein
2020-01-03 15:54
I guess if you have a service writing to the queue and another service reading from the queue you essentially have a consumer/provider relationship. So you could take the normal approach and model it that way - that?s what I?ve done in the past for message queues.

iaroslav.liashenko
2020-01-03 16:04
has joined #general

gerrymcgovern
2020-01-03 16:36
my thought was to put the sample messages that correspond to different scenarios I wish to test directly onto the message queue, (not using a service) so that the tests are easier to setup, no dependancy on an actual provider.

marcelo.emmerich
2020-01-03 22:16
has joined #general

marcelo.emmerich
2020-01-03 22:20
Hi Guys, I created a consumer pact for a Vue application, and am now trying to verify it with a MessageProviderPact that locally invokes the handler of a lambda function. When I try to verify the pact, I get the following error: no handler found for message undefined. Is it even possible to have the consumer be a http pact and the provider be a message pact?

stein
2020-01-03 23:27
I guess it?d be easier to setup, but what?s the point of using pact if both the provider and consumer aren?t verified from the same contract?

marcelo.emmerich
2020-01-04 11:49
nevermind, just wired a jasmine http mock around the lambda code and refactored the pact to be a http one and now it works

matt.fellows
2020-01-04 12:22
How does the lambda get invoked - via API gateway or direct (i.e. using the AWS SDK invoke operation)?

matt.fellows
2020-01-04 12:22
If the former, then it should be an HTTP pact. If the latter, a message pact.

matt.fellows
2020-01-04 12:23
You can't mix the two, or rather you probably shouldn't

marcelo.emmerich
2020-01-04 22:20
Thanks @matt.fellows. I actually have both types of lambdas, so I ended up writing http pacts for the api gateway ones and message pacts for the rest.

animesh.sahai08
2020-01-05 11:05
has joined #general

wliao
2020-01-06 00:00
has joined #general

prabhuramchennai
2020-01-06 16:55
There is a team which wants to switch from Spring cloud to PACT. Is there any migration library or project available?

matt.fellows
2020-01-06 21:06
Mmm not that I'm aware of. Why the move out of interest?

matt.fellows
2020-01-06 21:07
Tho being said. You can integrate SCC into the Pact broker which is therefore compatible with Pact. So you could slowly migrate over and technically have one side in SCC and the other in Pact

prabhuramchennai
2020-01-06 21:12
Change, as they more teams with different technologies are coming in...

prabhuramchennai
2020-01-06 21:14
Even if integrated through broker, starting point of SCC is to create the groovy file which creates the stub and Junit... but in PACT a piece of code creates the pact JSON... the approaches being different, what will be the center piece which binds PACT & SCC together? it cannot be contract file of the code which creates them, that's where the problem is.

matt.fellows
2020-01-06 21:55
The consumer team creates the pact file and the provider verifies it. So if the consumer was a SCC project it would publish to the broker and you could perform Pact verification on that (or vice versa). The groovy contract is serialised to JSON in pact format during publishing (I'm not across the details of how SCC does that tho)

matt.fellows
2020-01-06 21:55
So the pact file is the artifact we care about

bethskurrie
2020-01-07 04:11
Pop quiz. Has anyone every wondered why can-i-deploy has "Computer says yes/no" in the output?

matt.fellows
2020-01-07 04:13
I always assumed it was a tribute of sorts to Little Britain

bethskurrie
2020-01-07 04:13
Yes it is. But we have a very international audience, and I wondered how many people had actually heard of Little Britain!

david.wang3
2020-01-07 20:06
has joined #general

david.wang3
2020-01-07 20:08
can somebody show me how to set the tag when pushing a pact to the pact broker?

david.wang3
2020-01-07 20:09
i don?t see a tag parameter in the PUT api


david.wang3
2020-01-07 20:19
i?m using the python pact library by the way

matt.fellows
2020-01-07 21:23
See https://docs.pact.io/pact_broker/advanced_topics/using_tags in our docs (hint: something like PUT to this resource`/pacticipants/Foo/versions/2.3.0/tags/prod` )


david.wang3
2020-01-07 21:32
awesome great thanks!

franklin.huynh
2020-01-07 23:58
Hi team, I have a question regarding to consumer test. Should we include authentication header in the request such as X-Token? I have a feeling we should but would love to hear from you guys opinion.


franklin.huynh
2020-01-08 00:19
perfect. Thanks

matt.fellows
2020-01-08 01:27
Generally the answer is yes, but worth understanding the trade offs

franklin.huynh
2020-01-08 02:29
thanks for your answers. fyi I discussed with our dev and we agree to include them a bit of context > Perhaps handling the auth error cases in the Pact, and then bypass auth for the success cases would be easiest. > I?m specifically thinking about where there are extra auth behaviours than standard Authorization Header/Bearer token > (disclaimer: I forgot to mention these are for cases when they are non-standard - so not just 401/403)

matt.fellows
2020-01-08 02:40
That is reasonable

matt.fellows
2020-01-08 02:41
sometimes it?s too hard to actually do the validation/authentication, but if you can verify that the tokens are present and well formatted, that is good enough (assuming of course that you have a separate way of testing that autha/authz are properly covered)

matt.fellows
2020-01-08 02:42
FWIW the Golang workshop that we have uses this approach (see https://github.com/pact-foundation/pact-workshop-go/blob/master/provider/user_service_test.go#L48-L56 and the corresponding README)

franklin.huynh
2020-01-08 02:49
noted. Thanks for the sharing

kevin.meiresonne
2020-01-08 07:55
Goodmorning, Does anyone know if it's valuable/possible to create contracts using Pact for push notification-style interactions, where the server asynchronously pushes content to connected clients (e.g. SignalR)?

kevin.meiresonne
2020-01-08 08:06
Also, what is the current state of the Pact Specification Version 3.0?

bethskurrie
2020-01-08 08:31
V3 is implemented for JVM and rust. People keep volunteering to do Ruby, but then getting scared off.

bethskurrie
2020-01-08 08:31
You've seen message pact right?

bethskurrie
2020-01-08 08:31
You basically just right the pact for the message and ignore the protocol.

chen1055
2020-01-08 11:15
has joined #general

chen1055
2020-01-08 11:21
Hi guys Im working with `pact-jvm` with maven. Im wondering is it mandatory to start the provider before verifying the provider against the relevant consumer? is there a workaround for this? this is the part of the `pact-jvm-provider-maven` pom i am using: ```<plugin> <groupId>http://au.com.dius</groupId> <artifactId>pact-jvm-provider-maven</artifactId> <version>4.0.4</version> <executions> <execution> <id>some id</id> <phase>verify</phase> <goals> <goal>verify</goal> </goals> </execution> </executions> <configuration> <? some configs ?> </configuration> </plugin>```

chen1055
2020-01-08 11:25
the issue is that without the plugin pact testing work with the httptarget as localhost, the provider is started when the tests requires it to. but it stops working when the plugin is added to the pom.

wesleythomaswilliams
2020-01-08 12:00
I'm really new to this so take this with a pinch of salt, but my pom looks like: ``` <plugin> <groupId>http://au.com.dius</groupId> <artifactId>pact-jvm-provider-maven</artifactId> <version>4.0.4</version> <configuration> </configuration> </plugin>```

chen1055
2020-01-08 14:35
the thing is i think i need the pact to run on verify since i am populating some configuration based on properties generated by another plugin

kevin.meiresonne
2020-01-08 15:10
yeah


david.wang3
2020-01-08 21:12
can somebody help me with this particular use case. On the provider side, I?m using swagger mock validator to validate the pact files that I?ve downloaded for a particular consumer. This means that I don?t really need to have my provider service up and running and have the pact broker feed it the requests using pact-provider-verifier. How can I send verification results to the pact broker with this method?

bethskurrie
2020-01-08 21:13
You'll need to call the api directly.

david.wang3
2020-01-08 21:14
can u provide the api? I?m using the hal browser on the pact-broker, but I don?t know what the endpoint is

bethskurrie
2020-01-08 21:14
Yup, just finding the docs


david.wang3
2020-01-08 21:16
can u provide an example? what exactly is the endpoint here? Its not clear from the docs

david.wang3
2020-01-08 21:24
i don?t understand what this means? `pb:publish-verification-results` link (`$[?_links?][?pb:publish-verification-results?][?href?]`)

david.wang3
2020-01-08 21:24
is this ruby syntax? I?m not familar with ruby.

matt.fellows
2020-01-08 21:28
Yep, I?d use that as a basis. Message Pact is also supported in JS/Go


david.wang3
2020-01-08 21:29
I?m doing a contract test POC for my company. If upper management can be convinced to roll out contract testing. We could potentially use the pact broker SAS. Any help would be greatly appreciated! :slightly_smiling_face:

david.wang3
2020-01-08 22:07
ok i found some code here

david.wang3
2020-01-08 22:07
describe ?verification_publication_url? do context ?with no metadata? do subject { PactBrokerUrls.verification_publication_url(verification, base_url) } it { http://is_expected.to match_route_in_api(PactBroker::API) } it { http://is_expected.to eq ?http://example.org/pacts/provider/Bar%2FBar/consumer/Foo%2FFoo/pact-version/1234/metadata//verification-results? } end context ?with metadata? do subject { PactBrokerUrls.verification_publication_url(verification, base_url, ?abcd?) } it { http://is_expected.to match_route_in_api(PactBroker::API) } it { http://is_expected.to eq ?http://example.org/pacts/provider/Bar%2FBar/consumer/Foo%2FFoo/pact-version/1234/metadata/abcd/verification-results? } end end

david.wang3
2020-01-08 22:07
what is pact-version? is tha the consumer version? what is metadata abcd?


bethskurrie
2020-01-08 22:58
Don't look at what's in the URL

bethskurrie
2020-01-08 22:58
Just use it

bethskurrie
2020-01-08 23:00
You can't compose it. You have to get the pact, and then look up the verification url from it.

david.wang3
2020-01-08 23:00
yeah? I finally figured it out

david.wang3
2020-01-08 23:00
i was looking at the response from the GET and it had all the links

david.wang3
2020-01-08 23:01
how do I add the tag to the provider version when I publish the verification results

bethskurrie
2020-01-08 23:01
Look at the pact broker wiki. There's a page on using tags.

david.wang3
2020-01-08 23:02
those links basically tell you to use the provider library. It doesn?t tell you how to do it through the rest api

david.wang3
2020-01-08 23:02
When publishing verification results Your Pact provider library will allow you to set the ?provider version tags? that will be set for the relevant provider version when you publish your verification results. The recommended tag value to use is the name of your git branch, if applicable, or `dev`, if not.

bethskurrie
2020-01-08 23:02
In answer to your question about the pact version, it's the pact version :joy: behind the scenes, the broker versions the content for you.

bethskurrie
2020-01-08 23:03
There's a section that explains the urls

bethskurrie
2020-01-08 23:03
Keep going

bethskurrie
2020-01-08 23:04
"As an example, to tag Foo application version b5236e772 as the production version, do a PUT to the resource /pacticipants/Foo/versions/b5236e772/tags/prod. All the pacts and verifications associated with Foo version b5236e772 are now considered to be the production pacts/verifications. The latest production pact for provider Bar can be retrieved from /pacts/provider/Bar/consumer/Foo/latest/prod."

david.wang3
2020-01-08 23:05
so i have to call a sperate tag API after I publish the verficiation results?

bethskurrie
2020-01-08 23:06
Yes

david.wang3
2020-01-08 23:06
oik i thought i could just append the tag to the publish-verification results endpoint

bethskurrie
2020-01-08 23:06
If I was designing the api with the experience I have now, it would be all together. But you live and learn.

bethskurrie
2020-01-08 23:07
"Note that the tag is actually placed on the pacticipant version resource, not the pact itself (conceptually, you are indicating that that particular version of the application is a "prod" version, or a "feature-xyz" version). The URL structures, however, then allow you to retrieve pacts by the tags on their associated versions."

bethskurrie
2020-01-08 23:07
The tag doesn't belong to the verification result. It belongs to the pacticipant version resource.

bethskurrie
2020-01-08 23:08
Give that page a good read. It should make things clear.

david.wang3
2020-01-08 23:12
awesome.. got it working..

david.wang3
2020-01-08 23:12
thanks!

bethskurrie
2020-01-08 23:29
np

akkoubak
2020-01-09 00:13
@matt.fellows I am having trouble creating a PACT for a particular request using the .Net implementation of PACT. More specifically I am attempting to test a GraphQL POST request against a host server on this IP (http://52.188.176.147:4000). When running my dotnet test command, I am getting the following exception: ```System.Exception: 'There was a problem connecting to Provider API - {MYAPI}' - HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error )``` I am able to successfully test my ConsumerAPIClient which contains the following code: ```using Newtonsoft.Json; using RA; using System; using System.Collections.Generic; using http://System.Net; using http://System.Net.Http; using http://System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; namespace Consumer { public static class ConsumerApiClient { static public async Task<HttpResponseMessage> LocationQuery(string baseUri) { using (var client = new HttpClient { BaseAddress = new Uri(baseUri) }) { try { string json = JsonConvert.SerializeObject(new { query = "\n{\n locations {\n displayName\n }\n}" }); var content = new StringContent(json.ToString(), Encoding.UTF8, "application/json"); var response = await client.PostAsync($"{baseUri}", content); response.EnsureSuccessStatusCode(); return response; } catch (Exception ConnectionEx) { throw new Exception("There was a problem connecting to Provider API - LocationQuery.", ConnectionEx); } } } } }``` Here is my consumer test class: ``` using Xunit; using PactNet.Mocks.MockHttpService; using PactNet.Mocks.MockHttpService.Models; using Consumer; using System.Collections.Generic; using PactNet.Matchers; using RA; namespace tests { public class ConsumerPactTests : IClassFixture<ConsumerPactClassFixture> { private IMockProviderService _mockProviderService; private string _mockProviderServiceBaseUri; private int _mockProviderServiceBasePort; public ConsumerPactTests(ConsumerPactClassFixture fixture) { _mockProviderService = fixture.MockProviderService; _mockProviderService.ClearInteractions(); //NOTE: Clears any previously registered interactions before the test is run _mockProviderServiceBaseUri = fixture.MockProviderServiceBaseUri; // _mockProviderServiceBaseUri = "http://52.188.176.147:4000/"; } [Fact] public void LocationQuery() { // Arrange _mockProviderService.Given("There is no data") .UponReceiving("A valid POST request to validate location GraphQL") .With(new ProviderServiceRequest { Method = http://HttpVerb.Post, Path = "", //Query = "", Headers = new Dictionary<string, object> { { "Content-Type", "application/json" } }, Body = new { query = "\n{\n locations {\n displayName\n }\n}" } }) .WillRespondWith(new ProviderServiceResponse { Status = 200, Headers = new Dictionary<string, object> { { "Content-Type", "application/json; charset=utf-8" } }, Body = new { data = (new { locations = Match.MinType(new { displayName = "" }, 2) }) } }); // Act var result = ConsumerApiClient.LocationQuery(_mockProviderServiceBaseUri).GetAwaiter().GetResult(); var resultBodyText = result.Content.ReadAsStringAsync().GetAwaiter().GetResult().ToString(); ; // Assert Assert.Contains("data", resultBodyText); } } }``` I would appreciate your help on this issue.

bethskurrie
2020-01-09 00:58
Try asking in the pact-net channel. Matt isn't a maintainer of that lib.

akkoubak
2020-01-09 01:00
@bethskurrie My bad. I wasn't aware there was a dedicated channel for PactNet. Will post there. Thank you!

muppasaikarthik964
2020-01-09 09:26
has joined #general

bheemreddy181
2020-01-09 15:06
I want to hear some thoughts from folks here - As we are moving more towards contract testing do we completely eliminate Integrations tests from product side some times business or product folks want to see how things will appear for customers and we end up talking to micro services

wesleythomaswilliams
2020-01-09 15:24
Last Nov I joined a new company who had had unit, functional and E2E tests (they call them integration tests, but they're bigger than that). These E2E tests were really problematic for them and they asked me to look at solutions, hence contract testing. We're not ditching our E2E, but I want to reduce the amount as we build up our contract tests. For pure integration tests that literally focus on integrations between two micro-services, I may look to remove them entirely, but if you don't have E2E tests, I'd be tempted to add some at that point. I don't think there's a once size fits all solution for everyone though, but I'm still a firm believer in the testing pyramid.

david.wang3
2020-01-09 17:14
Are there is any sort of guidelines, documentation on how to use PACT with rabbitmq, kafka or any other type of event based messaging with python/java

alan.nichols
2020-01-09 17:29
Still new to this but your contracts will most likely be enforcing the correct type of result, String, Int etc. You will still need integration tests to ensure functionality works end to end or at an integration level.

david.wang3
2020-01-09 17:45
from what i can tell, messaging is supported with pactv3, but the python client only supports v2. can I use the standalone pact clients to support messaging for languages that only support pact v2?

bheemreddy181
2020-01-09 19:11
@alan.nichols I think we can still do functional testing between two services using contract testing but we shouldn?t be checking the boundaries , we should pick stable use cases for testing so

c.talek
2020-01-09 19:41
unit test for test your individual code (ex: junit, rest-assured) contract test your agreements between services (ex: pact) integration test your services working together (ex: postman) e2e test your services in the bigger picture (ex: postman, selenium) it really entirely depends on the foundation of your product and the ecosystem it runs in.. there are ways you can wiggle things around.. like asynchronous testing.. only running a select # of tests when doing commits vs pull requests vs pushing to prod..etc.. then amongst all of this testing for your feature, you'd have other quality gates.. ex: security/performance testing

bethskurrie
2020-01-09 22:26
@david.wang3 sorry, not yet :disappointed:

bethskurrie
2020-01-09 22:26
pactman might support messaging @richard.jones?

david.wang3
2020-01-09 22:56
I looked at pactman, but it only supports python 3 and unfortunately, we are only python 2.7.

bethskurrie
2020-01-09 22:57
Bummer.

bethskurrie
2020-01-09 22:57
So, the underlying ruby library actually supports the messaging part of v3, but not the new matchers.

bethskurrie
2020-01-09 22:57
it just needs someone to write the python wrapper part to support messaging.

david.wang3
2020-01-09 22:58
I was thinking of using this script for v3.


david.wang3
2020-01-09 23:00
but i?m not exactly sure how to get the mock service to send the message back to the test client

bethskurrie
2020-01-09 23:02
yeah, you'll need to have a look at how pact-js does it

bethskurrie
2020-01-09 23:03
which side are you looking at? consumer or provider?

david.wang3
2020-01-09 23:04
i?m looking at the consumer side for now.

david.wang3
2020-01-09 23:22
i looked at this example. and it looks like its retrieving the message from the mock service manually. i don?t think the mock service is actually sending anything to the test client.


david.wang3
2020-01-09 23:24
~i?m not sure what language this is. I think its nodejs, but i?m not familiar with that language either~

bethskurrie
2020-01-09 23:25
Sorry, I dont' have time to explain right now, but it basically makes a proxy to the http mock service.

bethskurrie
2020-01-09 23:25
if you want to make a time for us to discuss it I'm happy to explain it

david.wang3
2020-01-09 23:25
sure.. let me know when u are free? we can discuss


bethskurrie
2020-01-09 23:27
See if that helps.

bethskurrie
2020-01-09 23:27
Looks like you're 5 hours ahead of my timezone.

david.wang3
2020-01-09 23:31
i?m in California. PST

bethskurrie
2020-01-09 23:32
If you still have questions after working through the demo, then let me know and we'll work out a time.

matt.fellows
2020-01-09 23:33
I could walk you through it David, as I?ve done it for both JS and Go.

matt.fellows
2020-01-09 23:33
Have a read of the example above first and then we can chat

david.wang3
2020-01-09 23:34
cool? i go through the demo

david.wang3
2020-01-09 23:34
thx

matt.fellows
2020-01-09 23:34
The sequence diagrams and the link to https://gist.github.com/bethesque/c858e5c15649ae525ef0cc5264b8477c are probably the most insightful bits

david.wang3
2020-01-09 23:35
i gave a walkthrough of pact with my team using the rest api interface and the first thing they asked was if it supported events (rmq, kafka). So I wanted to get a real life implementation of that working for them.

matt.fellows
2020-01-09 23:35
Nice!

matt.fellows
2020-01-09 23:35
what was the general reaction?

bethskurrie
2020-01-09 23:35
It shouldn't be too much code - it's just a bit conceptually tricky to understand because we retrofitted it into our existing HTTP codebase.

david.wang3
2020-01-09 23:36
mixed? some people really liked it, but others were skeptical if it could actually replace/supplement integration tests.

david.wang3
2020-01-09 23:37
i?m personally convinced that contract tests is the way to go.

bethskurrie
2020-01-09 23:37
we should ask some people to write their stories

david.wang3
2020-01-09 23:38
we have all the ITs but they are so flakey and slow.. i hate them

bethskurrie
2020-01-09 23:39
Hey people. Is anyone interested in writing a blog post to feature on http://blog.pact.io talking about how Pact has helped reduce your reliance on integration tests (and hence, sped up your release cycle)?

bethskurrie
2020-01-09 23:39
It would really help new people who are sceptical of whether or not contract testing is a good idea or not.

matt.fellows
2020-01-09 23:40
If I had a $1 for every time I heard that?

david.wang3
2020-01-09 23:40
LOL

bethskurrie
2020-01-09 23:41
We'd have more money than we currently have in the Pact donations account...


bheemreddy181
2020-01-10 09:45
That?s what I mean when I said boundaries

bheemreddy181
2020-01-10 09:45
Contract tests are subset of functional tests

bheemreddy181
2020-01-10 09:46
Picking right use cases is very important for contract testing

bheemreddy181
2020-01-10 09:46
@alan.nichols ^

alan.nichols
2020-01-10 09:49
Agree with that for sure. To me it's a faster, cheaper way to catch some of the issues that functional tests would find, that also has the benefit of being run, monitored and maintained by the relevant team, rather than the client team catching these sort of problems. Very useful for things like apps that are consuming from APIs owned by many different teams.

rikeshgohil
2020-01-10 10:33
has joined #general

pavel.azarau
2020-01-10 22:24
Hey folks, I?ve got a Consumer CI workflow question. Will appreciate if you share how you handle such an issue. Given: we have consumers C1 and C2 and we have provider P1. P1 has contract tests related to C1 and C2. All the tests are configured with the following annotation: ```@PactBroker(host = "${pactbroker.host}", authentication = @PactBrokerAuth(token = "${pactbroker.auth.token}"), tags = "${pactbroker.tag}")``` When we raise a PR for C1 for a feature branch `Branch-1` our C1 CI job publishes contract with a tag Branch-1 and our web hook triggers P1 CI job passing the tag Branch-1 so that it is used to run P1 tests tags = ?${pactbroker.tag} (see provider tests annotation). So all the contract tests of P1 are run. And it?s fine for the tests which are related to C1 as we?ll be able to fetch the latests pacts with the tag Branch-1 (pacts/provider/P1/latest/branch-1). But the tests related to C2 will fail because there are no contracts related to C2 for such a tag/feature branch. One solution would be to use annotation @IgnoreNoPactsToVerify in C2 tests (and C1 tests accordingly). I wonder if there is another way? E.g. to pass the consumer via webhook call (${pactbroker.consumerName}) and then to execute only tests for that consumer? Thanks in advance!

pavel.azarau
2020-01-10 22:25
I?ll appreciate if anybody could point out docs where potential solution is described

bethskurrie
2020-01-11 01:45
Pavel this feature is coming soon, but is not currently supported that I know if in pact JVM

bethskurrie
2020-01-11 01:46
The upcoming feature will allow you to specify a fall back tag if the tag you're trying to get doesn't exist, for exactly this scenario

bethskurrie
2020-01-11 01:48
For builds triggered by webhooks, it's actually best to use the pact URL that you can get from the webhook body, so that you don't run all the verifications.

bethskurrie
2020-01-11 01:48
So you'd have a separate task that is just for webhooks, different from the one you run when your provider changes.


bethskurrie
2020-01-11 01:49
I'm actually not 100% sure if this is possible in Pact-JVM currently, as it's so annotation driven.

bethskurrie
2020-01-11 01:49
If it's not, can you raise it in the pact-jvm repository?

kevinkontcheu
2020-01-12 17:24
has joined #general

kevinkontcheu
2020-01-12 17:47
Hey Guy i'm new to pact and i have some questions. please can someone help me? I want to write the Tests on the consumer side( I habe a GET, a POST, and a PUT). How can i add many request type in the returned bilder??

kevinkontcheu
2020-01-12 17:48
``` @Pact(state = "a collection of 2 addresses", provider = "customerServiceProvider", consumer = "addressClient") public RequestResponsePact createAddressCollectionResourcePact(PactDslWithProvider builder) { return builder .given("a collection of 2 addresses") .uponReceiving("a request to the address collection resource") .path("/addresses/") .method("GET") .willRespondWith() .status(200) .body("...", "application/hal+json") .toPact(); }``` For example if i want to add a POST request here, do i need to just add a new .given .... and juste apply the toPact method at the end ?ß Thanks for the help

uglyog
2020-01-12 20:44
That?s correct. You can chain the interactions by adding another starting with .given

david.wang3
2020-01-12 23:21
question regarding the pact-message gem binary. does this internally spawn a mock-service instance and send the message pact file to mock-service. There?s not a whole lot of documentation on exactly what its doing.

david.wang3
2020-01-12 23:22
i see the the pact-go library uses it to support v3 message format

dlmiddlecote
2020-01-12 23:39
has joined #general

matt.fellows
2020-01-12 23:55
But you almost certainly don?t want to do a `GET` , `PUT` and a `POST` in the same interaction

matt.fellows
2020-01-12 23:55
Look at provider states

bethskurrie
2020-01-13 00:25
Yeah, sorry about that.

bethskurrie
2020-01-13 00:26
So, on the consumer side, there is no mock service.

bethskurrie
2020-01-13 00:27
The mock service is only used when there is a request/response. In the case of message pact, there's only a "response".

bethskurrie
2020-01-13 00:52
Welcome @dlmiddlecote

kevinkontcheu
2020-01-13 03:02
I don't want to have the request in the same interaction but in the same pact file at the end of my test. I also want to define one test for each request (GET, POST and PUT). please can you explain me more? have yoou some examples on how i can realise that? Thanks

uglyog
2020-01-13 03:22
If you use tests with the same provider and consumer names, they will be merged into the same pact file

david.wang3
2020-01-13 06:05
ok thanks.. I?m trying to add message support into pact python

bethskurrie
2020-01-13 06:23
Amazing stuff!

elliottmurray
2020-01-13 07:23
has joined #general

bethskurrie
2020-01-13 08:49
Hi @elliottmurray :wave::skin-tone-3:

pavel.azarau
2020-01-13 17:03
Thanks for the info! And it?s good to know about the upcoming feature. I?ll try to apply the suggested approach with pact URL and will raise the issue in case it?s not supported.

david.wang3
2020-01-13 17:28
is there a way to have pact-message update not overwrite an existing pact file? I have some rest test cases in addition to a message test case that is writing to the same pact json, but when I call pact-message to generate the json, it overwrites the existing pact file

david.wang3
2020-01-13 17:41
same thing with mock-service

david.wang3
2020-01-13 17:41
it deletes the existing pacfile before overwriting

david.wang3
2020-01-13 17:42
I suppose i can have seperate pact files for message and rest

david.wang3
2020-01-13 18:06
also, how does reify work. I ran it on the test_json and it gave me an error


david.wang3
2020-01-13 18:06
pact-message reify test_message.json Traceback (most recent call last): 10: from /usr/local/bin/pact-message:23:in `<main>' 9: from /usr/local/bin/pact-message:23:in `load? 8: from /var/lib/gems/2.5.0/gems/pact-message-0.6.0/bin/pact-message:3:in `<top (required)>' 7: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start? 6: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch? 5: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command? 4: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run? 3: from /var/lib/gems/2.5.0/gems/pact-message-0.6.0/lib/pact/message/cli.rb:24:in `reify? 2: from /usr/lib/ruby/2.5.0/json/common.rb:335:in `load? 1: from /usr/lib/ruby/2.5.0/json/common.rb:156:in `parse? /usr/lib/ruby/2.5.0/json/common.rb:156:in `parse?: 765: unexpected token at ?test_message.json? (JSON::ParserError)

mokbat
2020-01-13 20:21
has joined #general

pavel.azarau
2020-01-13 21:21
If anybody is interested, I was able to solve my issue by using Maven plugin https://github.com/DiUS/pact-jvm/tree/master/provider/pact-jvm-provider-maven (instead of Junit) as a runner. There are few ways of filtering interactions. In my case `pact.filter.consumers` has worked out.

bethskurrie
2020-01-13 21:22
Did you work out if you could use the pact URL from the webhook to run the verification?

bethskurrie
2020-01-13 21:22
For example, if you've got the verification hardcoded to verify certain tags, and a consumer pushes a new tag, your verification won't run the actually changed pact.

pavel.azarau
2020-01-13 21:28
I haven?t found the way to use URL to a certain pact. It doesn?t mean there is no such a way though :slightly_smiling_face: I?m not sure I?m getting your example. In both cases (annotations or plugin) there is a possibility to parametrize tags. And if you do so, in case of plugin there are certain ways to filter interactions by parameters passed via web hook and in case of annotations the upcoming feature should solve the problem

bethskurrie
2020-01-14 00:06
Just had a chat with Ron and he said there isn't a way to give it just a URL

bethskurrie
2020-01-14 00:06
I'm raising an issue for it, but he's got so many other issues, it's not likely to get picked up any time soon. We'll need a volunteer!

pavel.azarau
2020-01-14 00:10
thanks! well, it?s not that urgent as it seems there is a way to support a workflow described in the best practices by filtering interactions

bethskurrie
2020-01-14 00:10
Can you specify the tag dynamically?

bethskurrie
2020-01-14 00:10
So, if the consumer makes a new tag, you can pick that up?

bethskurrie
2020-01-14 00:12
Btw, would you be able to do a write up the way you've configured this? We often have people asking how to configure the webhook builds in pact-jvm, so it needs some example docs or a blog post badly.

pavel.azarau
2020-01-14 00:29
If I use `pact-jvm-provider-maven` I can specify a tag dynamically if I use only ONE tag. In this case I can use system property ${sometag} and pass it from CI using -Dsometag. And I?m getting the value from web hook because it supports the list of dynamic variables (and among them ${pactbroker.consumerVersionTags} ). So when Consumer publishes new tag web hook is triggered and the tag vaue is passed to Provider pact verification CI job

bethskurrie
2020-01-14 00:29
that makes sense.

bethskurrie
2020-01-14 00:29
Would you write a post about it for http://blog.pact.io?

pavel.azarau
2020-01-14 00:29
I need to finish this thing and then I?ll try to find tome to describe the final solution :slightly_smiling_face:

bethskurrie
2020-01-14 00:30
That would be awesome :slightly_smiling_face:

florian845
2020-01-14 15:49
has joined #general

anupamknw
2020-01-14 19:11
I have very a weird question. Please try to digest. Who generally writes CDC test - QA or Dev? n Why? Or Who should write?

matt.fellows
2020-01-14 19:41
There?s no absolutes. But usually a dev, because the tests live alongside the code (just like unit tests)

matt.fellows
2020-01-15 03:05
From memory, the reify takes a JSON input (not a file name)

bethskurrie
2020-01-15 03:06
correct

bethskurrie
2020-01-15 03:07
> is there a way to have pact-message update not overwrite an existing pact file? It should update the file, that doesn't sound right

bethskurrie
2020-01-15 03:07
in fact, I thought there was an issue because it only ever updated, and you had to clear it manually at the beginning of a test run

bethskurrie
2020-01-15 03:08
The mock service does deliberately delete the file, as it's meant to be started at the start of a test suite, and stopped at the end

bethskurrie
2020-01-15 03:08
if you're stopping and starting multiple mock services for the same file, something is strange

bethskurrie
2020-01-15 03:09
Just checked the code and the pact file write mode for the update is hardcoded to ":update"

bethskurrie
2020-01-15 03:10
Can you provide me an executable example showing me your issue with it overwriting the file @david.wang3

bethskurrie
2020-01-15 03:11
> I suppose i can have seperate pact files for message and rest Oooh, yes, they can't go in the same file.

bethskurrie
2020-01-15 03:11
The spec and the code don't support that.

bethskurrie
2020-01-15 03:11
We may support it in later versions, but we have other higher priorities atm.

simone.cusimano92
2020-01-15 08:11
has joined #general

simone.cusimano92
2020-01-15 08:30
Hi everyone :wave:

alan.nichols
2020-01-15 16:47
Hi everyone. I have a test that is generating a PACT for a PUT request with some values in the body of the request. (iOS app using the ruby standalone server). When I have a look at the PACT that is generated, all that is captured is the method and the path. I'm not sire if I'm doing something wrong.... Any ideas?

shero86
2020-01-15 16:49
Hi , did you check the log file?

alan.nichols
2020-01-15 16:55
Sorry just looked at the test for the 25th time and realised that even though the api call has the values set up, they aren't described in the .withRequest() when we configure the mock server.

alan.nichols
2020-01-15 16:58
I had assumed that the pact mock server would capture the request and add it to the contract, rather than me manually configuring it.

davchung5
2020-01-15 22:40
has joined #general

swaroopshere
2020-01-16 01:05
Hello Pact folks, I wrote the following contract using pact-jvm-consumer-junit5 library, and wrote a consumer side test against it. I think I have written the contract to allow variations in header values as well as variations in request body. ```return builder .given("Initial State") .uponReceiving("first request") .path("/abc/pqd/rest/createObjects") .method("POST") .matchHeader(SSL_CLIENT_SUBJECT_HEADER, SUBJECT_HEADER_VALUE) .matchHeader(CIPHERSUITE_HEADER,CIPHERSUITE_HEADER_VALUE) .matchHeader("Connection",".*") .matchHeader("Host",".*") .matchHeader("User-agent",".*") .matchHeader("Content-length",".*") .headers(requestHeaders) .headerFromProviderState("organization", ORG_ID_EXP,"blah") .body( new PactDslJsonBody() .object("animal") .stringType("animalId") .valueFromProviderState("keyId", KEY_EXP,"animalIdValue") .stringType("animalType") .object("contextParamMap") .stringType("initiationMethod","inbound") .stringType("vendorKey","value2") .stringType("from","1234567890") .stringType("startTime","2019-12-02T17:32:28Z") .stringType("to","8002345678") .closeObject() .closeObject() .array("participants") .object() .numberType("joinedTimestamp") .stringType("app") .numberType("notificationDelay") .valueFromProviderState("subject", D_EXP,"stateValue") .stringType("context") .booleanType("returnResponse") .closeObject() .closeArray() ) .willRespondWith() .status(200) .matchHeader("Content-Type","text/json;charset=UTF-8") .toPact();```

swaroopshere
2020-01-16 01:05
However, I am running into errors while recognizing the request. It appears that there is a body mismatch since the c.d.p.c.m.PlainTextBodyMatcher likely invokes exact matcher? Am I writing the contract to be too specific?

swaroopshere
2020-01-16 01:05
Following are the debug log lines -

swaroopshere
2020-01-16 01:05
```15:36:21.885 [Thread-17 ] DEBUG [-,,] [,] DEBUG c.d.p.c.m.PlainTextBodyMatcher : No regex for '{"animal":{"animalId":"string","keyId":"animalIdValue","contextParamMap":{"initiationMethod":"inbound","vendorCallKey":"value2","from":"1234567890","startTime":"2019-12-02T17:32:28Z","to":"8002345678"},"channelType":"string"},"participants":[{"joinedTimestamp":100,"app":"string","notificationDelay":100,"role":"string","subject":"stateValue","context":"string","returnResponse":true}]}', using equality : DEBUG [-,,] [,] DEBUG a.c.d.p.c.m.RequestMatching : Request mismatch: [BodyMismatch(expected={"animal":{"animalId":"string","keyId":"animalIdValue","contextParamMap":{"initiationMethod":"inbound","vendorCallKey":"value2","from":"1234567890","startTime":"2019-12-02T17:32:28Z","to":"8002345678"},"channelType":"string"},"participants":[{"joinedTimestamp":100,"app":"string","notificationDelay":100,"role":"string","subject":"stateValue","context":"string","returnResponse":true}]}, actual={"animal":{"animalId":"62a5908d-4aed-43c9-9c4a-a827a5538af4","keyId":"animalIdValue","contextParamMap":{"initiationMethod":"inbound","vendorCallKey":"value2","from":"1234567890","startTime":"2019-12-02T17:32:28Z","to":"8002345678"},"channelType":"Phone"},"participants":[{"joinedTimestamp":1579131381380,"app":"PHONE","notificationDelay":10000,"role":"Role","subject":"stateValue","context":"Context","returnResponse":false}]}, using equality but did not match, path=/, diff=null)] :```

swaroopshere
2020-01-16 01:07
#pact-jvm

uglyog
2020-01-16 01:11
You've overridden the Content-Type header with no actual value, you need it to be set to `application/json` so the matcher knows to match it as a JSON body

uglyog
2020-01-16 01:12
Either remove `.matchHeader("Content-length",".*")` or set it to `.matchHeader("Content-length",".*", "application/json")`

swaroopshere
2020-01-16 01:54
thank you @uglyog for your response. I tried both suggestions, removing the matchHeader as well as setting `application/json` in Content-length but running into the same error. I do want to mention that the content-type header in our actual request is set to `text/plain`

swaroopshere
2020-01-16 01:54
i wonder if that makes a difference

uglyog
2020-01-16 01:57
Oh, sorry, my mistake. It should be the Content-Type header. You should not change the Content-Length header, that could cause problems

uglyog
2020-01-16 01:58
Make sure you are not overwriting it

swaroopshere
2020-01-16 02:05
ok I updated the contract with ```.matchHeader("Content-type",".*")``` so it should now accept whatever the client sends (which is `text/plain`) . Now I run into the following error ```Request mismatch: [BodyTypeMismatch(expected=????, actual=text/plain)] : ```

swaroopshere
2020-01-16 02:07
im also ensuring that there are no header overrides

uglyog
2020-01-16 02:08
Don't use match header for the content type, or at least give it a valid value for the third parameter

swaroopshere
2020-01-16 02:27
ok, I now did ` ```.matchHeader("Content-type","text/plain; charset=UTF-8")``` and that got rid of the intermediate header mismatch errors. However, I am back to the BodyMismatch exception from the first post on this thread

uglyog
2020-01-16 02:28
not `text/plain`, `application/json`

swaroopshere
2020-01-16 02:29
if i set `application/json` i run into the headerMismatch Exception unfortunately. The client that we use has been overridden to set the content-type header to `text/plain`

uglyog
2020-01-16 02:30
If you use a plain text header, then the matcher will always think it is plain text and not JSON, and your body will not be matched correctly

uglyog
2020-01-16 02:31
> The client that we use has been overridden to set the content-type header to `text/plain`

uglyog
2020-01-16 02:31
That is a really bad thing to do

swaroopshere
2020-01-16 02:31
i see

swaroopshere
2020-01-16 02:35
while I wait for someone to make that fix in the client, is there a way to override the body processing as `application/json`

swaroopshere
2020-01-16 02:35
without actually setting the Content-type header

uglyog
2020-01-16 02:36
Unfortunately not

swaroopshere
2020-01-16 02:46
Got it. Thank you for all your help @uglyog !! really appreciate it

shanta.kumar
2020-01-16 07:37
has joined #general

wesleythomaswilliams
2020-01-16 13:52
Not sure whether this belongs in #general or #pact-jvm. In testing my provider, I wanted to double check a 404 test I've written is behaving correctly. The pact file interaction uses a query with a junk value for a parameter and expects a 404 back with no body. ```{ "description": "a request to get a thing", "request": { "method": "GET", "path": "/v1/search/find-by-identifier", "query": { "alias": [ "identifier" ], "value": [ "JUNK" ], "caller": [ "<my_consumer_service>" ] } }, "response": { "status": 404 }, "providerStates": [ { "name": "invalid identifier in query params" } ] }``` That seems pretty standard and passes just fine, but as part of figuring this all out, I thought I'd try instructing my provider to actually return a 200 and a body when testing this interaction, just to see what happens. This is what I get when I do: ```Given invalid identifier in query params a request to get a thing returns a response which has status code 404 (FAILED) has a matching body (OK)``` The reporting here seems wrong, so I just wanted to check if this is expected based on how pact works at the moment. The failure on the 404 is correct as the service returns a 200, but the matching body is incorrect as the pact file has no body and the service is now returning one. @uglyog or @bethskurrie is this something you can clear up for me please?

wesleythomaswilliams
2020-01-16 13:55
Our initial thoughts were that the body doesn't actually get checked if the status check fails.

brook
2020-01-16 15:17
has joined #general

david.wang3
2020-01-16 17:26
ok thanks.. i?ve put this on hold temporary, as I?m working on getting my current rest api pact tests integrated with my jenkins server. I?ll come back to in a few weeks as we still need to get event tests working for python

bethskurrie
2020-01-16 21:43
@wesleythomaswilliams if the body is not specified in the pact, then I think it is just not checked - so any body that is returned is considered ok.

bethskurrie
2020-01-16 21:43
It looks like in your pact, you're not specifying anything about the response body. Try specifying an empty string and see what you get.

bethskurrie
2020-01-16 21:45
Oh, that's a pity, someone just asked for it on a github issue. Do you have anything you can share? I might know someone who can pick it up @david.wang3

david.wang3
2020-01-16 22:06
yes I do have some code I can put up

david.wang3
2020-01-16 22:07
its not much but its a start

bethskurrie
2020-01-16 22:07
cool.

david.wang3
2020-01-16 22:07
i?ll try to clean it up a bit and put it tonight my time

bethskurrie
2020-01-16 22:08
cheers

bethskurrie
2020-01-16 22:14
Hi guys, we've been given a free Canny (feature request and prioritisation software) account for Pact. I'm hoping it will help us prioritise feature development better across our many many repositories. If you have a Pact feature request, please create an account and add it to the list, or go and vote on what you can see. Remember to specify which language you're talking about. https://pact.canny.io/

uglyog
2020-01-16 22:25
As @bethskurrie said. Specifying no body in the expectations means you don't care about the body. If you do care, add an appropriate value to the expectation

bethskurrie
2020-01-16 22:55
added an integration to this channel: https://pact-foundation.slack.com/services/BSRMH3JG4

wesleythomaswilliams
2020-01-16 22:56
Thanks both, I'll test with an empty body too, just to make absolutely sure, but it appears to be doing what you're saying. :+1:

2020-01-16 22:57
A new post has been created in *Feature Requests*

tjones
2020-01-16 22:57
I don?t know who this Tim Jones is, but I like his ideas.

tjones
2020-01-16 22:57
Ok, ok. It was me.

2020-01-16 22:59
A new comment has been created in *Feature Requests*

bethskurrie
2020-01-16 23:02
Ha

bethskurrie
2020-01-16 23:03
Not sure if this integration is going to be too noisy for general - if we don't like it, I can make a separate channel for it.

2020-01-16 23:21
A new comment has been created in *Feature Requests*

abubics
2020-01-16 23:38
`has a matching body` still seems a bit misleading :slightly_smiling_face:

fox_rul
2020-01-17 03:09
has joined #general

2020-01-17 04:49
A new post has been created in *Feature Requests*

2020-01-17 06:23
A new comment has been created in *Feature Requests*

2020-01-17 06:26
A new comment has been created in *Feature Requests*

nva
2020-01-17 09:53
has joined #general

2020-01-17 10:27
A post in *Feature Requests* hit *5 votes*

2020-01-17 12:55
A new post has been created in *Feature Requests*

r.roos
2020-01-17 13:08
has joined #general

josue.guerrero
2020-01-17 14:50
has joined #general

josue.guerrero
2020-01-17 15:28
Hello everyone, is there someone who works with microservices, RabbitMQ and Nodejs ?

chen1055
2020-01-19 04:37
Just curious is there a solution for pacts where a node is both a consumer and a provider? Basically there is three nodes, A, B and C. If A is a consumer of B, B is both a consumer of C and provider of A, C is the provider of B. How do I contract test node A using the contract test between node B and C?

bethskurrie
2020-01-19 04:37
@chen1055 let me find the gist I did on this


bethskurrie
2020-01-19 04:39
I personally would use some "shared fixtures" that were used in both the upstream test and downstream tests, to tie the two pacts together.

bethskurrie
2020-01-19 04:39
What language is the consumer/provider app written in?

chen1055
2020-01-19 04:44
Java

chen1055
2020-01-19 04:46
Seems like theres more work when a node is both a consumer and provider. Is there no way to use the same contract tests in node B for node A Contract tests?

bethskurrie
2020-01-19 04:57
Yes, people have done it.

bethskurrie
2020-01-19 04:57
In fact, BankWest wrote some code specifically for that.

bethskurrie
2020-01-19 04:57
I don't think they got to open source it however.

bethskurrie
2020-01-19 04:58
So, in the Ruby code, you can define a body outside of the scope of a 'given when then' and use it for both upstream and downstream tests. I don't know if you can do the same thing with Java or not.

chen1055
2020-01-19 05:00
I never tried. tbh I asked because I'm contract testing node B to node C recently and just realized I don't know how to expand to node A easily.

chen1055
2020-01-19 05:01
But thanks for the gist at least I have some idea and will try them.

matt400
2020-01-19 06:06
We use the same test for consumer and provider in the scenario you describe. Our junit tests will generate consumer contracts (pact mocking) and be a provider state (custom annotation) if the are Node B. I can't confirm if we can release our code as open source at this time.

2020-01-19 16:35
A new comment has been created in *Feature Requests*

bethskurrie
2020-01-19 21:36
You could try #pact-js @josue.guerrero

2020-01-19 22:06
A new comment has been created in *Feature Requests*

2020-01-19 22:19
A new comment has been created in *Feature Requests*

2020-01-19 22:53
A new post has been created in *Feature Requests*

2020-01-19 23:35
A new comment has been created in *Feature Requests*

bethskurrie
2020-01-19 23:57
I think the comments from Canny are getting a bit noisy, so I've made a #feature-requests channel to pipe all the comments to. The new features will still show up in general so that if anyone is interested, they know to jump in to canny to contribute.

ssong
2020-01-20 02:10
has joined #general

ssong
2020-01-20 02:12
Hi All, I have some questions about PACT junit 5 configuration, where should I ask the questions?

bethskurrie
2020-01-20 02:13
#pact-jvm @ssong

ssong
2020-01-20 02:17
Thanks

tjones
2020-01-20 05:06
Discussion question: How do *you* do your app versions so that they?re unique per contract?

chen1055
2020-01-20 09:28
Git commit hash?

2020-01-20 10:24
A post in *Feature Requests* has been marked as *in progress*

g.van.vliet
2020-01-20 14:24
has joined #general

josue.guerrero
2020-01-20 15:27
@bethskurrie thanks for answer Beth. I have another question. We are using different projects for each microservice. I should create a provider and a consumer for each project or depends which microservice is the consumer or the producer

sliu7
2020-01-21 04:10
Hey guys. I've been trying out some of the PactBroker webhooks and was trying to trigger a slack webhook when provider verification fails. When I test out the webhook using the execute endpoint, it works. But it doesn't seem to get triggered when the provider verification is failing in the CI pipeline. For the verification result, the 'Webhooks triggered by the publication of this verification result' is empty. Not sure if I'm missing some other config? Webhook configured: ```{ "description": "POST http://hooks.slack.com", "consumer": { "name": "TestConsumer" }, "provider": { "name": "TestProvider" }, "enabled": true, "request": { "method": "POST", "url": "slackwebhookurl", "headers": { "Content-Type": "application/json" }, "body": { "text": "Test pact verification failed" } }, "events": [ { "name": "provider_verification_failed" } ], "createdAt": "2020-01-20T23:53:23+00:00" }```

bethskurrie
2020-01-21 04:12
```provider_verification_failed``` is a very new feature - it's possible there's a bug in it.

bethskurrie
2020-01-21 04:12
I do remember testing it myself (as well as having automated tests), but there may be a corner case.

bethskurrie
2020-01-21 04:13
There are logs that print out that tell you which webhooks are being triggered for each event. Can you find them?

bethskurrie
2020-01-21 04:13
Also, best to ask these questions in the #pact-broker channel.

sliu7
2020-01-21 04:19
Ah, ok. I'll post it in the relevant channel. Thanks!

vinodkumar.bs57
2020-01-21 08:33
has joined #general

john.hamlett
2020-01-21 15:07
Quick question: So we are using pact in CI. If we run it every build, with a new tag, will the contract need to be revalidated every time even if no change has occurred to the pact file?

matthew.denvir
2020-01-21 15:11
has joined #general

anja.kammer
2020-01-21 15:51
has joined #general


raymond.burrowes
2020-01-21 17:04
has joined #general

john.hamlett
2020-01-21 19:10
Having a tough time convincing a coworker to go to pact, he says that if we have a microservice that is consumed by 10000 other microservices and each has a contract test that pact will have to run 10000 tests suites, is that correct?

brook
2020-01-21 19:13
yes. although the same endpoint can be used to satisfy multiple clients, the verification will still have to be completed for each client, so each contract will have to be tested. (I could be wrong, this is based on my experience)

brook
2020-01-21 19:13
Are these REST or AMQP endpoints?

john.hamlett
2020-01-21 19:15
REST

brook
2020-01-21 19:17
separate question: is this an extreme hypothetical? or realistic architecture consideration?

john.hamlett
2020-01-21 19:18
Hypothetical

john.hamlett
2020-01-21 19:18
His concern is that as the number of consumer increases the number of tests and time does also

brook
2020-01-21 19:18
okay? because my response to extreme hypothetical would be to turn the discussion back to ?why would we have 10K consumers? Is there a better design that we could implement?

john.hamlett
2020-01-21 19:19
Still does not get around the one to one relationship though

brook
2020-01-21 19:19
but to the point, yes? you have 2 tests for each consumer/provider interaction, the consumer contract test and the provider implementation verification.

brook
2020-01-21 19:20
but if you focus _solely_ on contract testing (and avoid sneaking in functional tests) they are very quick to write and run.

brook
2020-01-21 19:22
additionally, you should pick and choose which interactions you want to make contracts for. Although I lean towards contracts for all interactions. You may not need to write contracts for interactions within a domain (for example) and focus only on enterprise interactions (between domains) as a good starting place.

john.hamlett
2020-01-21 19:23
Agreed

brook
2020-01-21 19:26
(my opinion) governance is another ?-ility? that should be considered when designing a system. contract tests reduce risk at the added cost of writing and maintaining these tests. You should consider that when designing your system and it may impact how you partition your services.

erikpatekoski
2020-01-21 19:32
has joined #general

kkumar86
2020-01-21 20:05
has joined #general


wesleythomaswilliams
2020-01-21 20:46
@john.hamlett How would the colleague test them otherwise? I guarantee the other options for testing the integration of that many micro-services would be worse. :slightly_smiling_face:

matt.fellows
2020-01-21 21:11
In case you haven?t seen it, we also have this page that addresses some common questions/concerns (sometimes slightly tongue-in-cheek): https://docs.pact.io/faq/convinceme

bethskurrie
2020-01-21 21:16
@john.hamlett I'm actually on side with your colleague, in that if you had 1000 consumers, you're not really an "internal" api any more, you're a public api, and you would probably be best to use traditional versioning approaches. There's a section on "what is pact not good for" here https://docs.pact.io/getting_started/what_is_pact_good_for

bethskurrie
2020-01-21 21:19
I think he's falling for the slippery slope fallacy though, in thinking that "if contract testing doesn't work for 10000 consumers, we shouldn't use it when we have 3". You use the right tool for the right job, and your testing approach can and should change based on the situation your provider is in.

bethskurrie
2020-01-21 21:21
Thanks @kkumar86 where is the link from?

matt.fellows
2020-01-21 21:28
Actually, I think he?s straw manning to discredit the approach. But logical fallacies / arguments aside, you?re best going back to basics and assessing your testing strategy - and asking the question ?what problems do we have and how might contract testing change our approach?

matt.fellows
2020-01-21 21:30
I assume there is a reason you?re looking into contract testing, so you should be clear on the benefits and drawbacks, and any objectives of a change. Perhaps your colleague is really just a skeptic, and prefers to be really clear in his own mind. I can understand that. This article may also be of use in framing things: https://blog.pactflow.io/why-contract-testing/

matt.fellows
2020-01-21 21:31
As Wes mentioned, if the alternative is lengthy end-to-end tests, then we have a target and measures we can use to improve the situation, compare results etc.

kkumar86
2020-01-21 23:01
@bethskurrie it was hyperlinked on one of the pages .. will find out... but i found this article which i was looking for https://docs.pact.io/best_practices/consumer/contract_tests_not_functional_tests

nerea.tamayo
2020-01-22 08:35
Hi! I'm trying to implement CDC with Pact, and I have a question....For verifying Pact from the provider side, is it necessary that the provider is running?

bethskurrie
2020-01-22 08:36
Depends which language you're using @nerea.tamayo

bethskurrie
2020-01-22 08:37
Different implementations all you to verify at different levels. For example, with the Ruby implementation, you configure a Rack app, but it's not actually running a service on a port.

bethskurrie
2020-01-22 08:37
I believe JVM does a similar thing.

bethskurrie
2020-01-22 08:38
Other languages require that you have a running service, but it's best to use a local one not a deployed one.

bethskurrie
2020-01-22 08:38
Which verifier are you using?

nerea.tamayo
2020-01-22 08:39
At first, thanks a lot for your quick answer.I'm using JVM

nerea.tamayo
2020-01-22 08:40
but the idea is to introduce PACT through all company and we have a lot of different projects, but now I'm piloting the first project using JVM

bethskurrie
2020-01-22 08:40
Ask in the #pact-jvm channel then, someone will know. I'm pretty sure it calls the methods on the server directly without a process running, but you should confirm that.

nerea.tamayo
2020-01-22 08:41
Perfect!!!thanks a lot!!

bethskurrie
2020-01-22 08:41
Pact JVM can be tricky as there a lot of different ways to do things. The channel should help if you get stuck.

jgfarias42
2020-01-22 09:24
has joined #general

ankit992
2020-01-22 09:27
has joined #general

bethskurrie
2020-01-22 09:56
Sorry @josue.guerrero, I don't understand the question

mail259
2020-01-22 16:32
Hi, I am currently seeing all my github verification status to be reported as pending, is this because of the recent pending pact feature?

mail259
2020-01-22 16:32
I?m following the blog post but not entirely sure if the pending pact feature is enabled for me in pact broker: http://blog.pact.io/p/d7c9601f-e2ca-4208-b1c0-f02eaf96c3c2/

mail259
2020-01-22 16:33
Also not able to find any documentation around pending pact here: https://docs.pact.io/getting_started/pending-pacts

david.wang3
2020-01-22 16:57
when creating tags via the rest api, how do I specify multiple tags in the request url?

david.wang3
2020-01-22 16:57
`GET`, `PUT`, `DELETE` Path: `/pacticipants/{pacticipant}/versions/{version}/tags/{tag}`

david.wang3
2020-01-22 17:43
some questions on webhooks

david.wang3
2020-01-22 17:43
are webhooks meant to be created one time or on the fly?

david.wang3
2020-01-22 17:43
also, it seems like I cannot create a webhook for a consumer/provider pair if they don?t exist

david.wang3
2020-01-22 17:44
what i want to do is create a webhook, then publish my pactfiles and then have the webhook trigger my provider verification jenkins job. that doesn?t seem to work properly since I cannot create my webhook before I actually publish my pactfiles so that the pacticipants are created

matt.fellows
2020-01-22 21:27
It?s possible, maybe. It should be something that is opt-in, however in some testing I was doing yesterday it seemed like it was on by default

matt.fellows
2020-01-22 21:27
I need to prove/validate this though

matt.fellows
2020-01-22 21:27
but, it should only be ?pending? if the verification failed on something it hadn?t seen before

bethskurrie
2020-01-23 00:29
Hey @david.wang3

bethskurrie
2020-01-23 00:29
You can pre create the pacticipants to make this work.

bethskurrie
2020-01-23 00:30
Do a post to /pacticipants with a json body containing the name of the application

bethskurrie
2020-01-23 00:31
Typically, webooks get created once manually at the start of an integration, but there is a PR in play at the moment to support upserting a webhook so that the whole thing can be automated.

bethskurrie
2020-01-23 00:31
That way, the whole workflow can be scripted before you start, which sounds like what you want to do.

mail259
2020-01-23 03:21
Thanks for the reply. I?m using branch name as tags, and our pacts have not changed over weeks, though on the new pact broker, most of our statuses are shown as pending.

mail259
2020-01-23 03:23
We only trigger the verification step on contract_changed, though I manually run the verification against the pact on the develop branch to fix any failed verification in past which after completion did put the success tick on the github status. All the commits on develop after that are still in pending stage.

mail259
2020-01-23 03:26
Do you have suggestions on how to fix this? I was looking to revert the pact broker image to < v2.40 but it seems like migrations are causing the problem.

mail259
2020-01-23 03:28
Btw, I wanted to let you know that we all love pact at our company. It has made our move to micro services much easier :heart: Thanks for the support.

bethskurrie
2020-01-23 04:08
When creating a provider, I would create one "contract content changed" webhook, with no consumer specified, so that any consumer that adds a contract will automatically be picked up.

david.wang3
2020-01-23 04:08
thanks beth. actually I found out about the dynamic variables pactbroker.consumerName and pactbroker.providerName which means I c an pass that to my jenkins job.

bethskurrie
2020-01-23 04:08
When creating a consumer, I would create one "verification results published" webhook, with no provider specified, so that any new providers are automatically picked up.

david.wang3
2020-01-23 04:09
one question though

bethskurrie
2020-01-23 04:09
That's a good technique - one global webhook that passes the smarts on to a single jenkins job. This can be good when you're working out whether to trigger certain branches of things.

david.wang3
2020-01-23 04:09
how do I use consumerLabels and providerLabels dynamic variables?

bethskurrie
2020-01-23 04:09
They're not really used.

bethskurrie
2020-01-23 04:10
They're like tags for pacticipants.

david.wang3
2020-01-23 04:10
how do I set it?

bethskurrie
2020-01-23 04:10
I haven't really built any APIs on them yet.

david.wang3
2020-01-23 04:10
ok thats cool

bethskurrie
2020-01-23 04:11
Let me find the docs (if I wrote any)

bethskurrie
2020-01-23 04:12
Can't find any. From memory, it's just PUT /pacticipants/Foo/labels/bar

bethskurrie
2020-01-23 04:14
You can get them back by doing `/pacticipants/label/LABEL`

bethskurrie
2020-01-23 04:15
The plan was to use it for grouping pacticipants into business domains.

david.wang3
2020-01-23 04:17
```body = { "events": [{ "name": "contract_published" }], "request": { "method": "POST", "url": "https://acp-jenkins.arubathena.com/job/acp-qa/job/Multiapp/job/${pactbroker.providerName}/buildWithParameters?provider_branch_name=pact&pact_consumer_name=${pactbroker.consumerName}&pact_provider_name=${pactbroker.providerName}&consumer_tags=${pactbroker.consumerVersionTags}", "username": "xxxxx", "password": "xxxxxx", "headers": { "Accept": "application/json" } } }```

david.wang3
2020-01-23 04:17
i think this works well

david.wang3
2020-01-23 04:17
my jenkins job name is the pactbroker providername and then I pass in the various input parameters

bethskurrie
2020-01-23 04:17
sweet

david.wang3
2020-01-23 04:18
the main thing is the tag

david.wang3
2020-01-23 04:18
the consumer tag dictates what the provider branch would be

bethskurrie
2020-01-23 04:18
I notice that you're not using the pact URL to do the verification.

david.wang3
2020-01-23 04:19
not sure what you mean?

bethskurrie
2020-01-23 04:19
You only need to verify the pact that's changed.

david.wang3
2020-01-23 04:19
oh yeah? this is just for testing

bethskurrie
2020-01-23 04:19
Not all the pacts. The URL of the pact that has changed is one of the parameters.

david.wang3
2020-01-23 04:20
when I commit the code, i?ll change the event type

bethskurrie
2020-01-23 04:20
Having said that, not all the libraries support verifying a pact based on a dynamic URL (eg pact-jvm). There's an outstanding issue for this.

david.wang3
2020-01-23 04:20
contract_content_changed

bethskurrie
2020-01-23 04:21
Sorry, what I mean is, you don't want to run the full verification when only one pact has changed.

bethskurrie
2020-01-23 04:21
You only want to verify the one that has changed.

david.wang3
2020-01-23 04:21
right

david.wang3
2020-01-23 04:21
how do I do that?


bethskurrie
2020-01-23 04:22
The url of the changed pact is one of the parameters.

david.wang3
2020-01-23 04:23
oh i see

david.wang3
2020-01-23 04:23
pas the changed pact url to the jenkins job

bethskurrie
2020-01-23 04:23
yes

david.wang3
2020-01-23 04:23
got it

bethskurrie
2020-01-23 04:24
:thumbsup::skin-tone-3:


bethskurrie
2020-01-23 04:24
If you think that could be clearer, let me know how to improve it.

david.wang3
2020-01-23 04:24
i?m planning on doing a demo to my team tommorrow. hopefully with some real life examples they will be more convinced. and walking them through the entire workflow will be conving

martin.schneider
2020-01-23 05:08
has joined #general

mail259
2020-01-23 14:34
cc @matt.fellows @bethskurrie

ake
2020-01-24 12:26
has joined #general

krdurgesh28
2020-01-24 14:12
has joined #general

dmytro.garanzha
2020-01-25 22:30
has joined #general

david862
2020-01-26 00:16
Does anyone know of an example - for any language - of using the result of a generator (https://github.com/pact-foundation/pact-specification/tree/version-3#introduce-example-generators) within a `path`? I?m trying to understand if that?s even something that can be represented by a v3 pact file.

matt.fellows
2020-01-26 00:19
I think it is possible but haven't used pact JVM before. Is this helpful at all? https://blog.pactflow.io/injecting-values-from-provider-states/

hidalgofdz
2020-01-26 01:06
has joined #general

ian.mcwilliams
2020-01-27 17:22
Does anyone have any advice in implementing Pact in clusters where the individual repos are big monoliths? The stubbing strategy is a highlighted concern; this is discussed in a previous question (https://pact-foundation.slack.com/archives/C5F4KFKR8/p1571223440029200) and in a gist by @bethskurrie (https://gist.github.com/bethesque/43eef1bf47afea4445c8b8bdebf28df0), the challenge in this case is that the amount of stubbing that may be required could be too big a job to ask a team you are trying to work with to implement this type of testing

joseph.haig
2020-01-28 10:15
I have created a new contract with a service and uploaded it to our PACT server. The service provider hasn?t been set up yet, though, so the contract hasn?t been verified. Is it possible in the `pact-broker can-i-deploy` step to exclude this contract as it is causing the pipeline to fail? (We are retrospectively adding PACT to an existing service so it does exist. It is just the PACT that is not yet being verified)

wesleythomaswilliams
2020-01-28 10:23
I had a similar issue last week Joe. Our builds/tests are run by Maven, so I deleted the published pact and disabled publishing on the consumer side. My plan is to enable it once the provider side is ready.

joseph.haig
2020-01-28 10:31
Thanks. I think that is what I will have to do.

sagupta
2020-01-28 10:35
has joined #general

sagupta
2020-01-28 10:47
Hi , I just joined the slack group. May i know if there is a list of channel that i can refer to see which ones to join?

joseph.haig
2020-01-28 10:54
If you click on the word ?Channels? on the left (which will have ?# general? and ?# random? underneath) you are able to search for channels. This will give you a list of channels that match your search.

joseph.haig
2020-01-28 10:55
A slight issue with this (that has just become apparent) is that the team working on the provider want to get the contract from the server.

david862
2020-01-28 15:28
Yeah that?s really interesting, cheers. Looks like it?s definitely possible to use a generator result in a query parameter, but not sure about the path itself, e.g. /object/{generated_id}/. Would be really useful to us but since the spec v3 presents generators as overriding example values, I?m not sure how it could override just part of a path :shrug: We?re using python so we?d probably have to roll our own input/output logic here, but it could be worth it.

nathan.deamer
2020-01-28 16:10
Hey all, I am looking at setting up webhooks to force builds of my providers when contracts are changed.... The URL I have to hit to trigger a build is something like: https://someUrl.com/api/organization/repo?branch=master&access_token=<INSERT ACCESS TOKEN HERE> Can I use the pactflow secrets to store my access token and reference?


g.j.crossfield
2020-01-28 18:24
has joined #general

jana.pacheco
2020-01-28 18:41
has joined #general

bethskurrie
2020-01-28 19:11
@joseph.haig I've been meaning to support something like --allow-missing Foo for this scenario, but it hasn't gotten to the top of the priority list!

bethskurrie
2020-01-28 19:12
In the meantime, you can explicitly list your dependencies instead of using --to prod


bethskurrie
2020-01-28 19:18
@ian.mcwilliams if Pact doesn't make life easier than real integration tests, then maybe you're better sticking with integration tests, is my opinion.

bethskurrie
2020-01-28 19:20
If you're retrofitting pact onto existing code, rather that trying to cover every existing interaction, it might be easier to just start with new and changing interactions.

bethskurrie
2020-01-28 19:26
Some teams do do their verification against a deployed provider - this might be an option for you, even though it's not really the recommended approach, because you'll probably need to set up data in the downstream services in the provider states, and that could get messy.

bethskurrie
2020-01-28 19:27
It's all about trade-offs!

bethskurrie
2020-01-28 19:27
Working out which is the least painful option!

matt.fellows
2020-01-28 21:35
yes and yes :slightly_smiling_face:

bethskurrie
2020-01-29 05:38
@mail259 it's not enabled in the oss code yet, as im making sure we do a couple of trial client implementations before releasing it. I don't want to put the api out there and then have to making breaking changes.

bethskurrie
2020-01-29 05:40
I've only enabled it in http://pactflow.io for the alpha release. If you have one of pact js, pact ruby, pact net or pact go, you can try it out if you have a pactflow account.

bethskurrie
2020-01-29 05:42
@matt.fellows in the first release of the ruby standalone, pending was on by default. The most recent version has it disabled by default with a config to turn it on.

bethskurrie
2020-01-29 05:43
@mail259 when you say, most of your statuses are shown as pending, what do you mean?

bethskurrie
2020-01-29 05:43
Do you mean, the yellow state?

bethskurrie
2020-01-29 05:43
Github pending is not the same as pact pending.

elliottmurray
2020-01-29 05:44
Is there a ?best practices? on how to test integration with pact broker? I have made some changes to python around it?s provider options that now allow it to pull from a broker. But I?m really not sure how to get confidence it really works. It?s as if you need a broker and a provider running at once - have to check my contracts!


tjones
2020-01-29 05:46
Oh, wait, you?re asking how to test a pact implementation? Not how to integrate your provider tests with a broker?

elliottmurray
2020-01-29 05:46
yep!

elliottmurray
2020-01-29 05:46
Should have put in a bit of a Meta alert warning

tjones
2020-01-29 05:46
We don?t have a best practices for that

elliottmurray
2020-01-29 05:46
ok

bethskurrie
2020-01-29 05:46
ha

bethskurrie
2020-01-29 05:47
There are pacts between the pact broker clients and the pact broker


elliottmurray
2020-01-29 05:47
Just I?m spinning up a lot of docker containers to test os calls work

elliottmurray
2020-01-29 05:47
oh really?

bethskurrie
2020-01-29 05:47
yup!

bethskurrie
2020-01-29 05:47
We use pact to test pact.

elliottmurray
2020-01-29 05:47
let me look at e2e again

elliottmurray
2020-01-29 05:47
eating your own dog food?.

tjones
2020-01-29 05:47
yo-dawg.gif

elliottmurray
2020-01-29 05:47
drinking your own champagne?

bethskurrie
2020-01-29 05:48
So, in the pact broker client, I write a pact for the calls, then I use the pact to make a stub that I use for a "top to bottom" test of the CLI.

tjones
2020-01-29 05:48
We get around this in Pact-JS / Pact-Node by using the pact-broker client

tjones
2020-01-29 05:48
which we assume works

bethskurrie
2020-01-29 05:48
oh - yes, if you're in pact-python, then the pact-ruby-standalone has already been tested.

elliottmurray
2020-01-29 05:49
yeah I guess I?m nervous my changes are unit test mocked

elliottmurray
2020-01-29 05:49
but it?s hard to actually validate those initial tests are correct

elliottmurray
2020-01-29 05:49
if that makes sense

elliottmurray
2020-01-29 05:49
so am I calling pact broker client correctly?

tjones
2020-01-29 05:49
in JS land, we don?t validate that call

elliottmurray
2020-01-29 05:50
specifically that multiple consumer tags thing @bethskurrie

tjones
2020-01-29 05:50
This has been the source of bugs in the past

bethskurrie
2020-01-29 05:50
In a few of the projects I have a bash script that I use to test things out e2e against a live broker, but I don't automate a test against it.

elliottmurray
2020-01-29 05:50
thats what I want

tjones
2020-01-29 05:50
There is a test broker with test credentials you can use

elliottmurray
2020-01-29 05:50
Then once I have my tests correct I?m good

elliottmurray
2020-01-29 05:51
or that

tjones
2020-01-29 05:51
but if you do that, your tests rely on it :shrug:

bethskurrie
2020-01-29 05:51
Broker base URL: https://test.pact.dius.com.au username: dXfltyFMgNOFZAxr8io9wJ37iUpY42M password: O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1

elliottmurray
2020-01-29 05:51
I won?t automate

elliottmurray
2020-01-29 05:51
I just want to validate my unit tests are valid = especially when I?m wrapping unix system calls

elliottmurray
2020-01-29 05:51
thx


tjones
2020-01-29 05:53
Actually, have a look at the integration tests in pact-node

elliottmurray
2020-01-29 05:53
ok thx

tjones
2020-01-29 05:53
The history says I?ve touched it, but it?s a lie. It was just autoformat when I brought in `prettier`

elliottmurray
2020-01-29 05:54
lol

elliottmurray
2020-01-29 05:54
also @bethskurrie when you get a chance let me know what you think about what I?ve done with docker in python. I can help publish to dockerhub if you like too. It?s the only way i could test 2.7 locally

bethskurrie
2020-01-29 05:54
@mail259 if you think there might be a bug calculating the statuses, can you create a document that explains your CI set up, and get me a screenshot of the "index with tags" that has the incorrect status, and a screenshot of the matrix that shows the relevant versions.

elliottmurray
2020-01-29 05:54
I can do all other versions

elliottmurray
2020-01-29 05:55
I can give you a script to actually run it yourself (I?ll add if you like)

bethskurrie
2020-01-29 05:55
I have OSS day tomorrow, so I'll have a good look at it then.

elliottmurray
2020-01-29 05:55
:thumbsup:

bethskurrie
2020-01-29 05:59
The other thing that would help is if you did an export of your database, imported it, ran this script to redact it, and then sent me the file. https://github.com/pact-foundation/pact_broker/blob/master/script/prod/redact-data.sql

bethskurrie
2020-01-29 06:01
I have an OSS day tomorrow, so if you're able to get it to me by then, I can have a look at it. Best to raise an issue in the Pact Broker repository.

bethskurrie
2020-01-29 06:14
If you want to downgrade, you'll need to run migrations to reverse the database changes that got applied between 40 and your version


joseph.haig
2020-01-29 08:57
My command currently looks like this: ```pact-broker can-i-deploy --pacticipant $CONSUMER --version `cat git-version.txt` --pacticipant $PROVIDER --latest prod_env --broker-base-url $PACT_BROKER --broker-username $PACT_USER --broker-password $PACT_PASSWORD``` If I understand correctly, this is in the format to explicitly specify dependencies. However, it is also picking up the new provider, which is not yet ready.

fabio.iglesias
2020-01-29 08:59
Hello, We have a doubt regarding Error cases testing with Pact. In the docs it is stated that "unhappy paths" testing belong in functional tests, not in contract tests. However, in this same docs (https://docs.pact.io/best_practices/consumer/contract_tests_not_functional_tests) I can see that a simple, general error is included in the Pact content `So let's go back to our scenarios and instead choose just one simple example to test the way the _User Service_ reacts to bad input`. We have been trying to include some error response interactions as part of the pact with the utility from @pact-foundation/pact but error cases are never included in the Pact. Is there a way to enable the "unhappy path" inclusion so the BE can also be aware of such logic? Thank you beforehand

sagupta
2020-01-29 09:05
Hello people, i have just started reading about PACT to see if I can implement in my company. We have a microservice architecture in place and also we provide public API (for customers to consume) and also use external API (like Auth0) for authentication. Below are some questions: 1. As PACT is a consumer driven test, I was wondering if it is useful to have contract tests between external API (auth0) and my company as we do not have control over AUth0 and was wondering how would i test in that case.

sagupta
2020-01-29 09:07
2. We would like to have contract tests in place as we have multiple consumer consuming our services and the idea is to have tests fail whenever we as a provider change our contract . Also we want to make sure we do not break consumer and if possible break provider side only (and fix as it is in our control) Just wanted to know from you guys if this makes any sense ?

antonello
2020-01-29 09:26
Hi Fabio, hopefully this will clarify things a little. Unhappy paths, e.g. interactions that don?t lead to a 2XX response from a provider, should be included in the pact if they consumer uses them or relies on them. When the documentation talks about unhappy paths and functional testing it refers to that the fact that it would be ill advised to test for all possible permutations that would lead to a response that is the same from a contract point of view. Let?s say, for example, that a consumer expects a 400 response with a body like this when some fields are invalid ```{ "errors": [ { "field": "username", "error": "an error message" }, { "field": "firstname", "errror": "a different error message" } ] }```

bethskurrie
2020-01-29 09:28
Short answer, no, unfortunately. You'll find it covered here https://docs.pact.io/getting_started/what_is_pact_good_for

bethskurrie
2020-01-29 09:28
That is exactly what Pact is good for :+1:

sagupta
2020-01-29 09:29
ok great

bethskurrie
2020-01-29 09:29
:+1: Anto

bethskurrie
2020-01-29 09:30
You just need one example of an unhappy path, so you know what the shape of the document is.

sagupta
2020-01-29 09:30
ok got it so it works when you have provider and consumer both in your domain and in your control

antonello
2020-01-29 09:31
What you don?t want is to have a different interaction for all possible permutations of errors, but as Beth said, cover one example so that you can verify the shape of the document (+ the http status code).

bethskurrie
2020-01-29 09:31
Ha, I thought you'd gotten distracted. What Anto said ^^

bethskurrie
2020-01-29 09:32
I don't know what that utility class is.

bethskurrie
2020-01-29 09:33
There's nothing special about the error scenarios, you just declare them exactly the same as a normal one.

bethskurrie
2020-01-29 09:33
When I send a request with bad data with (example request) then I expect a 400 response (example response)

bethskurrie
2020-01-29 09:35
Think of it this way - you could mock the validation on the provider side during verification (if your library supported that) to return a 400 response, and it would be a perfectly valid test.

bethskurrie
2020-01-29 09:35
That's what we mean by saying it's not a "functional test".

bethskurrie
2020-01-29 09:37
It's generally just simpler to provide a stable "wrong" request to get the 400 response though.

bethskurrie
2020-01-29 09:37
You're trying to cover the "classes of errors", not every single thing that could lead to each error.

bethskurrie
2020-01-29 09:40
Exactly @sagupta

ian.mcwilliams
2020-01-29 09:40
Thanks for the feedback @bethskurrie!

bethskurrie
2020-01-29 09:41
Which is why internal microservices are the sweet spot for Pact.

bethskurrie
2020-01-29 09:42
That's not supposed to be happening then.

ian.mcwilliams
2020-01-29 09:42
Yes I agree that we must be open minded to the best solution for the problem at hand - currently I'm working with a colleague to list out and examine as many variations as we can think of

bethskurrie
2020-01-29 09:43
The format is correct. If it's picking up the new provider, there's a bug.

ian.mcwilliams
2020-01-29 09:43
I'd considered limiting the number of interactions under test, starting with new/changing interactions sounds like a good way for that to take form

bethskurrie
2020-01-29 09:44
Can you raise an issue in the Pact Broker and let me know the versions of everything (client and broker) and describe the dependencies between your services so I can recreate the data.

ian.mcwilliams
2020-01-29 09:45
The issue is really with removing the unreliability of downstream services when running the provider tests - so would require the provider to stub a call to a third party service for example

bethskurrie
2020-01-29 09:45
Run can I deploy with --verbose turned on, and send me the output, and the returned table.

joseph.haig
2020-01-29 09:45
OK. Is there a way to get verbose (or debugging) output from `pact-broker`?

joseph.haig
2020-01-29 09:45
You read my mind. :slightly_smiling_face:

ian.mcwilliams
2020-01-29 09:46
Which is fine but the provider team are raising a valid question about the amount of stubbing they'd need to maintain, given that their service is large and has a mess of dependencies!

bethskurrie
2020-01-29 09:47
Screenshots of the matrix tables with the relevant lines would help.

bethskurrie
2020-01-29 09:48
Sounds tricky :pensive:

bethskurrie
2020-01-29 09:49
Are you on the latest version of the broker? And the latest client?

bethskurrie
2020-01-29 09:50
I have an oss day tomorrow, so I'll hopefully be able to work it out.

ian.mcwilliams
2020-01-29 09:50
It's a situation we'll find in more than one team here, so finding the right solution should scale across the business - at the same time I'm looking to advocate for splitting services into smaller repos, but as you can imagine that'll be part of the long game :wink:

bethskurrie
2020-01-29 09:50
There's been a lot of change in there recently, trying to optimise the queries.

joseph.haig
2020-01-29 09:51
Our broker (I believe) is hosted at http://arnoldclark.pact.dius.com.au. Is there a way I can find the version from that page? The client is version 1.23.0.

bethskurrie
2020-01-29 09:51
I don't envy you! We've all been there.

bethskurrie
2020-01-29 09:51
Oh, it's the latest then.

bethskurrie
2020-01-29 09:51
You can find the version in the response headers.

ian.mcwilliams
2020-01-29 09:51
It's all in the game! And your advice is, as ever, much appreciated :+1::facepunch:

joseph.haig
2020-01-29 09:51
The pipeline has a `gem install` step so it should always be the latest.

bethskurrie
2020-01-29 09:51
Let us know how you go

joseph.haig
2020-01-29 09:53
2.44.0 - does that sound right for the broker version?

bethskurrie
2020-01-29 09:53
Yes.

bethskurrie
2020-01-29 09:53
Pactflow always has the latest

bethskurrie
2020-01-29 09:54
I put it out before I release the oss version to test it.

bethskurrie
2020-01-29 09:54
Just sent you a PM

ian.mcwilliams
2020-01-29 10:04
Will do @bethskurrie :slightly_smiling_face: I'm supporting @shero86 in this work so either of us will be around here and there I should think

fabio.iglesias
2020-01-29 11:21
Thank you @bethskurrie @antonello :slightly_smiling_face: this makes the issue much more clear to me.

fabio.iglesias
2020-01-29 11:22
I am using https://www.npmjs.com/package/@pact-foundation/pact-web in my consumer. I don't know if it is possible that I missconfigured something thus preventing the error contract cases from being added to the Pact

bernardoguerr
2020-01-29 12:43
One thing you could potentially do, if your external provider publishes a swagger/openapi spec of sorts, is just verify against a published version of that schema, with a tool like this: https://bitbucket.org/atlassian/swagger-mock-validator/src/master/ I actually work for Auth0, funny enough. I believe you can obtain the swagger docs for it from the management API documentation (https://auth0.com/docs/api/management/v2), not sure about the authorization endpoints . But if they are documented, then you can in theory setup a repo that pulls in that schema and validates using that tool, just like a provider repo would. It's not the full pact workflow, but it's something I think could be useful

sagupta
2020-01-29 13:54
Thats good input. I will see if I can use this info Thanks a lot :slightly_smiling_face:

elitusprime
2020-01-29 15:34
has joined #general

brook
2020-01-29 19:55
FWIW. we write pact against controller and mock out the service layer. This can run in memory as unit test. We use a separate ?publish? maven profile which would publish provider verification to the broker.

bethskurrie
2020-01-29 20:04
@fabio.iglesias can you create a little demo of the error interactions not being added please, and raise an issue in the github repository? There may be a bug if that is the case.

mail259
2020-01-29 20:54
https://pact-foundation.slack.com/archives/C5F4KFKR8/p1580276582021100?thread_ts=1579710728.040400&cid=C5F4KFKR8 I meant that 99% of our github statuses in the frontend/consumer repositories are reported as pending. This is updated via webhook on all pacts and the status being sent there is ?Pending?. This started happening when we updated the pact broker version to latest ( probably from v2.30.0 ).

mail259
2020-01-29 20:57
None of our pacts are failing or in pending state in UI. Everything is successfully verified but somehow the value of `${pactbroker.githubVerificationStatus}`is sent as pending and never being updated after that. We trigger our CI job only on pact change, so I assume if the pact has not changed, it should set the status as successful. None of our pacts are changed recently

matt.fellows
2020-01-29 22:55
> @Matt (http://Pactflow.io) in the first release of the ruby standalone, pending was on by default. The most recent version has it disabled by default with a config to turn it on. Thanks Beth. Yes, I had noticed this the other day. In fact, when I set the CLI flag either way it seemed to have no effect. I thought it was something I was doing, and wanted to do more investigation but ran out of time.

matt.fellows
2020-01-29 22:55
If I get to it this afternoon (Pact Go) I?ll confirm

sliu7
2020-01-29 23:14
Hey guys, Does anyone have experience with using Pact with GraphQL - specifically with a federation layer? <multiple independent GraphQL services> --- <GraphQL federation layer> --- <clients> The federation layer isn't the actual provider, but it acts like a gateway which stitches together data from the individual GraphQL services based on the query requested by the clients. Was wondering if Pact could be used in the scenario and if yes, at which layer would we include it? The clients can create the contracts based on the queries they use and the responses they expect to receive, but I'm a bit confused about where and how the verification could take place since the data returned from the query might span across different individual GraphQL services

mramos
2020-01-29 23:49
has joined #general

mramos
2020-01-29 23:58
hello everyone. I have an issue connecting to PactFlow using a nodeJS app. The credentials works fine when I do it manually as well as the token when I do curl command. I got this error in node app: `PactBroker::Client::Error - Authentication` `failed} One or more pacts failed to be published` Below is what in my publish opts: pactBroker: "<url>", pactBrokerUsername: "<username>", pactBrokerPassword: "<password>", pactBrokerToken: "<token>" Can you please advise? thanks.

bethskurrie
2020-01-29 23:59
You don't need a username and password, just the token.

bethskurrie
2020-01-29 23:59
Also, make sure you have the latest version of pact-js, as token support has only recently been added.

mramos
2020-01-30 00:00
oh thanks. I'll try that. cheers!

matt.fellows
2020-01-30 00:24
Sorry for any confusion. I?ve added stronger validation to pact node to error if somebody tries this: https://github.com/pact-foundation/pact-node/compare/chore/token-or-username-but-not-both?expand=1

mramos
2020-01-30 00:31
all good now. thanks a lot.

bethskurrie
2020-01-30 01:05
I'll double check the pending flag is being applied.

bethskurrie
2020-01-30 01:37
@matt.fellows I've fixed this - the broker was defaulting to true when unspecified (from my original plan to make this a no-code change opt-in), and the ruby code was only setting it to true if --enable-pending was set (from my new plan to require explicit opt-in), so it was always coming back with the pending info. Releasing the change now.

matt.fellows
2020-01-30 01:41
aha, makes sense

matt.fellows
2020-01-30 01:41
thanks Beth

mail259
2020-01-30 01:43
@bethskurrie Will that commit fix the issue that I?m seeing as well?

bethskurrie
2020-01-30 01:43
No, completely unrelated.

mail259
2020-01-30 01:43
Ahh okay, thanks

bethskurrie
2020-01-30 01:43
I'm hoping I'll get to your issue this afternoon.

mail259
2020-01-30 01:55
Matrix looks like this

mail259
2020-01-30 01:57
> get me a screenshot of the ?index with tags? that has the incorrect status, Sorry I?m not sure what do you mean by index with tags?

bethskurrie
2020-01-30 01:57
if you go to the index page, you can select "view with tags"

bethskurrie
2020-01-30 02:08
I agree, those pacts sure don't look like they're pending!

bethskurrie
2020-01-30 02:09
Can you raise an issue for me in https://github.com/pact-foundation/pact_broker and describe when your webhooks are firing?

mail259
2020-01-30 02:09
Sure I will do that

bethskurrie
2020-01-30 02:09
Can you tell if they're reporting the wrong status, or if the webhook that should set the status to green is not firing properly?

tjones
2020-01-30 06:02
The short answer is yes, you can use pact for this

tjones
2020-01-30 06:02
The longer answer to ?what layer? depends on your scenario (forgive my lack of GraphQL knowledge)

tjones
2020-01-30 06:02
what is the contract between in your case?

tjones
2020-01-30 06:02
To me, it sounds like it is between the client and the federation layer

tjones
2020-01-30 06:03
but it depends on how easy that is to set up for provider testing, and whether it is appropriate for whatever the federation layer does

tjones
2020-01-30 06:03
generally you don?t want your provider tests to test functionality

tjones
2020-01-30 06:04
is the federation layer doing any translation or mapping?

tjones
2020-01-30 06:04
or is it just joining responses together?

tjones
2020-01-30 06:04
You have A -> B -> C, where C is each individual service

tjones
2020-01-30 06:05
Ignoring the GraphQL angle, this is common with API gateways, too

tjones
2020-01-30 06:05
if your gateway is just passing through, you could simply test the contract between A -> C

tjones
2020-01-30 06:05
if your gateway is changing C?s response (or mutating headers), you might want to contract A-> B and B -> C


tjones
2020-01-30 06:08
I?ve also written consumer-only tests in the past. This ensures that your HTTP APIs are configured to produce the expected request. But without verification, it doesn?t ensure connectivity with the provider

sliu7
2020-01-30 06:16
yeah, it wouldn't be testing any functionality, but more to check where the schema is being adhered to. To the clients, it would be creating contracts with the gateway layer. But I'm just confused as to how the gateway would be able to verify the contracts

sliu7
2020-01-30 06:18
Because the individual services are registered with the gateway, which would stitch together the responses from the individual services based on the query received

sagupta
2020-01-30 14:01
So @tjones do you then think its still worth to have these or not?

fabio.iglesias
2020-01-30 15:38
Hi @bethskurrie , I have finally found my "missconfiguration". I was using the same content in several interactions for the field "uponReceiving". The tests were working fine but at the time of generating the pact only the first of several interactions with identical "uponReceiving" content was being included

fabio.iglesias
2020-01-30 15:39
That made my problem :sweat:

bethskurrie
2020-01-30 20:55
Ah, right!

tjones
2020-01-30 23:02
I personally do think they?re worth writing, but only if you don?t spend a great deal of time doing it. Here?s an example of a consumer-only test: https://github.com/TimothyJones/github-cognito-openid-wrapper/blob/master/src/github.pact.test.js

oscar821210
2020-02-02 20:09
has joined #general

juanma97perez
2020-02-03 11:27
has joined #general

juanma97perez
2020-02-03 11:28
Hello, I have a little dude

juanma97perez
2020-02-03 11:28
I want include headers in my request

juanma97perez
2020-02-03 11:28
``` Map<String, String> headers = new HashMap<>(); headers.put("Authorization", "Bearer eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJiNzkyMDAxNS01NjExLTQ5NWEtYjA2MS0wNmZkNWM5NGJiNTAiLCJuYmYiOjAsImlhdCI6MTU2NTY4MDU5NywiaXNzIjoiaXNzdWVyX2IiLCJhdWQiOiJpYmVyaWFfd2ViIiwic3ViIjoiMjBlYWI1ZjAtMjE0Yy00NDJlLWE3ODktODhmYzdkNzgzZmM4IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiaWJlcmlhX3dlYiIsInNlc3Npb25fc3RhdGUiOiJiZDlmZGVjYS0yYTVmLTQ1OTYtYTQ5MC01Zjc2MTUxMDkyOTEiLCJjbGllbnRfc2Vzc2lvbiI6ImJmOWRjOTRhLTcxZjAtNDViNS1iY2M4LTNkNzFiMmNmYzM0YSIsImFsbG93ZWQtb3JpZ2lucyI6W10sInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJST0xFX1JFVFJJRVZFX0RFTEFZRURfQkFHX1JFVElSRURfUkVDT1JEIiwiUk9MRV9DUkVBVEVfQ0xBSU0iLCJST0xFX0NMSUVOVF9XRUIiLCJST0xFX09STSIsIlJPTEVfQlBNIiwiUk9MRV9QTVQiLCJST0xFX0FWTSIsIlJPTEVfTE9DIiwiUk9MRV9SRVFVRVNUX0dDX0JBR19DTEFJTSIsIlJPTEVfQ0hFQ0tfUElSU1RBVFVTIiwiUk9MRV9BRFZNIiwiUk9MRV9SRVFVRVNUX1NVUFBPUlRfQ0FMTCIsIlJPTEVfUFJNIiwiUk9MRV9GQVNTIiwiUk9MRV9DVVNUIiwiUk9MRV9QQUNDIiwiUk9MRV9SRVRSSUVWRV9EQU1BR0VEX0JBR19SRVRJUkVEX1JFQ09SRCIsIlJPTEVfQVBJTSIsIlJPTEVfUkVUUklFVkVfREVMQVlFRF9CQUciLCJST0xFX1NFQVRTIiwiUk9MRV9SRVRSSUVWRV9EQU1BR0VEX0JBRyIsIlJPTEVfU1JWIiwiUk9MRV9HRVRfQ0xBSU1fU1RBVFVTIiwiUk9MRV9VU0VSIiwiUk9MRV9FVEVSTkFMIiwiUk9MRV9JTVBFUlNPTkFUSU9OIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiYWNjb3VudCI6eyJyb2xlcyI6WyJ2aWV3LXByb2ZpbGUiLCJtYW5hZ2UtYWNjb3VudCJdfX0sImVtYWlsIjoic2VydmljZS1hY2NvdW50LWliZXJpYV93ZWJAcGxhY2Vob2xkZXIub3JnIiwibmFtZSI6IiIsInByZWZlcnJlZF91c2VybmFtZSI6InNlcnZpY2UtYWNjb3VudC1pYmVyaWFfd2ViIiwiY2xpZW50QWRkcmVzcyI6IjE3Mi4yMS4yNTUuOCIsImNsaWVudEhvc3QiOiIxNzIuMjEuMjU1LjgiLCJjbGllbnRJZCI6ImliZXJpYV93ZWIifQ.jBPU5jYTx9J_3_STXpF9rXSluYhrqh7gxaZYH2nb-aMulQIKw-ElSG_VeI5WWvcsMwrMDUKS4DtFWMkXkmnMxw"); headers.put("Accept-Language", "es-ES"); return builder.given("get request") .uponReceiving("send get request") .path("/api/v1/locale/supported") .method("GET") .headers(headers) .willRespondWith() .status(200) .body(LambdaDsl.newJsonBody(o -> o .stringType("language", "es") .stringType("country", "ES") ).build()) .toPact(); }```

juanma97perez
2020-02-03 11:28
But, when I run this test I have the next error: java.lang.AssertionError: Pact Test function failed with an exception, possibly due to Mismatches(mismatches=[PartialMismatch(mismatches=[HeaderMismatch(headerKey=Accept-Language, expected=es-ES, actual=, mismatch=Expected a header 'Accept-Language' but was missing), HeaderMismatch(headerKey=Authorization, expected=Bearer eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJiNzkyMDAxNS01NjExLTQ5NWEtYjA2MS0wNmZkNWM5NGJiNTAiLCJuYmYiOjAsImlhdCI6MTU2NTY4MDU5NywiaXNzIjoiaXNzdWVyX2IiLCJhdWQiOiJpYmVyaWFfd2ViIiwic3ViIjoiMjBlYWI1ZjAtMjE0Yy00NDJlLWE3ODktODhmYzdkNzgzZmM4IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiaWJlcmlhX3dlYiIsInNlc3Npb25fc3RhdGUiOiJiZDlmZGVjYS0yYTVmLTQ1OTYtYTQ5MC01Zjc2MTUxMDkyOTEiLCJjbGllbnRfc2Vzc2lvbiI6ImJmOWRjOTRhLTcxZjAtNDViNS1iY2M4LTNkNzFiMmNmYzM0YSIsImFsbG93ZWQtb3JpZ2lucyI6W10sInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJST0xFX1JFVFJJRVZFX0RFTEFZRURfQkFHX1JFVElSRURfUkVDT1JEIiwiUk9MRV9DUkVBVEVfQ0xBSU0iLCJST0xFX0NMSUVOVF9XRUIiLCJST0xFX09STSIsIlJPTEVfQlBNIiwiUk9MRV9QTVQiLCJST0xFX0FWTSIsIlJPTEVfTE9DIiwiUk9MRV9SRVFVRVNUX0dDX0JBR19DTEFJTSIsIlJPTEVfQ0hFQ0tfUElSU1RBVFVTIiwiUk9MRV9BRFZNIiwiUk9MRV9SRVFVRVNUX1NVUFBPUlRfQ0FMTCIsIlJPTEVfUFJNIiwiUk9MRV9GQVNTIiwiUk9MRV9DVVNUIiwiUk9MRV9QQUNDIiwiUk9MRV9SRVRSSUVWRV9EQU1BR0VEX0JBR19SRVRJUkVEX1JFQ09SRCIsIlJPTEVfQVBJTSIsIlJPTEVfUkVUUklFVkVfREVMQVlFRF9CQUciLCJST0xFX1NFQVRTIiwiUk9MRV9SRVRSSUVWRV9EQU1BR0VEX0JBRyIsIlJPTEVfU1JWIiwiUk9MRV9HRVRfQ0xBSU1fU1RBVFVTIiwiUk9MRV9VU0VSIiwiUk9MRV9FVEVSTkFMIiwiUk9MRV9JTVBFUlNPTkFUSU9OIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiYWNjb3VudCI6eyJyb2xlcyI6WyJ2aWV3LXByb2ZpbGUiLCJtYW5hZ2UtYWNjb3VudCJdfX0sImVtYWlsIjoic2VydmljZS1hY2NvdW50LWliZXJpYV93ZWJAcGxhY2Vob2xkZXIub3JnIiwibmFtZSI6IiIsInByZWZlcnJlZF91c2VybmFtZSI6InNlcnZpY2UtYWNjb3VudC1pYmVyaWFfd2ViIiwiY2xpZW50QWRkcmVzcyI6IjE3Mi4yMS4yNTUuOCIsImNsaWVudEhvc3QiOiIxNzIuMjEuMjU1LjgiLCJjbGllbnRJZCI6ImliZXJpYV93ZWIifQ.jBPU5jYTx9J_3_STXpF9rXSluYhrqh7gxaZYH2nb-aMulQIKw-ElSG_VeI5WWvcsMwrMDUKS4DtFWMkXkmnMxw, actual=, mismatch=Expected a header 'Authorization' but was missing)])])

matt.fellows
2020-02-03 11:29
whoah, can you maybe format that correctly and also move to the laguage specific channel? (looks like #pact-jvm )

juanma97perez
2020-02-03 11:29
I don't understand, because, I'm only send a headers, not compare

juanma97perez
2020-02-03 11:29
without headers, run perfectly

juanma97perez
2020-02-03 11:29
Okay,

matt.fellows
2020-02-03 11:30
thx

matt.fellows
2020-02-03 11:31
the error looks clear to me though - the header `Accept-Language` is not present in the http request that your code sends

dalves
2020-02-03 15:55
has joined #general

dalves
2020-02-03 15:59
In your documentation, you make the following statement, "Something that could be useful, however, is to generate skeleton Pact test code from a Swagger document. If you're interested in working on this, have a chat to the maintainers on the Pact Slack." I am interested in finding your recommended way of doing this. Can you please help me?

tjones
2020-02-04 05:12
We don?t have a recommended way of autogenerating Pact test code from a Swagger document

tjones
2020-02-04 05:13
it?s challenging because an API spec is not the same as a contract (although they?re related)

tjones
2020-02-04 05:15
A lot would depend on exactly what is written in your spec - probably an ideal tool to convert a spec into a pact skeleton would have several configuration options

ihor.dobrovolskyi
2020-02-04 08:51
has joined #general

juanma97perez
2020-02-04 09:04
Hi

juanma97perez
2020-02-04 09:04
In version 3.6.0 of jvm-consumer-java8_2.11 not recognize PactProviderRuleMk2 and PactVerification

juanma97perez
2020-02-04 09:04
What happens??

matt.fellows
2020-02-04 09:42
Can you please ask in #pact-jvm?

ihor.dobrovolskyi
2020-02-04 09:52
Hello! I want to implement contract testing to my product. We have microsecvices archtecture. But after researching and creating a POC for developers, they told me that they do not want to write a code for pact file generation :slightly_smiling_face: But I cann't find any solutions for that. Can you help me with it please?

matt.fellows
2020-02-04 10:05
If you can find a solution we?d all be very interested. That sounds like Pact v2


simon.nizov
2020-02-04 10:09
@ihor.dobrovolskyi How is the team currently writing unit tests for the API clients in their services?

ihor.dobrovolskyi
2020-02-04 10:12
They are mock routes without startup an app

simon.nizov
2020-02-04 10:15
mock routes?

simon.nizov
2020-02-04 10:15
can you provide an example?

ihor.dobrovolskyi
2020-02-04 10:17
```Then("successfully created") Post(s"/limits/$uuid/deposit", HttpEntity(ContentTypes.`application/json`, LimitRequest(DefaultDuration, TotalDefaultAmount).asJson.printWith(Printer.noSpaces))) .withHeaders(operatorHeader) ~> comp.paymentLimitRoute ~> check { status shouldEqual StatusCodes.OK```

matt.fellows
2020-02-04 10:24
how do you ensure that the consumers of the APIs are in sync? End to end tests?

matt.fellows
2020-02-04 10:24
Sorry if that came across brash, it wasn?t intended.

matt.fellows
2020-02-04 10:25
This article has some tips on getting buy in from your colleagues

matt.fellows
2020-02-04 10:25
if they don?t see/feel the pain, it?s hard to get them acress

matt.fellows
2020-02-04 10:25
Pact is work, but it?s just visible work. Issues/incidents/bug fixing is less visible, but more painful and expensive

matt.fellows
2020-02-04 10:25
you need to make those things visible, and then writng some tests becomes an obvious answer

simon.nizov
2020-02-04 10:28
@ihor.dobrovolskyi If the team is already writing unit tests for the API clients and use mocks to define the expected response from the API, that?s exactly the process needed to create the pact json, just with a slightly different DSL. Unlike your current process however, Pact actually verifies those same expectations against the API makes sure everyone is on the same page.

simon.nizov
2020-02-04 10:29
maybe that?s an argument you can use in favor of pact

matt.fellows
2020-02-04 10:36
nice one Simon

simon.nizov
2020-02-04 10:37
:sunglasses:

joseph.haig
2020-02-04 12:07
I have a pact with a service provider that returns JSON. There is a deprecated field that I, as the client, am going to stop using. If I just remove it from the expected responses will this cause the providers pact verify step to fail until they remove it at their end? Or is the expected response that I specify assumed to be a subset of the actual response?

simon.nizov
2020-02-04 12:13
The verification won?t fail. If the provider responds with extra data that is not included in the pact that?s fine, it will be ignored.

joseph.haig
2020-02-04 12:13
Thanks.

samuel.hodgkinson
2020-02-04 16:41
When the `Feature Support` page (https://docs.pact.io/feature_support) says `Pact specification v3 matchers` are not supported in some languages, but `Verify a pact that uses the Pact specification v3 format` is supported in all of them, does this mean that you can't verify a pact which uses v3 matchers using PactNET for example?

bernardoguerr
2020-02-04 18:10
For anyone interested, I will be giving a workshop on Pact at the European Testing Conference (https://europeantestingconference.eu/2020/topics/#bernardo-guerreiro). I aim to cover some of the more confusing topics like provider states, versioning and tagging, and will try to work from a realistic scenario!

bethskurrie
2020-02-04 19:50
It will read the format @samuel.hodgkinson but it will ignore the matchers it can't understand

bethskurrie
2020-02-04 19:50
Any new matchers introduced in v3

asteffey
2020-02-04 20:21
has joined #general

uglyog
2020-02-04 21:38
It was renamed to just PactProviderRule

abubics
2020-02-04 22:43
It's designed that way so you can make non-breaking changes :ok_hand: otherwise every added/removed field would be breaking :scream:

sagupta
2020-02-05 08:40
Hello, Will this be recorded by any chance to follow later ?

bernardoguerr
2020-02-05 08:41
Hey @sagupta I'm actually not sure, I will post something here if it is.

sagupta
2020-02-05 08:42
cool thanks :slightly_smiling_face:

samuel.hodgkinson
2020-02-05 09:42
Okay, because we got the following error when reading a v3 pact for verification (PactNet): ```/pact-win32/lib/vendor/ruby/2.2.0/gems/pact-support-1.12.0/lib/pact/matching_rules/v3/merge.rb:110:in `[]': no implicit conversion of String into Integer (TypeError)```

samuel.hodgkinson
2020-02-05 09:43
I'm guessing it's best to just not use v3 until all providers we use support it fully

justaburneremailforso
2020-02-05 10:37
Hello, has anyone here tried to use pact with Kafka and Java? I've done a little work with pact and http restful services but nothing with Kafka. With the restful tests, my pacts always returned a RequestResponsePact. Am I correct to think that for Kafka, my pacts should be returning a MessagePact type? Thanks.


wesleythomaswilliams
2020-02-05 10:53
Not yet, but I'll be starting this week or next.

uglyog
2020-02-05 12:01
Message Pacts were developed for that use case. Here is a blog post I wrote about it https://dius.com.au/2017/09/22/contract-testing-serverless-and-asynchronous-applications/

justaburneremailforso
2020-02-06 13:25
Thanks, been reading that. Are there any examples of how to do this in Java?

justaburneremailforso
2020-02-06 13:44
Btw the GitHub links towards the bottom of that blog are broken.

rafael.negron
2020-02-06 15:01
has joined #general

karl
2020-02-06 15:53
Hi guys, quick question. What is the difference between pact-js and pact-node?

karl
2020-02-06 15:53
Why would I use pact-node in a node.js instead of pact-js, are there any advantages?

matt.fellows
2020-02-06 21:12
Pact JS is almost certainly what you want if you?re writing tests

matt.fellows
2020-02-06 21:12
Pact Node is the engine it uses under the hood to do stuff with Pact libraries. It?s mostly implementation detail

matt.fellows
2020-02-06 21:18
I?ve just responded to your issue, thanks for reporting

sagupta
2020-02-07 14:41
@here I do have the same situation. Can anyone provide advice on what @paul.simms mentioned

sagupta
2020-02-07 14:42
@bethskurrie @matt.fellows

sagupta
2020-02-07 14:50
This is my case 1. Shows the entire flow from frontend (forms) till backend micro services 2. Shows what I feel about how I can perform contract testing .The frontend to GraphQL can be done using pact graphql connection and the graphql to backend connection can be contract tested just like normal REST api contract test

kulik.olenka
2020-02-07 20:56
has joined #general


bernardoguerr
2020-02-07 22:23
Here are the slides. But no recording, sorry!

bethskurrie
2020-02-08 09:49
I don't have any graphql experience @sagupta but that seems to make sense.

bethskurrie
2020-02-08 09:50
It should support the v3 format @samuel.hodgkinson. Could you raise an issue with the pact (you can redact the specifics) that caused the error?

matt.fellows
2020-02-09 11:47
I would treat graphql like any other BFF (that?s basically what it is). It isn?t a proxy, it presents a completely new abstraction over existing APIs.

matt.fellows
2020-02-09 11:48
I?ve used Pact with GraphQL before and it certainly wasn?t redundant. Both sides of the GraphQL layer are not resilient to breaking API changes

matt.fellows
2020-02-09 11:48
So aside from it having it?s own format, it?s the same as RESTful HTTP APIs

matt.fellows
2020-02-09 11:49
TL;DR - what you said :slightly_smiling_face:

matt.fellows
2020-02-09 11:49
@paul.simms sorry I missed this when you posted

sagupta
2020-02-09 11:52
So you mean the idea of contract testing frontend and graphql && graphql to backend APIs is the right way ?

matt.fellows
2020-02-09 20:30
Yep!

ahmadw
2020-02-09 20:52
has joined #general

ahmadw
2020-02-10 06:16
Hi, i am new to Pact using java. i am facing few issues regarding testing the contract with deployed service.

ahmadw
2020-02-10 06:18
this is my consumer-pact and i am getting mismatch exception.

ahmadw
2020-02-10 06:18
```package com.pact.actual.maven; import http://au.com.dius.pact.consumer.Pact; import http://au.com.dius.pact.consumer.PactHttpsProviderRuleMk2; import http://au.com.dius.pact.consumer.PactProviderRuleMk2; import http://au.com.dius.pact.consumer.PactVerification; import http://au.com.dius.pact.consumer.dsl.PactDslWithProvider; import http://au.com.dius.pact.model.RequestResponsePact; import org.junit.Rule; import org.junit.Test; import org.springframework.http.*; import org.springframework.web.client.RestTemplate; import java.util.HashMap; import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; public class PactConsumerDrivenContractUnitTest { @Rule public PactProviderRuleMk2 mockProvider = new PactProviderRuleMk2("test-provider", "localhost", 8084, this); @Pact(consumer = "test_consumer") public RequestResponsePact createPact(PactDslWithProvider builder) { Map<String, String> headers = new HashMap<String, String>(); headers.put("Content-Type", "application/json"); return builder .given("test POST") .uponReceiving("POST Request") .path("/") .headers(headers) .method("POST") .body("{\n" + " \"otp\": \"566666\",\n" + " \"mobileNumber\": \"9715088833323\",\n" + " \"user\": \"CARD_DIGI_USER\",\n" + " \"originId\": \"AE\",\n" + " \"serviceId\": \"84\",\n" + " \"channel\": \"mobile\",\n" + " \"minutesToUnblockUser\": \"60\",\n" + " \"totalNumberOfRegenerationAllowed\": \"3\"\n" + "}") .willRespondWith() .status(200) .headers(headers) .body("{\n" + " \"data\": \"succeeded\",\n" + " \"responseStatus\": {\n" + " \"status\": 1,\n" + " \"description\": \"succeeded\"\n" + " }\n" + "}") .toPact(); } @Test @PactVerification() public void givenPost_whenSendRequest_shouldReturn200WithProperHeaderAndBody() { // when ResponseEntity<String> response = new RestTemplate().postForEntity(mockProvider.getUrl() + "/", "{\n" + " \"otp\": \"566666\",\n" + " \"mobileNumber\": \"9715088833333\",\n" + " \"user\": \"CARD_DIGI_USER\",\n" + " \"originId\": \"AE\",\n" + " \"serviceId\": \"84\",\n" + " \"channel\": \"mobile\",\n" + " \"minutesToUnblockUser\": \"60\",\n" + " \"totalNumberOfRegenerationAllowed\": \"3\"\n" + "}",String.class); // then assertThat(response.getStatusCode().value()).isEqualTo(200); assertThat(response.getHeaders() .get("Content-Type") .contains("application/json")) .isTrue(); assertThat(response.getBody()) .contains("{\"data\":\"succeeded\",\"responseStatus\":{\"description\":\"succeeded\",\"status\":1}}"); // and HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setContentType(MediaType.APPLICATION_JSON); String jsonBody = "{\n" + " \"data\": \"succeeded\",\n" + " \"responseStatus\": {\n" + " \"status\": 1,\n" + " \"description\": \"succeeded\"\n" + " }\n" + "}"; // when ResponseEntity<String> postResponse = new RestTemplate().exchange(mockProvider.getUrl() + "/", http://HttpMethod.POST, new HttpEntity<>(jsonBody, httpHeaders), String.class); // then assertThat(postResponse.getStatusCode().value()).isEqualTo(200); } }```

ahmadw
2020-02-10 06:18
and this is my provider: ```package com.pact.actual.maven; import http://au.com.dius.pact.provider.junit.PactRunner; import http://au.com.dius.pact.provider.junit.Provider; import http://au.com.dius.pact.provider.junit.State; import http://au.com.dius.pact.provider.junit.TargetRequestFilter; import http://au.com.dius.pact.provider.junit.loader.PactFolder; import au.com.dius.pact.provider.junit.target.HttpTarget; import au.com.dius.pact.provider.junit.target.Target; import au.com.dius.pact.provider.junit.target.TestTarget; import com.pact.actual.maven.model.MavenApplication; import org.apache.http.HttpRequest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.springframework.boot.SpringApplication; import http://java.io.Console; import java.util.Base64; import org.springframework.web.context.ConfigurableWebApplicationContext; import http://java.io.UnsupportedEncodingException; @RunWith(PactRunner.class) @Provider("test-provider") @PactFolder("target/pacts") public class ProviderEnd { @TestTarget public final Target target = new HttpTarget("https", "http://digital-dev.mashreq.com/api/otp-service/api/v1/otp", 8080,"/generate"); private static ConfigurableWebApplicationContext application; @TargetRequestFilter public void exampleRequestFilter (HttpRequest request) { request.addHeader("Authorization", "Basic T3RwVXNlcjpvdHBAMTIz"); request.addHeader("Content-Type", "application/json"); } private String base64StringOf(String username, String password) { return Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); } @BeforeClass public static void start() { application = (ConfigurableWebApplicationContext) SpringApplication.run(MavenApplication.class); } @State("test POST") public void toPostState() { } }```

ahmadw
2020-02-10 06:19
i am verifying an OTP contract followed by an authorization header. plus it?s a POST service so request body is included as well.

ahmadw
2020-02-10 08:22
Or any deployed service example with java would be beneficial.

bethskurrie
2020-02-10 08:24
Please, firstly, ask in #pact-jvm, and secondly, it's best to create an executable example that someone can clone and run in a docker container if you have a tricky code problem.

bethskurrie
2020-02-10 08:26
Just pasting a big block of code into slack is not the best way of getting help.

ahmadw
2020-02-10 08:26
okay sure, i will do that

matt.fellows
2020-02-10 11:48
So as noted on the SO answer, your API is up but is responding with a `404`. You need to find out why it?s returning a `404` instead of a `200`. Does it need some data setup before the request will work? The pact framework is currently executing the provider test, injecting the header and hitting your endpoint and then getting a response (as mentioned, I actually hit your API and got a 404 also).

matt.fellows
2020-02-10 11:49
If you need to setup data for the test, you may want to modify your `toPostState()` method to add data / state to the system under test

matt.fellows
2020-02-10 11:49
is there a reason why you can?t test it locally?

ahmadw
2020-02-10 11:49
i just check it, it is working

ahmadw
2020-02-10 11:49
i think i am missing request body

ahmadw
2020-02-10 11:50
but i am not able to insert body from consumer, is there any way to publish in pact?

matt.fellows
2020-02-10 11:51
Can you please share your pact file here?

me1015
2020-02-10 11:51
has joined #general

matt.fellows
2020-02-10 11:51
From what I can see, there should be a body in the request

ahmadw
2020-02-10 11:52
i put request body in the pact, but in assertion it is giving me mismatch error.

matt.fellows
2020-02-10 11:55
@ahmadw please share the pact file here (the generated file, not the source test)

matt.fellows
2020-02-10 11:56
let?s keep the chat here, to avoid polluting the general channel

matt.fellows
2020-02-10 11:56
:point_up: let?s carry on this in the thread i tagged you in

ahmadw
2020-02-10 11:56
yeah sure

ahmadw
2020-02-10 11:56
```{ "provider": { "name": "test-provider" }, "consumer": { "name": "test_consumer" }, "interactions": [ { "description": "POST Request", "request": { "method": "POST", "path": "/generate" }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "body": { "data": "succeeded", "responseStatus": { "description": "succeeded", "status": 1 } } }, "providerStates": [ { "name": "test POST" } ] } ], "metadata": { "pact-specification": { "version": "3.0.0" }, "pact-jvm": { "version": "3.5.0" } } }```

ahmadw
2020-02-10 11:57
i want to include request body too that?s why i am having 404 error

ahmadw
2020-02-10 11:57
but not be able to generate in pact file

matt.fellows
2020-02-10 12:02
hmm strange. I?m not super familiar with the Java DSL, but i?m guessing something in the setup is wrong


matt.fellows
2020-02-10 12:02
I think you might want `PactDslJsonBody` instead of the string? But could be wrong about that

ahmadw
2020-02-10 12:05
let me check with this one.

me1015
2020-02-10 12:12
Hey everyone, I have a provider in JS and consumer in Java, working with both (*pact-jvm* and *pact-js*(and mainly *pact-provider-verifier*) I am missing some features that *pact-jvm* has implemented. Did anyone try to write the bindings to Java version rather than the ruby version from JS?

me1015
2020-02-10 12:13
It might be faster than trying to fix the *pact-provider-verifier*

matt.fellows
2020-02-10 12:22
Heya! Not yet, but we are working on integrating to a rust one instead. Much smaller footprint and had all the same features now.

matt.fellows
2020-02-10 12:23
We're still a few months away from that is say

matt.fellows
2020-02-10 12:23
I'd*

me1015
2020-02-10 12:24
That?s amazing, i didn?t check the rust version, but will do in a future. We?re trying to implement Pact now to our workflow and have a few small issues - do you still accept PR?s on the current versions?

samuel.hodgkinson
2020-02-10 17:15
Realised this was an issue with `pact-ruby-standalone` so I've raised the issue there: https://github.com/pact-foundation/pact-ruby-standalone/issues/44

matt.fellows
2020-02-10 19:28
Of course!

ahsan_bhai
2020-02-10 19:39
has joined #general

ahsan_bhai
2020-02-10 19:44
I was reading the Pact docs (btw, really good job at documenting it on the web). I stumbled upon this particular bit: https://docs.pact.io/best_practices/consumer#avoid-using-pact-for-tests-that-involve-the-ui My Question: Is it being advised here that we don't even have UI as a consumer? Or this particular part is saying not use Pact for UI as a provider? We have our UI calling other backend micro-services. In that case, we would want UI to be the consumer and those services to be provider. Is it something we should do?

matt.fellows
2020-02-10 19:52
Yes that's totally fine. A react front end is a typical consumer

matt.fellows
2020-02-10 19:52
What we're saying is that you shouldn't test the API by invoking a web form in and end to end style test

matt.fellows
2020-02-10 19:53
Your code should be modular and have a component that talks to APIs - test that bit. Then you're not coupled to running the test in a browser and not coupled to your UI components

matt.fellows
2020-02-10 19:54
See docs on this page for a visualisation https://docs.pact.io/5-minute-getting-started-guide

ahsan_bhai
2020-02-10 19:54
that makes sense! Thanks for clarifying @matt.fellows

ahsan_bhai
2020-02-10 20:00
Another question: This time about PactBroker: My use case for PactBroker is this: 1. Public read access. So pacts could be verified in local builds 2. Write access only from CI pipelines. I am achieving this currently by enabling authentication in PactBroker and storing credentials as environment variables in Jenkins. These credentials are retrieved in `build.gradle` using the environment variables. Something like this: ``` systemProperty 'pact.broker.username', System.getenv('PACT_BROKER_USERNAME') ?: "fake-user" systemProperty 'pact.broker.password', System.getenv('PACT_BROKER_PASSWORD') ?: "fake-password"```

ahsan_bhai
2020-02-10 20:02
I am currently accessing the pact broker credentials via annotation like this: ```@PactBroker( host = "${pact.broker.host}", port = "${pact.broker.port}", tags = "${pact.consumer.tag}", authentication = @PactBrokerAuth(username = "${pact.broker.username}", password = "${pact.broker.password}")```

ahsan_bhai
2020-02-10 20:05
My question: For some reason we need to have the `pact.broker.username` and `pact.broker.password` always set for the tests to run successfully. If I remove the `?: "fake-user"` and `?: "fake-password"` , the test fails and complains about user name and password not set. Why does it require username and password when it should be able to read the pacts as they are public read access.

antonello
2020-02-10 21:05
Are there any decks from more recent presentations that are not listed here? If I?m not wrong, @bethskurrie and @matt.fellows, you?ve delivered some presentations recently at meet-ups. https://docs.pact.io/getting_started/further_reading

bethskurrie
2020-02-10 21:07
Yes. If you look on slideshare, you'll find some from recent conferences.

matt.fellows
2020-02-10 21:10
Are you setting those properties to the empty string or omitting them completely? Perhaps there's validation on the property value

ahsan_bhai
2020-02-10 21:18
omitting them completely. I think empty strings might work. haven't tested them yet. It looks weird to have those settings set when you have public read. If I don't add the `authentication` attribute in the `@PactBroker` annotation then offcourse it works. But I have a case where I need to publish the results to broker in CI pipelines

matt.fellows
2020-02-10 21:20
I'll double check if I've done some that aren't public and if so publish and let you know. There's been a few targeted brown bags for local companies that we've done and might need cleaning to publish

matt.fellows
2020-02-10 21:21
Sounds like a validation thing. You're telling the annotation to expect credentials but not supplying them.

ahsan_bhai
2020-02-10 21:22
yeah. I guess I'll have to pass either empty string or just fake credentials (like I am doing now) to get around it. I don't want local builds to be able to publish results

matt.fellows
2020-02-10 21:23
Yeah that's normal and should be easy - don't let local builds know the credentials :laughing:

ahsan_bhai
2020-02-10 21:23
also, how do I fail the gradle build if publishing the results fail for some reason? Currently the publishing silently fails but doesn't fail the gradle build.

ahsan_bhai
2020-02-10 21:25
for e.g.: incase of invalid credentials to PactBroker, the log would say 401 Unauthorized. but the build would be successful

ahsan_bhai
2020-02-10 21:26
btw, I am using my own PactBroker instance.

2020-02-10 23:27
A new post has been created in *Feature Requests*

matt.fellows
2020-02-10 23:29
I?m not sure, are you swallowing the exit code or something? That might be best asked in #pact-jvm anyway

cfaisalm
2020-02-11 00:44
has joined #general

ahmadw
2020-02-11 07:02
```package com.pact.actual.maven; import http://au.com.dius.pact.consumer.Pact; import http://au.com.dius.pact.consumer.PactProviderRuleMk2; import http://au.com.dius.pact.consumer.PactVerification; import http://au.com.dius.pact.consumer.dsl.PactDslJsonBody; import http://au.com.dius.pact.consumer.dsl.PactDslWithProvider; import http://au.com.dius.pact.model.RequestResponsePact; import org.junit.Rule; import org.junit.Test; import org.springframework.http.*; import org.springframework.web.client.RestTemplate; import java.util.HashMap; import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; public class PactConsumerDrivenContractUnitTest { @Rule public PactProviderRuleMk2 mockProvider = new PactProviderRuleMk2("test-provider", "localhost", 8084, this); @Pact(consumer = "test_consumer") public RequestResponsePact createPact(PactDslWithProvider builder) { Map<String, String> headers = new HashMap<String, String>(); headers.put("Content-Type", "application/json"); return builder .given("test POST") .uponReceiving("POST Request") .path("/") .headers(headers) .method("POST") .body(new PactDslJsonBody() .stringValue("otp", "56666") .stringValue("mobileNumber", "9715088833328") .stringValue("user", "CARD_DIGI_USER") .stringValue("originId", "AE") .stringValue("serviceId", "84") .stringValue("channel", "mobile") .stringValue("minutesToUnblockUser", "60") .numberValue("totalNumberOfRegenerationAllowed", 3) ) .willRespondWith() .status(200) .headers(headers) .body(new PactDslJsonBody() .stringValue("data", "succeeded") .object("responseStatus") .numberValue("status", 1) .stringValue("description", "succeeded") .closeObject() ) .toPact(); } @Test @PactVerification("test-provider") public void givenPost_whenSendRequest_shouldReturn200WithProperHeaderAndBody() { HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setContentType(MediaType.APPLICATION_JSON); String jsonBody = "{\"data\":\"succeeded\",\"responseStatus\":{\"description\":\"succeeded\",\"status\":1}}"; // when ResponseEntity<String> postResponse = new RestTemplate().exchange(mockProvider.getUrl() + "/", http://HttpMethod.POST, new HttpEntity<>(jsonBody, httpHeaders), String.class ); //then assertThat(postResponse.getStatusCode().value()).isEqualTo(200); HttpHeaders httpHeader = new HttpHeaders(); httpHeaders.setContentType(MediaType.APPLICATION_JSON); String requestBody = "{\n" + " \"otp\": \"566666\",\n" + " \"mobileNumber\": \"9715088833328\",\n" + " \"user\": \"CARD_DIGI_USER\",\n" + " \"originId\": \"AE\",\n" + " \"serviceId\": \"84\",\n" + " \"channel\": \"mobile\",\n" + " \"minutesToUnblockUser\": \"60\",\n" + " \"totalNumberOfRegenerationAllowed\": \"3\"\n" + "}"; // when ResponseEntity<String> postResponse1 = new RestTemplate().exchange(mockProvider.getUrl() + "/", http://HttpMethod.POST, new HttpEntity<>(requestBody, httpHeader), String.class ); //then assertThat(postResponse1.getStatusCode().value()).isEqualTo(200); } }```

ahmadw
2020-02-11 07:03
java.lang.AssertionError: Pact Test function failed with an exception, possibly due to Mismatches(mismatches=[PartialMismatch(mismatches=[BodyMismatch(Map(channel -> mobile, minutesToUnblockUser -> 60, otp -> 56666, mobileNumber -> 9715088833328, totalNumberOfRegenerationAllowed -> 3, serviceId -> 84, user -> CARD_DIGI_USER, originId -> AE),Map(data -> succeeded, responseStatus -> Map(description -> succeeded, status -> 1)),Some(Expected a Map with 8 elements but received 2 elements),$,Some({

ahmadw
2020-02-11 07:03
This is the error i am getting, am i doing something wrong in assertions?

paul.white
2020-02-11 09:03
has joined #general

ileshdarji
2020-02-11 11:04
has joined #general

ahmadw
2020-02-11 12:08
```{ "provider": { "name": "test-provider" }, "consumer": { "name": "test_consumer" }, "interactions": [ { "description": "POST Request", "request": { "method": "POST", "path": "/", "headers": { "Content-Type": "application/json" }, "body": { "channel": "mobile", "minutesToUnblockUser": "60", "mobileNumber": "9715088833328", "originId": "AE", "otp": "56666", "serviceId": "84", "totalNumberOfRegenerationAllowed": 3, "user": "CARD_DIGI_USER" } }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "body": { "data": "succeeded", "responseStatus": { "description": "succeeded", "status": 1 } } }, "providerStates": [ { "name": "test POST" } ] } ], "metadata": { "pact-specification": { "version": "3.0.0" }, "pact-jvm": { "version": "3.5.0" } } }```

ahmadw
2020-02-11 12:09
finally published the pact

matiass0003
2020-02-12 07:07
has joined #general

peter.mcintyre
2020-02-12 11:00
has joined #general

sagupta
2020-02-12 12:12
Hi people, A stupid question may be : What exactly is the need to use provider.verify(). What does it do? Anyway we are writing our tests which has assertions in it so what extra validation does this verify() method is doing? According to PACT JS ? ```validate the interactions you've registered and expected occurred // this will throw an error if it fails telling you what went wrong // This should be performed once per interaction test``` ?

davidmolinero.com
2020-02-12 14:21
Hi Folks, do you have any plans to fix this issue any time soon? `Pact verifier doesn't send DELETE requests with body correctly` https://github.com/pact-foundation/pact-ruby/issues/198

davidmolinero.com
2020-02-12 14:30
or a way to workaround it, I am currently using pact with nodejs

justaburneremailforso
2020-02-12 14:57
Hello, I'm looking at using the MessagePact class to create pact contracts for Kafka. I can get it to create the contract and return a message, however I'm not clear on how to test the message I get back. I can verify it's not null but I think ideally I'd want to verify the structure and/or data types in the message. Is there a way to convert/analyse the returned message? At present my contract just returns a MessagePactBuilder object with a body which is a PactDslJsonBody (is that correct?) and the body just contains a string and integer type. Thanks.

wesleythomaswilliams
2020-02-12 15:18
On the consumer side, you just need to validate that the complete message matches what you've specified e.g. https://github.com/DiUS/pact-jvm/blob/master/consumer/pact-jvm-consumer-junit5/src/test/java/au/com/dius/pact/consumer/junit5/AsyncMessageTest.java ``` PactDslJsonBody body = new PactDslJsonBody(); body.stringValue("testParam1", "value3"); body.stringValue("testParam2", "value4");``` ```assertThat(new String(pact.getMessages().get(0).contentsAsBytes()), is("{\"testParam1\":\"value3\",\"testParam2\":\"value4\"}")); } }``` As we're just interested in creating the contract for the provider and you control what the message looks like.

tomas.sakinis
2020-02-12 15:39
has joined #general

ryan.dens
2020-02-12 15:46
I ran into an interesting situation recently, and curious to hear about thoughts motivation. For context, I was using pact-jvm, but I found a test case which asserts this behavior in the pact-specification. 1. I modified an existing contract to support a new feature I was building, adding changing the expectations of the contract as necessary for the feature. 2. I implemented the feature in the consumer code until it was passing all of our tests. Part of implementing this feature included sending a new HTTP header to our API provider 3. My CI published the contract to our pact broker triggering a build in our provider to verify the changed contract, and the build failed. I looked at provider and consumer code alike and couldn?t figure out what was going wrong. Eventually I looked more closely at the contract that was being produced and noticed this contract was missing the header that I added in my client code in step #2. I added the header to the expectations of my contract and re-ran the test and it still passed. I (incorrectly) assumed this was a bug with pact-jvm, so I went about adding a test case to the pact-jvm-consumer project to reproduce my issue, when I stumbled across a test asserting the behavior that if the consumer sends a header that is not expected, the consumer test should still pass. I tracked the origin of the file to https://github.com/pact-foundation/pact-specification/blob/version-1/testcases/request/headers/unexpected%20header%20found.json This feels ideologically at odds with how I understand consumer driven contracts to work, but I realize that ideologies are often at odds with what people practically need. Have other people run into problems with this?

wayne.cavanagh
2020-02-12 16:35
has joined #general

me1015
2020-02-12 16:41
Nice, will have some in next weeks as we?re onboarding contracts! :slightly_smiling_face:

kyle.hammond
2020-02-12 17:13
During the setup of your test, you register with the mock server what URLs will be hit with what parameters, and what the server?s response will be. When you call `provider.verify()` the code asks the mock server if all of the URLs you registered were actually hit. This helps keep your tests to a minimum of setup and also ensures that your production code is hitting all of the endpoints you expect it to. Here is a more concrete example: 1. You set up the provider to expect URLs /foo and /bar to be hit and provide responses foo_response and bar_response respectively. 2. Your test code only hits /bar, and then asserts the things you want done with bar_response. 3. By looking at the tests you may think you?re testing /foo since you setup for that, but you?re actually not. `provider.verify()` would fail this test because /foo was not hit.

matt.fellows
2020-02-12 19:47
I think you referring to the breaking if postels laws for headers. If it was an attribute in the body it would have failed. I believe there was a good reason, albeit I can't recall at this moment why. Possibly because http clients often add extra headers that can't be controlled and we don't want those in the contract. But that's just a guess

matt.fellows
2020-02-12 19:48
Do continue to poke us if we don't get back to you quickly. Well support however we can

james.elsey
2020-02-12 23:07
has joined #general

ryan.dens
2020-02-12 23:14
> I believe there was a good reason, albeit I can?t recall at this moment why. Possibly because http clients often add extra headers that can?t be controlled and we don?t want those in the contract. But that?s just a guess That actually makes a lot of sense. I think this is not actually as bad as I initially thought. We aren?t capturing our http client header in our contract right now either and I?d rather not so I think that makes sense. Still learning all the concepts around postels law, thanks for the context!

ryan.dens
2020-02-12 23:15
some of our legacy APIs define important behavior defining things in the headers beyond the auth headers, which is a strange use case, so I think this is mostly on us

ryan.dens
2020-02-12 23:15
:thumbsup: thanks Matt!

sagupta
2020-02-13 07:45
Ohh so whenever provider.verify() is called ,then it checks if all the interactions created during setup are met or not

sagupta
2020-02-13 07:46
Is it then useful to call provider.verify() after each test.We could just call it after all tests as well,right ?

divyakiran
2020-02-13 15:09
has joined #general

adrian.deanda
2020-02-13 15:56
has joined #general

spencer.stewart
2020-02-13 16:46
has joined #general

pact501
2020-02-13 23:59
has joined #general

sumeshs572
2020-02-14 21:21
I see in doc how pact work it support HTTP and messages , curious to know is there any chance I can use it for SOAP web services ?

matt.fellows
2020-02-15 11:34
We don?t yet fully support XML matching across the libraries yet, although I believe Pact JVM and Rust have support for XML.

reverse9
2020-02-16 18:44
has joined #general

bethskurrie
2020-02-16 22:17
Just doing some diagrams for an advanced workshop, and thought I'd post them here for some feedback. This one shows the class involved in publishing pacts.

abubics
2020-02-16 22:29
"application that participants" -> "application that participates" :slightly_smiling_face:

bethskurrie
2020-02-16 22:29
ha!

bethskurrie
2020-02-16 22:29
thanks.

bethskurrie
2020-02-16 22:29
though, I just changed the text to `"Consumer" and "Provider" are roles that a pacticipant takes in a pact`

bethskurrie
2020-02-16 22:37
Verification results class diagram

bethskurrie
2020-02-16 22:50
Putting it all together

bethskurrie
2020-02-17 00:50
Tagging over time

baquinteros
2020-02-17 01:20
has joined #general

pvhau93
2020-02-17 02:08
has joined #general

2020-02-17 02:37
A post in *Feature Requests* has been marked as *under review*

2020-02-17 02:37
A new post has been created in *Feature Requests*

bethskurrie
2020-02-17 03:04
So... this diagram is technically a lie. But it's easier to understand than the technically correct ones.

bethskurrie
2020-02-17 03:17
I think this could be considered a business domain model, where as the first ones were class diagrams.

parveenbanu
2020-02-17 05:09
has joined #general

parveenbanu
2020-02-17 05:24
Hi, I got a request from my Lead to setup PACT for JS for our micro services

parveenbanu
2020-02-17 05:24
Can any one help me to do the same

parveenbanu
2020-02-17 05:25
i came all the documents related to that

parveenbanu
2020-02-17 05:25
But still need someone's help to setup it

abubics
2020-02-17 06:02
problem space vs solution space? :thinking_face:

abubics
2020-02-17 06:02
(I can't actually see the lines between the boxes in dark mode :P)

bethskurrie
2020-02-17 07:33
There are lines all over the place!

bethskurrie
2020-02-17 07:33
It is the liniest diagram ever.

bethskurrie
2020-02-17 07:36
@parveenbanu firstly, try the #pact-js channel. Secondly, please let us know what documents you have read. Thirdly, if you start by setting up a test microservice in a public github account, you'll find people will be able to help you much more easily than if you start with a closed source one. There's nothing more painful than someone copy pasting large quantities of code into the slack channel and just saying 'it doesn't work'!!!

matt.fellows
2020-02-17 09:34
There are examples in the pact-js repository, so I?d suggest starting there

matt.fellows
2020-02-17 09:34
there is also a workshop you can do in the repository to teach the concepts, that would be worth doing

matt.fellows
2020-02-17 09:35
Do you have access to the microservices code? Because the tests usually belong side-by-side with the code base

parveenbanu
2020-02-17 11:19
Hi Beth thanks for the link.

parveenbanu
2020-02-17 11:21
Hi Matt. I am from testing Background were i do API Testing with Postman. So management came up with this Contract Testing concept. so we choose PACT for that. I know how API Works and gone throw the 5 minutes guide for PACT and other pages over there.

parveenbanu
2020-02-17 11:22
I need to setup a prototype let it be public GITHUB account. may be once i understand the implementation i go for closed source

parveenbanu
2020-02-17 11:22
can anyone help me to set up that

parveenbanu
2020-02-17 11:23
primary set up would be fine. Later on i can build it up.

jonathan.ho
2020-02-17 13:36
has joined #general

dperez
2020-02-17 15:06
hi, will that workshop be available online later or any way to attend it online? I'm highly interested

koradrop
2020-02-17 15:57
has joined #general

yau.yik.shiung
2020-02-17 16:04
has joined #general

matt.fellows
2020-02-17 19:50
Possibly. We may publish the materials, but I'll make a note of it

matt.fellows
2020-02-17 21:23
Do you know how to write code in Node.JS and using tools like Mocha/Jest?

bethskurrie
2020-02-18 00:39
@parveenbanu typically, Pact tests are written by developers, or testers who are experienced in writing automated tests. See https://docs.pact.io/faq#who-would-typically-implement-pact Is your team lead aware of this?

parveenbanu
2020-02-18 04:21
@bethskurrie: I am from Automation Tester. Nothing is impossible. I can try writting the Code, if someone helps me up. API's are already developed by Developers and they are in JSON Format. Using that i need to develop Consumer and provider. IF anyone teach me to develop one set then i will make it.

parveenbanu
2020-02-18 04:21
@bethskurrie and @matt.fellows Please help me.

parveenbanu
2020-02-18 04:22
My API's are in Swagger.


matt.fellows
2020-02-18 06:53
There are examples in the Pact JS repository, can you use those as a basis? As noted above, the tests need to be written in the same repository as your API consumer (and provider, when you get to that). Forgive us if we don?t have the time to give everyone a personalised tutorial.

sagupta
2020-02-18 14:50
Hello people, So I got these questions from my team while giving a small demo of POC of PACT contract tests. I implemented a small API contract test between a consumer and a provider. I also used PACT broker and showed how can we use versioning and tagging to test consumer and provider. Also showed verification results being published back to PACT broker by provider. Now the questions: 1. Can you run PACT mock server in a docker container which can be used to execute calls and generate pact files. Currently I showed provider.setup() inside a test file and my team wants to know if we can do it more centrally? 2. Does Implementing contract tests means we have to get rid of existing integration tests with Postman? 3. Should PACT files be used for postman collections to execute integration tests? Can someone provide their inputs?Would like to know if they also came across such questions in their organisation.

bheemreddy181
2020-02-18 16:04
few of those will be answered from the thread here https://pact-foundation.slack.com/archives/C5F4KFKR8/p1578582397103600

bheemreddy181
2020-02-18 16:07
why do you want to run pact mock server in docker? pact mock server is pretty much unique for each provider service used in the consumer.

sagupta
2020-02-18 16:10
my team wants to run it inside docker as they feel , running it inside a docker with http server is much more realistic scenario in line with production. Also they would like to have one mock server (lets say pact server) for all consumers which will generate pact files

bheemreddy181
2020-02-18 18:56
your mock server is a provider from what I know you cannot have a single mock server for multiple providers

dperez
2020-02-18 21:36
Thanks @matt.fellows looking forward you are able to publish them

matt.fellows
2020-02-18 21:42
We discussed this yesterday, the current plan will be to publish them, sanitised of any customer specific items. We?ll share on Slack/social/docs.pact.io when the time comes

bethskurrie
2020-02-18 22:13
> IF anyone teach me to develop one set then i will make it. @parveenbanu we can help you with pact related things, but we can't teach you to develop over slack! You'll need to pair with a developer from your own company for this.

bethskurrie
2020-02-18 22:16
> running it inside a docker with http server is much more realistic scenario in line with production Contract testing is not about providing a realistic situation. It's about checking your requests and responses in an isolated environment.

bethskurrie
2020-02-18 22:16
> Also they would like to have one mock server (lets say pact server) for all consumers which will generate pact files

bethskurrie
2020-02-18 22:16
You can't do this.

bethskurrie
2020-02-18 22:16
Each mock service is only for one consumer.


bethskurrie
2020-02-18 22:17
> Can you run PACT mock server in a docker container which can be used to execute calls and generate pact files. Currently I showed provider.setup() inside a test file and my team wants to know if we can do it more centrally?

bethskurrie
2020-02-18 22:18
Yes, you can run the mock service in a docker container, however, it will increase the complexity of your tests, as the test framework is no longer able to manage the lifecycle of your mock service instances.

bethskurrie
2020-02-18 22:18
You would need to write custom code to start and stop each docker container, and you would need one docker container per consumer.


bethskurrie
2020-02-18 22:19
> Does Implementing contract tests means we have to get rid of existing integration tests with Postman?


bethskurrie
2020-02-18 22:20
> Should PACT files be used for postman collections to execute integration tests?

bethskurrie
2020-02-18 22:20
You could do this, for sure.

bethskurrie
2020-02-18 22:21
Would you be getting any extra benefit from it, over your existing tests though?

bethskurrie
2020-02-18 22:22
Using contract tests should mean that the boring "when I send this request, I get this response" kind of tests are already done. Your testers would now be better off spending their time on exploratory manual testing, rather than repeating existing automated tests.

2020-02-18 22:37
A new post has been created in *Feature Requests*

matt.fellows
2020-02-18 22:40
Anyone interested in Swagger + Pact, please discuss/vote on :point_up: and also consider joining #swagger-integration



bethskurrie
2020-02-18 22:43
The introduction of contract testing allows you to reduce your integrated and e2e tests - but how much they reduce them depends heavily on your situation. Some teams skip the integrated and e2e tests altogether, and some teams keep a smaller set that is focussed on the "business value" scenarios rather than the "is this request/response right" kind of scenarios.

bethskurrie
2020-02-19 03:04
I gave one of the first questions some more thought, and have a more detailed answer now.

bethskurrie
2020-02-19 03:04
Q. My team wants to run the application inside docker as they feel that running it inside a docker with http server is much more realistic scenario in line with production. A. Contract testing is not about providing a realistic situation. It's about testing your requests and responses in focussed way, isolating the application under test from causes of failure that are unrelated to the contents of the requests and responses (eg. networking issues, deployment problems, race conditions, downstream service unavailability) The types of tests that are about providing realistic situations are end-to-end tests, smoke tests, canary tests, performance tests etc. Incidentally, these types of tests are really bad at checking request/response correctness because their scope is so broad, it's hard to tell exactly what has gone wrong when something fails.

parveenbanu
2020-02-19 05:01
@bethskurrie Sure Beth. I will develop one set of Consumer JS script with my developer and then will come back to you

parveenbanu
2020-02-19 05:01
Anything else i need to have before starting pact.

bethskurrie
2020-02-19 05:02
I'd recommend reading the docs thoroughly, as they really will help. Even if you don't take everything in, at least you'll have a better idea of where to go when you have issues.

bethskurrie
2020-02-19 05:02
Look at the examples in the pact-js github repository.

parveenbanu
2020-02-19 05:03
The example throwing me error. Tried yesterday.

parveenbanu
2020-02-19 05:03
something like this

parveenbanu
2020-02-19 05:03
npm update check failed ? [0] ? Try running with sudo or get access ? [0] ? sudo chown -R $USER:$(id -gn $USER) C:\Users\parveenbanu\.config

bethskurrie
2020-02-19 05:03
:thinking_face:

bethskurrie
2020-02-19 05:03
Well, that's a good place to start!

bethskurrie
2020-02-19 05:04
I'd put that into stackoverflow

bethskurrie
2020-02-19 05:04
nothing to do with pact.

bethskurrie
2020-02-19 05:04
it's about your local machine and your npm set up.

parveenbanu
2020-02-19 05:04
And saying CI=true is not recognised

parveenbanu
2020-02-19 05:04
consumer@0.1.0 test C:\GIT Samples\pact-workshop-js-master_New\consumer > CI=true react-scripts test 'CI' is not recognized as an internal or external command, operable program or batch file.

parveenbanu
2020-02-19 05:05
Okie

parveenbanu
2020-02-19 05:05
checking on that. and also working on Javascript to call our existing API

parveenbanu
2020-02-19 05:05
once the script is ready i will insert the Pact sets into it..

bethskurrie
2020-02-19 05:05
I'd start with making sure the examples worked properly before trying your own stuff.

parveenbanu
2020-02-19 05:06
and see weather the Contract file is generating or not

parveenbanu
2020-02-19 05:06
Yes

parveenbanu
2020-02-19 05:06
Example should work first

bethskurrie
2020-02-19 05:06
:thumbsup::skin-tone-3:

parveenbanu
2020-02-19 05:06
working on that.

parveenbanu
2020-02-19 05:06
:slightly_smiling_face:

parveenbanu
2020-02-19 05:06
thanks for the support Beth.

parveenbanu
2020-02-19 05:07
I will learn Pact soon:)

parveenbanu
2020-02-19 05:09
:nerd_face:

sagupta
2020-02-19 07:41
This is indeed what was looking for .Thanks Beth and bheem for detailed explanation .Let me mention these points to my team and see what they have to say

bethskurrie
2020-02-19 07:42
:thumbsup::skin-tone-3:

mail961
2020-02-19 07:44
has joined #general

dominik
2020-02-19 07:53
has joined #general

robin.vanwijngaarden_
2020-02-19 12:01
has joined #general

sumeshs572
2020-02-19 15:45
How we can make sure the matching rules are published in pact broker and exists from swagger , current the matching rules are not displayed in pact broker console any where thanks in advance

thomas.shipley
2020-02-19 17:44
has joined #general

matt.fellows
2020-02-19 21:07
what does ?exist from swagger? mean?

matt.fellows
2020-02-19 21:08
The matching rules are always published to the broker, what makes you think they aren?t?

sumeshs572
2020-02-19 21:09
Wanted to double check latest pact published have all matching rules

aorumbayev
2020-02-19 22:56
has joined #general

aorumbayev
2020-02-19 23:43
Greetings to all community members of Pact Foundations! :slightly_smiling_face: Is there a generic language-independent approach for using message pacts (async messages kafka and etc). Example scenario: ? Given 2 microservices implemented in Python and communicating via Kafka I would like to use pact for contract testings -> the pact-python implementation currently doesnt support v3 specs, are there any alternatives ?

bethskurrie
2020-02-20 00:03
I can't remember where the pact python impl was at.

bethskurrie
2020-02-20 00:03
See if someone knows on #pact-python

bethskurrie
2020-02-20 00:04
There's not heaps of work to be done, but it is conceptually tricky to understand how to implement it.

bethskurrie
2020-02-20 00:05
If you use the new UI, then you can expand the matching rules section to see them.

bethskurrie
2020-02-20 00:05
Otherwise you can view it in the Hal browser.

bethskurrie
2020-02-20 00:05
Copy the link of the Pact, click on the "api browser" button on the top right, and the paste the URL into the api location bar.

bethskurrie
2020-02-20 00:08
If you can't see the matching rules link, there aren't any.

sumeshs572
2020-02-20 00:29
New UI option I did not see I will confirm version of pact broker I am using

sumeshs572
2020-02-20 00:29
Thanks for the information :+1:

tausif2909
2020-02-20 04:47
has joined #general

sagupta
2020-02-20 13:57
Hello team, So i have been reading about using Docker to run PACT. And if i understand correctly, I need to use below docker images for tests: 1. Consumer tests : Stub server image (to run the mock server) + Docker CLI image (to add interaction, verify, publish pacts) + Actual consumer API image 2. Provider tests: Just Docker CLI image (verify provider against pact file) + actual provider API image Mock service docker image : Is deprecated now and docker CLI image be used instead. Can someone validate it ? And i would be using the JS implementation of PACT

bernardoguerr
2020-02-20 15:02
For the consumer and provider tests, you can use any Docker image with the appropriate install (in the case of Javascript, it just needs NodeJS). You can then install the dependencies you need to run your tests. For example, you would need to install @pact-foundation/pact, and that should suffice for consumer and provider tests

bernardoguerr
2020-02-20 15:03
You can of course create or use a dedicated docker image that has all these things installed already

matt.fellows
2020-02-20 15:03
I?m confused - didn?t this thread cover off why you should not do that? https://pact-foundation.slack.com/archives/C5F4KFKR8/p1582037442233700

matt.fellows
2020-02-20 15:04
In any case, running Pact in a docker as you described is going to lead you to a path where you basically have to re-build the DSL (e.g. the Pact JS, Pact Python, Pact go? interface) all again

matt.fellows
2020-02-20 15:05
It really is for advanced use cases, and normally where you don?t have a language already implemented to do it. If you are using one of the languages currently supported, you are far better off going down that path

sagupta
2020-02-20 15:05
From the thread , I got to know that running one mock server for all consumers is not an option. However after discussing with beth more , I would like to create one mock service per consumer (will manage its lifecycle myself) and thats why i went ahead to read more on pact docker part

matthew.salt
2020-02-20 15:06
has joined #general

bernardoguerr
2020-02-20 15:07
But why not let the mock service be created at runtime of the tests by the appropriate libraries? Why do you need to spin up the mock server separately yourself? Just wondering.

matthew.salt
2020-02-20 15:08
Hello, I have a question about using pact with junit5. I would like a single consumer test to generate a single .json file with multiple interactions. I want to define the RequestResponsePacts in several ?pact methods? rather than a single chained DSL to male it easier to maintain. Each time I?ve tried though I only get a single interaction in my consumer json file. And tips on how I might be able to achieve this?

sagupta
2020-02-20 15:09
Because we want to also ship it to other projects implemented in different languages while maintaining certain guard rails for pact

matt.fellows
2020-02-20 15:09
Can you elaborate on the guard rails? Perhaps it?s a feature request to the project rather than a bespoke thing you build (it may not be, just keen to understand)

matt.fellows
2020-02-20 15:09
(FYI I have to run - 2am here? but will follow up tomorrow)

wesleythomaswilliams
2020-02-20 15:11
Question about contract tests with messages. When building my pact in the consumer, I initially had: ``` return builder .given("the service creates an update message") .expectsToReceive("a service update") .withContent(body) .toPact();``` Then in my provider test, I had: `@State("the service creates an update message")` , which was where I though I'd be verifying the message. That failed, instructing me that I needed to use `@PactVerifyProvider("a service update")` as the place to verify the message. I've since added `@PactVerifyProvider` and taken out the `.given` from the pact builder in the consumer and the `@state` from the provider and the test is working fine, so I'm trying to work out if there's a case where I might need them for contract testing with messages, as in my rest based contract tests I rely on given and state?

wesleythomaswilliams
2020-02-20 15:11
I'd consider putting this in #pact-jvm

matthew.salt
2020-02-20 15:13
Good point. I?d come through to here on a link. I shall post there!

matthew.salt
2020-02-20 15:13
Thanks

sramakrishnan
2020-02-20 16:14
has joined #general

kyle.hammond
2020-02-20 18:50
Calling it after each test lets you know which test failed. Calling it at the very end of all tests would tell you that some test didn?t call all the things you thought, but you would not know which test was wrong.

bethskurrie
2020-02-21 01:57
@wesleythomaswilliams try in #pact-jvm. The general channel has people from all 10 languages.

bethskurrie
2020-02-21 01:58
Haha, just seen your comment above about asking in the pact-jvm channel :stuck_out_tongue:

matt.fellows
2020-02-21 02:00
:wave: anybody using Pact keen on showcasing their company on our websites (http://pact.io + http://pactflow.io)? We?re in the process of putting together some case studies now. If you are interested, we?ll be happy to pick up as much of the legwork as we can - e.g. interview you or send you a Q&A and then can author the post. DM me if you?re keen!

wesleythomaswilliams
2020-02-21 08:58
@bethskurrie Yeah, I wasn't sure if this was more of a general issue about writing tests for messaging or specific to pact-jvm quirk :grinning:

justaburneremailforso
2020-02-21 09:57
Hello, Am I looking to see if we can use pact where the consumer is receiving data through a Java API (packaged up as a jar file), as opposed to receiving it through a rest endpoint. I'm not sure what would be the correct approach here as it's not http/rest responses we are getting, it's just whatever data the API/jar sends back. I'm guessing our contract won't be RequestResponsePact or MessagePact contracts. Any ideas?

sagupta
2020-02-21 10:01
Based on the discussion with my team. We would like to run the consumer (GraphQL , APIs ) and the pact tests on one container AND pact mock server, mock service on another container.  Advantages that we foresee of this approach are: 1. We can easily maintain the mock server docker container 2. Reduced docker image size of the consumer 3. If any other team (other APIs) would like to run contract tests, all they need to do is to write the contract tests and define the ports for the mock server and use the mock server docker image as described above. This way we can establish guard rails to use PACT in our company. I might miss some context here as I am still exploring pact and may miss some details. I have also understood that we can also use the docker image of the pact implementation (PACT JS for example) to achieve this . So I would try to implement both cases and see what the differences are and what suits as per our company WOW.

uglyog
2020-02-21 10:16
How is the Java API receiving the request?

justaburneremailforso
2020-02-21 10:21
We just add the jar to our project, make a call to it and it returns the data. On the provider side it gets the actual data when requested from the API. The data returned can be a string or possibly a specific object.

matt.fellows
2020-02-21 11:58
Think of Pact as a unit testing framework. The mock server it uses under the hood is implementation detail of the framework, and not some architectural feature you should care about.

matt.fellows
2020-02-21 11:59
Your goal is to test the consumer code that makes a call, it _just so happens_ to make an external call to an API that we?ve mocked out. But you should really conceptually pretend as if this is not happening.

matt.fellows
2020-02-21 11:59
I?m not sure what you mean by ?guard rails? - do you mean this in a security sense?

matt.fellows
2020-02-21 12:00
my advice is keep things simple until you fully understand all of the pieces - Pact has some complexity, and you?ll easily get tangled and get no value from it (or lots of re-inventing the wheel)

matt.fellows
2020-02-21 12:01
Start by using the language bindings and get that humming. Then, if you?re still convinced you should run things in a docker container, you can try that too. I?m not seeing any good reason to do it the way your discussing, but i see a huge amount of work ahead of you. As I said before, this is a path to creating your own Pact interface - so any new enhancements/features we add to the library, you?ll have to re-implement yourself

matt.fellows
2020-02-21 12:03
To address your points: > We can easily maintain the mock server docker container What is so hard about installing an npm/java/xyz package? > Reduced docker image size of the consumer I personally don?t buy into image size very much. Temporary storage and network is cheap, the container should not become a runtime container. > If any other team (other APIs) would like to run contract tests, all they need to do is to write the contract tests and define the ports for the mock server and use the mock server docker image as described above. This way we can establish guard rails to use PACT in our company. You are glossing over the fact that _you_ will need to basically create a wrapper for the mock service (for each language you need), and now you are the vendor - not the community

bernardoguerr
2020-02-21 12:05
As someone who's seen the issues you may get in implementing Pact at large scale, I really second what Matt said. Pact does have complexity, the problem is the complexity in my opinion is not around the things that you're focusing on (the running of the tests). IMO, the hard parts are around other things like getting versioning/tagging right, understanding how to put it in CI/CD, how to trigger builds, how to use it to gateway deployments, etc. Actually running the tests is made trivial, with the mock server being provided for you by the language bindings, and they do provide quite a few language bindings, so it shouldn't be a big deal unless some of the languages in your org are not supported by Pact? So if you really want to show how it works, starting simple is a good idea. Over-engineering is really easy with these things, and nailing the fundamentals of how Contract Testing works with Pact is kind of important, before you start thinking of the implementation details.

sagupta
2020-02-21 12:18
Ok i understand your points both of your points and sense that i might land into implementing lot of complex stuff instead of getting value from contract tests. I will mention these points to my team again and will start with implementing the language bindings first.

paolaagudelo10
2020-02-21 16:32
has joined #general

paolaagudelo10
2020-02-21 18:55
hello people, i am starting to work with pact, want to ask if there is a way to make a test contract fail because of warn messages?

uglyog
2020-02-22 00:56
In that case you don't need contract tests, but it be good if the team that provides the JAR file also provides some tests for you to run in your build

uglyog
2020-02-22 00:58
A contract test fails if it ever gets a response that is not defined in the contract. Your example sounds like a valid response according to a contract. Maybe a different type of test is more suitable.

joeruello
2020-02-23 23:56
has joined #general

joeruello
2020-02-24 00:01
Hi everyone! We're getting started looking at pact this sprint. I was wondering if anyone is running pact on k8s and has a helm chart. I found one on GitHub but it doesn't seem to have a license or be published anywhere so at this stage we'll probally roll our own.


bethskurrie
2020-02-24 00:02
And welcome :wave::skin-tone-3:

joeruello
2020-02-24 00:03
:wave: thanks

greetbot
2020-02-24 00:20
has joined #general

2020-02-24 02:05
A new post has been created in *Feature Requests*

tjones
2020-02-24 02:06
^ Do we want that?

tjones
2020-02-24 02:06
I feel like that?s a feature rather than a problem

tjones
2020-02-24 02:07
I have seen teams complain, though

tjones
2020-02-24 02:07
Oh, this is what pending pacts solves?

bethskurrie
2020-02-24 02:07
Yes

bethskurrie
2020-02-24 02:07
Ask @uglyog if he wants it now :stuck_out_tongue:

bethskurrie
2020-02-24 02:07
(I broke his build the other day)

tjones
2020-02-24 02:07
haha!

tjones
2020-02-24 02:09
We had a project where I annoyed Victoria with this - she was on the task ?make pact verification pass? for some new features, but since it is quicker to implement tests than to fix verifications, the checklist kept growing

tjones
2020-02-24 02:09
feature branches or pending pacts would have avoided that problem

bethskurrie
2020-02-24 02:09
:thumbsup::skin-tone-3:

julian.pittas
2020-02-24 05:00
has joined #general

2020-02-24 05:00
Welcome @julian.pittas! :wave::skin-tone-3: Please check your direct message from our greetbot :smile:

matt.fellows
2020-02-24 06:08
Sorry for the Spam Julian - I think there is some testing going on with our welcome bot :slightly_smiling_face:

matt.fellows
2020-02-24 06:08
and also, hello :slightly_smiling_face:

naamam
2020-02-24 15:23
has joined #general

wesleythomaswilliams
2020-02-24 17:03
@matt.fellows As I get deeper into reading up on tagging and using can-i-deploy (which is all kind of frying my brain a bit). It seems to suggest making use of webhooks to trigger the provider's CI build when a change is detected in a pact published by the consumer service. With that in mind, what happens when the consumer and the provider are owned by different teams or even say a 3rd party. Would you expect a different team to be triggering CI builds for the provider service you own?

bernardoguerr
2020-02-24 17:25
Hey @wesleythomaswilliams! This topic is indeed the more confusing part of Pact. I know the question wasn't for me, but I'll attempt to help answer it, if that's okay :) Regarding 3rd party, Pact is technically not intended for that use case, precisely because you should have ownership of the services in order to be able to do things like triggering builds, as well as be able to communicate with teams, etc. Regarding consumer/provider being owned by different teams, the idea is indeed that a consumer could be able to trigger a provider's CI build. Which I understand may seem like a troubling proposition. Here's a couple of things about that: ? Some people prefer to run the verification as part of the consumer's CI, bypassing the need to trigger a provider CI build. Here's an example of that being done by the UK GOV: https://technology.blog.gov.uk/2019/01/29/lessons-learnt-using-contract-testing-in-gov-uk-pay/ ? The more traditional approach is to use the Webhooks on the Pact Broker to trigger the CI builds. In order to avoid problems with this, what I recommend is having dedicated steps for Pact in the provider's CI. In my opinion, the best way I've seen it done is to have 2 different steps on the provider CI: one for when they are verifying by running their own CI builds, and another step for when it gets triggered by a consumer's Webhook. This may help avoid some of the side effects you may be worried about. Additionally, you have to be really careful about understanding tagging and versioning right, because to have this flow truly working well, you need to be doing it well. In general, it is advised to be working with branches as tags , alongside with filtering on the verification (consumerVersionTag: read more here - https://github.com/pact-foundation/pact-js#verification-options) . This allows you to prevent the consumer from being able to truly break provider's builds, and for consumer and provider to work in parallel

wesleythomaswilliams
2020-02-24 17:29
Thanks Bernado, the 3rd party thing makes sense, but I'm expecting my team to "wig out" a bit over other teams triggering things in our CI. In terms of tagging, using the git sha as a tag seems to be suggested, but I've seen other references to also tagging with environments? So dev, pre-prod, prod. I'm trying to work out if that's overkill or pretty much necessary.

bernardoguerr
2020-02-24 17:42
The git sha is suggested for versioning. Versioning and Tagging are different concepts

bernardoguerr
2020-02-24 17:43
Imo tagging with the environment is not necessary, with the exception of *prod*. The main tags you want to have are, imo: ? feature branches (so you can distinguish between something that's in development or not) ? master ? prod (so you can check for backward compatibility when releasing a new provider/consumer)

bernardoguerr
2020-02-24 17:45
I ran a workshop on this topic recently, here are the slides (and there's a link to a github with multiple branches organised in order, where you can go through the commit history and see the progressive changes): https://www.slideshare.net/BernardoGuerreiro4/get-with-the-pact-gotchas-of-implementing-contract-testing-the-right-way-227294138 It might help, although without the workshop itself, it is of course not as rich a resource

bernardoguerr
2020-02-24 17:45
Hopefully I at least pointed you in the right direction, and of course, Matt and the Pact team will have better info than me to give :slightly_smiling_face:

bethskurrie
2020-02-24 19:11
You said it as well as I could @bernardoguerr!

bethskurrie
2020-02-24 19:13
Here's the docs for the "pact change kicking off the verification" https://docs.pact.io/pact_nirvana#d-configure-pact-to-be-verified-when-contract-changes

bethskurrie
2020-02-24 19:14
As Bernardo says, it's just the verification step, not the entire provider build.

bethskurrie
2020-02-24 19:27
If your team is going to wig out about pact changes triggering builds, they're going to be very upset about the idea that a pact verification failure can break their build as well.

bethskurrie
2020-02-24 19:29
You're either going to have to ensure your consumers strictly follow the recommend process for introducing changes https://docs.pact.io/pact_nirvana#5-allow-contracts-to-change-without-breaking-your-builds

bethskurrie
2020-02-24 19:30
Or, you're going to need to enable the "pending pacts" feature, which is not publicly released just yet.

abrinker
2020-02-24 19:35
has joined #general

bernardoguerr
2020-02-24 19:41
Beth, is that going to be available on the OSS version of Pact too?

djorgensen
2020-02-24 19:42
has joined #general

bethskurrie
2020-02-24 19:48
Here's the (similarly unreleased) blog post about it http://blog.pact.io/p/d7c9601f-e2ca-4208-b1c0-f02eaf96c3c2/

bernardoguerr
2020-02-24 20:13
Awesome, thanks for that! Great feature. One quick question, is the Pact Broker going to have a different colour or info associated when a Pact has failed verification but is in this pending state?


bethskurrie
2020-02-24 20:31
^^ I'd shared this post so many times in draft that I figured I may as well publish this post with a caveat to say it is still in beta.

matt.fellows
2020-02-24 21:33
I believe that's the plan. Or at least some visualisation to indicate that

bethskurrie
2020-02-24 21:34
Nope

bethskurrie
2020-02-24 21:34
Well - I haven't worked out how yet.

bethskurrie
2020-02-24 21:34
The problem is, the pending status is calculated based on the provider tags.

bethskurrie
2020-02-24 21:35
So a pact could be pending for 'master' tag, but not pending for 'feat/x' tag.

bethskurrie
2020-02-24 21:35
So may not be meaningful to show an overall 'pending' status.

bernardoguerr
2020-02-24 21:35
maybe the tags themselves could have colours?

bethskurrie
2020-02-24 21:35
It's the *provider* tag, not the consumer tag.

bethskurrie
2020-02-24 21:36
So, the 'feat/xyz' pact for a consumer may be pending for 'master' provider, but because it got verified on the 'feat/xxx' branch of the provider, it's not pending for that tag.

bethskurrie
2020-02-24 21:36
It needs a table to visualise!

bernardoguerr
2020-02-24 21:37
yeah I see what you mean

bernardoguerr
2020-02-24 21:37
not as straightforward as I had pictured it when I asked :sweat_smile:

bethskurrie
2020-02-24 21:37
At the moment, the broker doesn't know which the "important" tags are for each user. It's a feature we'd like to add though.

bethskurrie
2020-02-24 21:38
Then it would be easier to say, ok, you care about the "master" provider tag, we'll show you the pending status for the master tag.

matt.fellows
2020-02-24 21:39
Yeah I was going to say that. The tag model is super flexible, but the more I think about it the more I think it's the single most confusing thing to people. Starting to wonder if we need a new "promotion" model independent of tags :thinking_face:

matt.fellows
2020-02-24 21:39
Bbl afk

bernardoguerr
2020-02-24 21:40
that's funny you'd use the word flexible, I was just typing something saying that I think some of the confusion comes from how flexible it is

bethskurrie
2020-02-24 21:40
I did start work on a different API for doing "branches" and "deployments", but I overthought it and then backed it out.

bernardoguerr
2020-02-24 21:40
because when you give out examples for it, it's easy to lose sight of which ones are the tags that actually matter

bethskurrie
2020-02-24 21:40
I also wasn't sure about being too prescriptive about how we modelled peoples CI process.

bernardoguerr
2020-02-24 21:41
I think that's a good thing though

bernardoguerr
2020-02-24 21:42
For example when I was at DAZN we had a more obscure one (Drone), and if something was too "standardized", we might've had issues. I think keeping it flexible + good documentation for the most common examples is probably where it's at, imo

bethskurrie
2020-02-24 21:42
To be prescriptive, or flexible?

bernardoguerr
2020-02-24 21:42
Flexible

bernardoguerr
2020-02-24 21:43
but I guess both arguments

bernardoguerr
2020-02-24 21:45
I mean generally when I'm in a company I actually like some prescription, ie standardization, it takes away a lot of the headache. the whole workshop I gave was basically "make a standard for your company with naming conventions, versions, tagging, and apply it". But in this case I guess the onus of being prescriptive probably lies with the company trying to implement it, rather than the Pact team, otherwise you could risk alienating some uses.

bernardoguerr
2020-02-24 21:45
are you finding people generally give you feedback that they'd want it to be more standardized and less flexible ?

bethskurrie
2020-02-24 21:45
people generally don't want to have to think too much!

bethskurrie
2020-02-24 21:46
There's a big cognitive overhead with Pact.

bernardoguerr
2020-02-24 21:47
perhaps the two don't have to be mutually exclusive. you can probably keep the flexibility of the tags and think of some other API to cater to the 90% use-case in a more direct way

bernardoguerr
2020-02-24 21:47
but I guess that's what you were trying to do before :smile:

bethskurrie
2020-02-24 21:48
Yes, there's no reason why we'd have to remove the tag functionality if we also supported explicit branches/stages - except for the potential complication of code and documentation and making people have to choose between options!

bethskurrie
2020-02-24 21:49
It's something I've thought about for a long time, but haven't quite had the conviction to make the changes.

2020-02-24 21:53
A new post has been created in *Feature Requests*

bethskurrie
2020-02-24 21:53
I've added it as a potential feature - let's see what people say about it. https://pact.canny.io/feature-requests/p/support-explicit-branches-and-stages

bernardoguerr
2020-02-24 22:14
That sounds good! The only thing is that probably the people that will understand the value of this feature request are those that already understand the Pact workflow a little bit better. But still better than not knowing anything :smile:

bethskurrie
2020-02-24 22:14
Yes, its target audience is probably people who already understand tags!

jason_willis
2020-02-24 22:36
has joined #general


2020-02-24 23:39
A post in *Feature Requests* has been marked as *planned*

wesleythomaswilliams
2020-02-24 23:51
Thanks for the doc links Beth, I'd been reading them all day and trying to explain them to a team mate, while simultaneously not trying to tie myself in knots. I think my biggest problem is I end up looking for examples of how people have implemented things and that doesn't always make things clearer for me. Today that led me to this: https://kreuzwerker.de/post/integrating-contract-tests-into-build-pipelines-with-pact-broker-and

matt.fellows
2020-02-24 23:58
Ha, funny - I was on a call to them last night :slightly_smiling_face:

matt.fellows
2020-02-24 23:59
Kristine is apparently on maternity leave - but I?d love to meet and thank her one day!

bethskurrie
2020-02-24 23:59
It's very difficult to provide simple answers to how to integrate pact into your pipeline because everyone's pipelines are different.

matt.fellows
2020-02-24 23:59
yeah

bethskurrie
2020-02-25 00:00
You really have to have a good understanding of how tagging/can-i-deploy works so you can work out how to fit it into your own pipeline.

matt.fellows
2020-02-25 00:00
I was doing a talk at another local company recently, and their pipeline was also weird - for example, they had _multiple_ production environments

bethskurrie
2020-02-25 00:00
woah

matt.fellows
2020-02-25 00:00
It?s easy for us to say ?your pipeline is weird, you should change it?. But in most cases, there is so much inertia around pipeline design it?s almost impossible to change (at least in places big enough)

matt.fellows
2020-02-25 00:01
They were a services company - so they would deploy their application to tenant a, tenant b -> tenant x. But not always at the same time

bethskurrie
2020-02-25 00:01
interesting

matt.fellows
2020-02-25 00:02
They also often had to get external certification \ sign-off from their customers before promoting - so you can imagine how the pipelines could get a bit tangled

bernardoguerr
2020-02-25 00:15
Yeah we actually also kind of have the same issue with different tenant environments at Auth0. One of the reasons I said I don't think we were quite ready to implement it here yet

bernardoguerr
2020-02-25 00:15
It's definitely hard maintaining the balance between giving folks too much flexibility at the cost of ease of adoption VS catering to the mass :smile:

matt.fellows
2020-02-25 00:18
Interesting. Thanks for the insights!

2020-02-25 04:44
A new post has been created in *Feature Requests*

milanese.david
2020-02-25 04:48
has joined #general

daniel.paetzold
2020-02-25 08:14
has joined #general

naamam
2020-02-25 08:25
Hi there, I'm new with Pact (using c# language), wanted to know what is the Nuget package for PactDslJsonBody? This stackoverflow is what i'm searching for :https://stackoverflow.com/questions/60207882/is-there-any-way-we-can-only-validate-field-name-not-value-in-pact-json/60221333#60221333 but I don't have the right Nuget package. Can you help me please?

bethskurrie
2020-02-25 08:26
Hi @naamam. Try asking on #pact-net

bethskurrie
2020-02-25 08:27
Also, are you sure that example is .net? It looks more like java to me.

bethskurrie
2020-02-25 08:28
You've read all of this haven't you? https://github.com/pact-foundation/pact-net

matt.fellows
2020-02-25 09:22
Yeah, it?s definitely Java

matt.fellows
2020-02-25 09:23
(and no Nuget package for Pact JVM that I?m aware of!)

2020-02-25 09:25
A new post has been created in *Feature Requests*

dan.garland
2020-02-25 09:43
has joined #general

dan.garland
2020-02-25 10:23
Hi all, Pact user here (Ruby and JS), using in a corporate environment and finding it very useful, thanks to all the contributors! Right now we've got a setup that is approaching Pact Nirvana, and now the CTO has decreed we're all going to be using Kafka, so we're interested in the V3 progress and especially Ruby support. I found this repo which suggested I shoutout to @bethskurrie https://github.com/pact-foundation/pact-message-ruby/. I ought to be able to contribute code if there was enough feedback and direction if that helps. Would be good to know where things stand right now: 1. Can I use Pact tools to test Ruby provider/producer and consumers in a message setting? 2. Will the generated Pacts appear on our Pact Broker? 3. If not, what are the outstanding tasks? Is there a roadmap/issues that can help me understand what to do? 4. How can I contribute?

matt.fellows
2020-02-25 10:33
Hi Dan, thanks so much for the lovely feedback and offer to help - it is genuinely, very much appreciated!

matt.fellows
2020-02-25 10:33
You might also find https://docs.pact.io/feature_support useful

matt.fellows
2020-02-25 10:34
#pact-message-ruby is the channel to discuss adding message support to Ruby. It can?t be a huge effort to add, because it provides the functionality to Pact JS, Pact Go and Pact Python. So it?s probably just cleaning up the interface (i?m glossing over much of the detail I?m sure)

matt.fellows
2020-02-25 10:35
2) Generated pacts don?t currently appear in the OSS pact broker, but do show up in http://pactflow.io (we have a different presentation layer). It?s not a huge amount of work their I wouldn?t imagine

matt.fellows
2020-02-25 10:36
To answer (4) with respect to (2), you could take a look at the advice in this issue: https://github.com/pact-foundation/pact_broker/issues/127

matt.fellows
2020-02-25 10:36
hope that helps!

tomas.sakinis611
2020-02-25 11:00
has joined #general

naamam
2020-02-25 11:03
Yes, the example is java, I'm searching for the equivalent in c#. Can you help? what will be the class handling this?

naamam
2020-02-25 11:04
I want to only verify response fields name and type and not actual values (can changed)

naamam
2020-02-25 11:05
Thank you for your replies. Appreciate it

2020-02-25 14:04
A new post has been created in *Feature Requests*


a.konovalov
2020-02-25 15:50
has joined #general

manos
2020-02-25 16:22
has joined #general

mike.hamer
2020-02-25 23:06
has joined #general

mike.hamer
2020-02-25 23:09
Hello - Does anyone know of any available tutorials or examples of using Pact with Azure Functions?

bethskurrie
2020-02-26 06:28
Continued in #pact-message-ruby

ckkinay
2020-02-26 09:32
has joined #general

nerea.tamayo
2020-02-26 10:35
Hi one quick question about PactFlow, regarding plans?.the plans have different conditions about number of users, number of contract,support??.but what is number of user??I mean, one user is a project or each person?

nerea.tamayo
2020-02-26 10:38
I?m thinking about which plan is better for my company, we have a lot of different teams/projects, so if a user means each person, we need a big number of users, but if a user is each project and all members of the project are able to publish/verify and see the contract we need less users

nerea.tamayo
2020-02-26 10:39
I think user means consumer/provider, but I need to confirm it

matt.fellows
2020-02-26 10:54
Taken from https://pactflow.io/faq/ > We use a ?seat? based model, where you purchase capacity for how many Users you need and assign them as required. > > A user is considered any person or application that requires independent access to the system. For example, if you have two team members Sally and Billy that will be logging into the UI, as well as a separate dedicated CI user for automation, they will each consume one seat for a total of 3. > > Each user gets a read-only and read-write API token that can be used for automation (e.g. for use in CI or local verification testing). Each user is able to rotate these tokens as needed.

matt.fellows
2020-02-26 10:55
The consumer/provider pair is what we refer to as a ?contract? - they are unlimited

matt.fellows
2020-02-26 10:55
basically, our costs scale on the size of your team

nils.thenhausen
2020-02-26 13:08
has joined #general

dave_sharp_
2020-02-26 14:31
has joined #general

2020-02-26 21:45
A new post has been created in *Feature Requests*

2020-02-27 01:24
A new post has been created in *Feature Requests*

2020-02-27 05:25
A new post has been created in *Feature Requests*

2020-02-27 06:36
A post in *Feature Requests* has been marked as *complete*

2020-02-27 06:36
A post in *Feature Requests* has been marked as *closed*

paulg4321
2020-02-27 06:53
has joined #general

christopher.taormina
2020-02-27 18:45
has joined #general

bethskurrie
2020-02-28 01:23
Hey peeps. We've had some really good questions recently that aren't quite "frequently asked" but are good to record for posterity anyway. I've put them here: https://docs.pact.io/faq/question_archive

bethskurrie
2020-02-28 01:24
Feel free to contribute any more you think might be helpful. Slack is great, but because we're on the free plan, we lose good Q&As over time.

matt.fellows
2020-02-28 02:31
Awesome idea, thanks Beth

wesleythomaswilliams
2020-02-28 09:30
Has anyone integrated can-i-deploy into a jenkins/maven pipeline when using Pact Flow? I'm looking at using the docker that hosts it, but not sure on formatting of spinning it up and calling it. Our pipeline uses groovy files, so I have a stage that looks like: ```sh 'docker run --rm pactfoundation/pact-cli:latest ' + 'broker can-i-deploy ' + '-a ' + <service_name> + '-b ' + <broker_url> + '-e ' + <git_commit>``` This is my first time trying to modify a pipeline in this way, so all new to groovy, docker etc. Have been looking at these links for reference: https://hub.docker.com/r/pactfoundation/pact-cli https://kreuzwerker.de/post/integrating-contract-tests-into-build-pipelines-with-pact-broker-and https://pactflow.io/blog/deploying-your-microservices-with-confidence-using-can-i-deploy/ https://docs.pact.io/pact_broker/can_i_deploy

davidmolinero.com
2020-02-28 09:56
Hi, I am using pact-js `@pact-foundation/pact` and I have the following test in the provider side ```it("verifies contracts successfully", async () => { const providerVersionTag = process.env.PROVIDER_VERSION_TAG || ""; const options: VerifierOptions = { consumerVersionTag: process.env.CONSUMER_VERSION_TAG || "HEAD", pactBrokerToken: process.env.PACT_BROKER_TOKEN, pactBrokerUrl: process.env.PACT_BROKER_BASE_URL, provider: PROVIDER, providerBaseUrl: `http://${SERVER_HOST}:${SERVER_PORT}`, providerVersion: gitCommit, providerVersionTag: [gitBranch, providerVersionTag], publishVerificationResult: process.env.PUBLISH_VERIFICATION_RESULTS === "true", stateHandlers: { "order-123": save(order("123") } }; const verificationResult = await new Verifier(options).verifyProvider(); expect(verificationResult).not.toContain("Failures"); });``` The test itself is very poor since I am checking that the output that I am getting from the broker does not contain the ?Failures? string, this used to work well until recently, now the broker is not returning the entire output and it is only returning the following log entry `INFO: Fetching pacts for Provider from https://....http://pact.dius.com.au with the selection criteria: : latest for tag prod` the test is passing but nothing is verified? :sob::sob::sob::sob::sob:

davidmolinero.com
2020-02-28 09:57
Is there a better way to verify the contract, am I missing something?

wesleythomaswilliams
2020-02-28 10:12
Think I've got it

tyler.rasor
2020-02-28 13:00
has joined #general

karl
2020-02-28 13:29
Hey guys I'm confused as to how the pact files are written for consumer tests

karl
2020-02-28 13:30
I run run mocha which runs two tests files, in each of the tests files I create a new MessageConsumerPact, but it only seems to create only one of the pact files for one of the tests?

wesleythomaswilliams
2020-02-28 13:33
@karl If these are tests for a single service, is there a specific reason you have multiple test files and not multiple tests in one file? I've no experience with mocha and I'm using Java, but for any given service, I have multiple tests in one file.

karl
2020-02-28 13:33
Ah I have multiple services!

wesleythomaswilliams
2020-02-28 13:34
@karl and do these multiple services exist in the same git repo (or other src control repo)?

karl
2020-02-28 13:34
For example I have service A and B and C. Service A will be consuming things from B and C, so I've divided the tests into two files, each for consuming their own service.

wesleythomaswilliams
2020-02-28 13:35
@karl Ah gotcha, so you're writing tests for service A which is a consumer of B & C

karl
2020-02-28 13:36
I also need to create a new MessageConsumerPact because it states in there the "consumer" and "provider", it seems like the pact file is being overwritten, but I don't know why because the file name should be different

karl
2020-02-28 13:36
I'm expecting two pact files a-b.json and a-c.json

wesleythomaswilliams
2020-02-28 13:38
In java, our pact definition is headed by `@Pact(provider = "<provider_service>", consumer = "<consumer_service>")` and I believe the name of the pact is taken from those values.

karl
2020-02-28 13:38
Exactly, it's kinda the same in js, I have that at the top of each test also

wesleythomaswilliams
2020-02-28 13:40
@karl I assume in both test files you've set the provider value differently? The other thing we have in Java is the class is headed by `@PactTestFor(providerName = "provider_service", providerType = ProviderType.ASYNCH)` , which may be relevant.

karl
2020-02-28 13:41
exactly!

karl
2020-02-28 13:41
The sync things were easy to impliment but we are doing messages now, so it's slightly more of a headache heh

karl
2020-02-28 13:41
I have pact write mode set to update, so it should'nt be removing anything

wesleythomaswilliams
2020-02-28 13:42
I'll try and see if I can create a dummy second pact file with a fake 2nd provider to see if it works. Might help me work out out why it's not working for you.

karl
2020-02-28 13:46
The weird thing is, if I disable the first test then the second pact file is written

karl
2020-02-28 13:46
so it's as if, there is only one file allowed and that the other is being removed

wesleythomaswilliams
2020-02-28 13:47
Which might well be the case. If I do my test, it should hopefully prove that.

karl
2020-02-28 13:53
Yea i'm curious if you get two files, name of the file is made up of the consumer and provider names

wesleythomaswilliams
2020-02-28 13:59
Ok, tested, I managed to get two files created and the only thing I changed in the dummy second test file, was the provider service names.

karl
2020-02-28 14:51
Ah ok, thank you so much for testing

karl
2020-02-28 14:52
So it must be something in my environment then, like a setting

wesleythomaswilliams
2020-02-28 16:44
Either that or it's a JS specific Pact bug.

premanandc
2020-02-28 19:28
has joined #general

matt.fellows
2020-02-29 00:10
Yes, you should check for a rejected promise.

matt.fellows
2020-02-29 00:10
Does that not work?

matt.fellows
2020-02-29 00:13
Can you please share a redacted test for us? It should work the same as sync

matt.fellows
2020-02-29 02:17
Sorry was, been a while since I've used Jenkins. I recall interpolating environment variables inside shell inside groovy the DSL being a bit messy

matt.fellows
2020-02-29 02:17
Also, perhaps we should consider creating a Jenkins plugin for this? If so, should I raise a feature request?

erickoston
2020-02-29 08:01
has joined #general

davidmolinero.com
2020-02-29 17:52
the promise is not rejected, it is resolved

davidmolinero.com
2020-02-29 17:52
the problem is the output does not contain the full log

davidmolinero.com
2020-02-29 17:53
it just contain the first `INFO` line

matt.fellows
2020-02-29 20:09
Ok so if this is true it's a nasty bug. It should reject the promise and you should not have to do string analysis to determine the output. Can you please raise an issue so I can look into it?

matt.fellows
2020-02-29 20:28
See this PR I just put for Pact JS


matt.fellows
2020-02-29 20:29
```const res = new Verifier(opts).verifyProvider() return expect(res).http://to.eventually.be.rejected``` this test passes, in that the provider verification fails and returns a rejected promise

matt.fellows
2020-02-29 20:29
If you can help reproduce the issue above that?d be great, because it?s a worry if it can happen!

tomas.sakinis611
2020-02-29 20:45
Hi, i'm planning on using pact as a stub-server after I have all interactions in place. This is to speed up e2e tests, and at the same time make them more stable. The problem i'm facing right now is that one service is returning incrementing number in a response (ID for next request payload). App tracks that number, and expects it to increment with every request, otherwise it retries the request indefinitely. Do you have any insight how to handle such case?

uglyog
2020-02-29 23:50
The only mechanism I know of is the V3 generators that could do that, but you would need to use Pact-JVM and create the generator yourself

tomas.sakinis611
2020-03-01 10:12
I'm thinking about creating my own mock server, which would handle that specific case, and then validating pacts against both: mock server and provider service. Might be an overkill though...

davidmolinero.com
2020-03-01 14:16
Ok, I think I know what is going on here, I was using the `expect(verificationResult).not.toContain("Failures");` as a workaround of not getting back a rejected promise (I wasn?t aware of an existing bug)

davidmolinero.com
2020-03-01 14:16
If I understand correctly this PR https://github.com/pact-foundation/pact-js/pull/412/ contains a test that proves that there is a bug (not getting a rejected promise when the contract verification fails)

davidmolinero.com
2020-03-01 14:17
What I don?t understand, is that a few weeks ago, I was getting the entire log output of the verification result and now I am only one single line `INFO: Fetching pacts for Provider from https://....http://pact.dius.com.au with the selection criteria: : latest for tag`

davidmolinero.com
2020-03-01 14:18
This behavior has had to change recently

davidmolinero.com
2020-03-01 16:10
and since this behaviour has changed, the state handlers are not executed

davidmolinero.com
2020-03-01 16:13
I think there are 2 problems: ? There are situations in where a rejected promise should be returned and instead a resolved promise is returned ? Some behaviour has changed and since then the response from the `verifyProvider()` call does not contain the full output and the state handlers are not invoked

davidmolinero.com
2020-03-01 16:42
when I execute `npm run test:e2e-examples` in master branch the tests are not passing, I am getting this output

davidmolinero.com
2020-03-01 16:43
```[2020-03-01T16:40:26.214Z] DEBUG: pact-node@10.0.1/22879 on AdministorsMBP9: INFO: Fetching pacts for Animal Profile Service from https://test.pact.dius.com.au/ for tags: latest prod [2020-03-01T16:40:26.215Z] WARN: pact-node@10.0.1/22879 on AdministorsMBP9: Pact exited with code 1. 1) validates the expectations of Matching Service 0 passing (4s) 1 failing 1) Pact Verification validates the expectations of Matching Service: Error: Error reading file from https://test.pact.dius.com.au/pacts/provider/Animal%20Profile%20Service/consumer/Matching%20Service/version/1.0.1583080814```

matt.fellows
2020-03-01 19:37
Weird. Our builds are all green (look for tags and/or master) https://travis-ci.org/pact-foundation/pact-js/builds and I can't reproduce. There was a change to logging recently but it hasn't affected our builds or output that I can see. If you can help create a repro we'll be in it asap because it looks like everything has stopped for you!

davidmolinero.com
2020-03-01 19:44
I?ll try to create an example to reproduce it, but I am afraid I?ll have to do it outside the `pact-js` repo since the e2e tests that are there are not working for me

davidmolinero.com
2020-03-01 19:44
I won?t have time today, I?ll try to do it tomorrow

elliot.whiley94
2020-03-01 20:44
has joined #general

elliot.whiley94
2020-03-01 21:40
Hello :wave: My company is looking to gain better test coverage across our microservices, and I'm investigating to see whether Pact could be applicable for our use case. I've read through the docs and I'm specifically interested in the use of JavaScript and .NET libraries. It seems appealing as an alternative to maintaining large end-to-end tests which end up hitting multiple services and are brittle to changes. There are some questions I'd like some clarity around, any help/guidance appreciated. Posting in separate messages to make thread responses easier, thanks in advance! :slightly_smiling_face: 1. All calls out to one of our microservices first require an auth token from our auth server. So for example, an API call from consumer A to provider B, first requires a token from auth server C. I can see from the .NET docs an example which includes something similar (https://github.com/pact-foundation/pact-net/blob/master/Samples/EventApi/Consumer.Tests/EventsApiConsumerTests.cs#L106), but don't know how this works in practice. Could someone please go in to more detail about this, e.g. how will provider B verify that this token is valid.

elliot.whiley94
2020-03-01 21:40
2. To add to the above, we would like to test the process of getting an auth token from auth server C (e.g. consumer A calls auth server C to retrieve an auth token). So in this case we don't want to mock out the auth behaviour, how would this work?

elliot.whiley94
2020-03-01 21:40
3. How do Pact tests handle downstream dependencies? e.g. consumer A calls provider B, which calls downstream dependency provider D, which then calls other downstream dependencies provider E and provider F all within the same request. What would this Pact test looks like on both the Client and Server side at a high level?

elliot.whiley94
2020-03-01 21:40
4. We had a postmortem for a particular case where consumer A used a particular client library to call provider B. On shipping a change to B, the client calls from A were now invalid. We would like to pick up changes like these before shipping. I'm not sure if Pact helps here, as the way I see it currently is as follows: on new build of provider B version 2, pact tests are pulled from a broker for consumer A and run against provider B. However the requests replayed against B are just the plain HTTP requests and don't have the surrounding library calling and processing code, so I'm not sure if we would get the full test coverage we are looking for here.

batulrizvi
2020-03-02 01:27
has joined #general

hendrik
2020-03-02 08:12
has joined #general

hendrik
2020-03-02 08:14
Hey folks!

hendrik
2020-03-02 08:16
I'm running a MessageConsumerPact multiple times to produce variations of accepted payload. For some reason I always end up with a single object in `messages` array of the pact. And it's always the last variation I tested. My `pactfileWriteMode` is set to `update`. Is this expected behaviour? If I set the `pactfileWriteMode` to `merge`, then the pact file will be empty. No errors in console.

hendrik
2020-03-02 08:38
Ah, got it. It seems to be based on state. E.g each variation should have different provider state.

matt.fellows
2020-03-02 09:40
Yes, this applies to all Pact tests - you need to have unique keys so that they can be differentiated in the pact file

matt.fellows
2020-03-02 11:29
See https://docs.pact.io/provider/handling_auth. Generally speaking, you don?t want your tests to have to traverse multiple layers

matt.fellows
2020-03-02 11:30
I need to move this page, but the ?Scope of a consumer test? hopefully helps clarify this a bit: https://docs.pact.io/5-minute-getting-started-guide#scope-of-a-consumer-pact-test

matt.fellows
2020-03-02 11:31
You really just want to test the API collaborator in isolation of other antecedents (such as having had a valid bearer token). In your consumer test, just stub out the part of the system that has to fetch this, and on the provider side employ one of the above strategies

matt.fellows
2020-03-02 11:32
See step 7-9 in our JS workshop for an example of how to do this in JS: https://github.com/pact-foundation/pact-workshop-js/blob/step7/LEARNING.md

matt.fellows
2020-03-02 12:09
on my current client, particularly from service to service communication (in Go) we use client libraries and use Pact to protect against exactly this.

matt.fellows
2020-03-02 12:10
The trade off is that cliens aren?t fully abstracted from the HTTP requests, because they will need to know what the req/response over the wire looks like

matt.fellows
2020-03-02 12:10
for us, it?s totall yworth it

matt.fellows
2020-03-02 12:13
It?s a very common thing/question. Each consumer<->provider pair should be tested in isolation. It?s worth looking through http://docs.pact.io because lots of these questions are covered off

matt.fellows
2020-03-02 12:14
I would create a Pact test for the authentication that is _independent_ (i.e. produces a different contract and is not tied to) from the other APIs that also rely on that auth service

matt.fellows
2020-03-02 12:14
have contracts between all of the things that directly communicate, and stub out transitive dependencies


hendrik
2020-03-02 12:30
How am I supposed to verify Asynchronous API pacts? `pact.verifyPacts()` requires `providerBaseUrl` parameter as if I was testing HTTP API. I could also verify pacts while CI is running provider tests, but in that case `tags` property of `MessageProviderPact` is not respected and provider pact is verified against latest consumer pact, even if it doesn't have the correct... say environment tag.

jwojtowicz
2020-03-02 14:05
has joined #general

hendrik
2020-03-02 15:09
Ok, so it seems there are couple of gray areas: first off, `MessageProviderOptions` expects `tags` attribute, which is deprecated and thus is ignored. Secondly, why verification result is positive if it cannot find pact for certain tag? If you don't have anything to verify against, the result should be false IMO.

joel.whalen
2020-03-02 17:17
has joined #general

matt.fellows
2020-03-02 19:50
Can you please raise a bug? I'm look into ASAP

warren.bayek
2020-03-02 20:52
has joined #general

hank.mitsch
2020-03-02 21:42
has joined #general

avinash.eediga533
2020-03-02 23:36
has joined #general

avinash.eediga533
2020-03-02 23:37
Hey guys

avinash.eediga533
2020-03-02 23:38
Could any one please help me in setting up pact dir for in kotlin

matt.fellows
2020-03-02 23:38
#pact-jvm

avinash.eediga533
2020-03-02 23:39
Thanks @matt.fellows

shsamkit.shah
2020-03-03 00:52
has joined #general

shsamkit.shah
2020-03-03 00:58
Hi, I have a question regarding debugging pact-docker. I was able to configure it with docker-compose on my local and now trying to deploy it on company's private-cloud. Due to serveral network restrictions, it's not going as easy as it was on local. The last line of logs I can see is ```[ N 2020-03-03 00:48:30.4729 35/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)``` Nothing after that and I don't see the process running in the container either. Any suggestion on checking further/failure logs?

elliot.whiley94
2020-03-03 01:03
Thanks for all your responses @matt.fellows. Could you please clarify what you mean by this particular case? Are you saying you have the consumer client library code also running as part of the provider-side pact tests?

matt.fellows
2020-03-03 01:05
No, I mean the consumer Pact tests use the provided client library

elliot.whiley94
2020-03-03 01:08
Where `provided client library` is some 3rd party library used to make HTTP requests?

shsamkit.shah
2020-03-03 02:18
Nvm, the problem is fixed.

matt.fellows
2020-03-03 02:32
hmm, no they are internal client libraries built by other teams - are you referring to external APIs/clients? Perhaps you could elaborate further?

matt.fellows
2020-03-03 02:32
(sorry had to duck off after that last message)

matt.fellows
2020-03-03 07:06
What was the issue?

matt.fellows
2020-03-03 07:06
I was going to say, that last line (if no exceptions above it) meant that it?s all up and running. So it?s probably a port mapping / network thing

matt.fellows
2020-03-03 07:06
You can also look at http://pactflow.io if you don?t want to run/manage it yourself

deathangel908
2020-03-03 07:46
has joined #general

deathangel908
2020-03-03 07:54
Hello guys, https://stackoverflow.com/questions/60495511/how-to-use-pactjs-with-cypress. It seems like both of these libraries are starting to become very popular lately. What I came to atm is just using cypress task that runs pact http server in the background. But I believe for cypress case there's no need to even listen a port, since cypress has `route` API that allows to intercept/stub/proxy network. To do this we just need to exclude all the related code that requires node api, listening to a port etc. Unfortunately what I found yesterday is that pact is too tightly coupled and also depends on some `ruby` (WOT?) files that are necessity which makes me sad. It would be ideal that pact would run directly in browser purely abstracted from its underlying http-server/node_implementation. What do you think guys? I guess I can collaborate a bit.


bethskurrie
2020-03-03 07:56
Also, we're really keen to get pact and cypress integrated. It's something we've actually been discussing this week.

sergiy
2020-03-03 10:24
Hi there :wave:, we?ve implemented *pact-cypress* integration lib at our company and using it on a regular basis in our test suites. We?ve been talking about it and more here - https://www.youtube.com/watch?v=cs5ebVzG_Q4 at one of the testing meetups organized by SauceLabs. I had a short chat with @matt.fellows about it, and we were thinking about open sourcing our tooling, seems like folks here could be interested?

greg719
2020-03-03 10:40
has joined #general

matt.fellows
2020-03-03 10:50
Loving this thread - thanks for joining Andrew. I?d love to get on a call with you folks to understand this all better. I haven?t used Cypress, so don?t fully appreciate all of its goodness and how Pact might fit in

matt.fellows
2020-03-03 10:50
But, I?d love to.

matt.fellows
2020-03-03 10:50
Would you be up for it?

sergiy
2020-03-03 10:54
hey @matt.fellows, who? Us or Andrew? :slightly_smiling_face: I?m sure we can organise something

deathangel908
2020-03-03 12:02
@sergiy I don't have much time atm, to fully watch the conference, gonna check it later So the lib is not opened atm, I can't check the source code. The most interesting thing I'm curious whether you still run in in `node` env and listen for the port or you fully ported it to browser.

yousafn
2020-03-03 12:10
We use Cypress & Pact heavily, but we generate pact contracts from our code, and load these into a stub server hosted in docker, and run in an ECS cluster

deathangel908
2020-03-03 12:13
Lets move this to #cypress channel

sergiy
2020-03-03 12:27
@deathangel908 yes, it?s not public yet, we need to do some chore work, cause we prefer to release it properly. We have ported it as a cypress plugin

deathangel908
2020-03-03 12:28
anything I can help you with?

sergiy
2020-03-03 12:29
contribute when it?s released :wink: :grinning:

deathangel908
2020-03-03 12:30
ok, cool, any ETA?

sergiy
2020-03-03 12:32
I wish to give you one, but can?t say for sure, we just need to plan some time :man-shrugging: /cc @enrique

enrique
2020-03-03 12:44
I don?t think there will be any problems. Because it started as an internal project we need to change it a bit to make it ready for open source. I think mid 2020 is feasible.

hendrik
2020-03-03 14:31
What's the general practice.... using a single pact per Consumer - Provider or rather a single pact per API endpoint/Async message between Consumer and Provider?

bernardoguerr
2020-03-03 14:43
If pact means single contract file, then yes, the general practice would be a single contract between a consumer-provider pair (afaik)

hendrik
2020-03-03 14:48
I figured. Thanks

oleg.shuliak
2020-03-03 14:51
has joined #general

crajcan
2020-03-03 19:19
Does anyone use the pact_broker-cli on a Heroku web server? I'm thinking of creating a Heroku build-pack for pact_broker-cli so I can run `can-i-deploy` and `create-version-tag` from Heroku's "Release Phase", and I'm wondering if someone has done something similar, or if there is a better way to make the cli available on a Heroku web server.

matt.fellows
2020-03-03 20:42
Haven't seen that before. We have a docker container that has all of our tools on it tho, so that's an option too

matt.fellows
2020-03-03 20:43
The other thing to consider is that (at the moment) you need to separate the message pacts from the http pacts (the provider needs a different name). The pact broker doesn't yet support this

surajkeshri
2020-03-03 21:45
has joined #general

hendrik
2020-03-03 21:49
I actually solved it by passing `consumerVersionTag` instead of `tags` to `MessageProviderPact`. The interface at `options.d.ts` file should be still updated though.

hendrik
2020-03-03 21:53
Not sure if it's worth raising a bug.

hendrik
2020-03-03 21:53
If you think so, I'll do it in the morning

matt.fellows
2020-03-03 21:54
No dramas - i?ve almost completed the changes to support it (it?s just the TS types as you say that disallow it)

hendrik
2020-03-03 22:01
But maybe the part where pact with specific tag is not found needs discussion. It's debatable whether it should report as a success or not, but one should somehow know if provider tests passed since pact is really verified or because there's no pact at all with given tag.

matt.fellows
2020-03-03 22:16
There is a flag to control that behavior, it may not be exposed also. I'll add that to the Todo

tjones
2020-03-03 22:44
Would pact-web help here?

matt.fellows
2020-03-03 22:51
yes quite possibly. I?d like to fully understand/appreciate the nuances - but almost certainly there will need to be a server-side component to make this a reality. OR, we swap out the http engine (e.g. like nock does) and then serialise the results after into a Pact file

matt.fellows
2020-03-03 22:52
It would be ace if we could get the Rust thing working as web assembly, but that still has the dark arts smell about it

osirisnos4a2
2020-03-03 23:48
has joined #general

adam.strickland
2020-03-03 23:56
has joined #general

aserdyuk
2020-03-04 00:04
has joined #general

paulolai
2020-03-04 00:14
has joined #general

hendrik
2020-03-04 08:53
Any guidelines on how to to test custom messaging? Say I'm using Moleculer.js and need to test events exchanged between microservices.

simon.nizov
2020-03-04 09:36
I have a scenario where I have 2 services with 2 pacts between them (not interactions). One pact with service A as the consumer and service B as the provider, and another pact where it?s the other way around - service B is the consumer and service A is the provider. Everything works well except for the matrix page in the broker. When I go to the matrix page of each of the 2 pacts: ```https://mybroker/matrix/provider/A/consumer/B https://mybroker/matrix/provider/B/consumer/A``` In *both* of these cases the matrix table in the UI *always* shows A as the consumer and B as the provider. Along with the relevant version, tag, verification result etc. Has anyone encountered this before? Is this a bug on the broker?s end or am I doing something wrong?

wesleythomaswilliams
2020-03-04 09:48
I've not had to deal with a bidirectional relationship yet, but I will have to quite soon. I'll report in when I do.

matt.fellows
2020-03-04 10:02
What do you mean by custom, sorry? I'm not familiar with molecular

matt.fellows
2020-03-04 10:03
We don't actually support specific protocols (like amqp or stomp or whatever) - just the message exchange.

matt.fellows
2020-03-04 10:04
There was something on this recently. I can't remember the outcome tho but maybe try a quick history search?

simon.nizov
2020-03-04 10:10
@matt.fellows Can you remember any keywords other than ?matrix? that can help find it?

matt.fellows
2020-03-04 10:12
Gah, I tried a few but nothing showing up either. Might be past the history buffer :man-facepalming:

hendrik
2020-03-04 12:25
Ok. Would be cool if you interfaced the whole thing so people could write their own adaptions for various protocols or purposes.

jussi.saurio
2020-03-04 17:16
has joined #general

jagmeet_randhawa
2020-03-04 18:44
has joined #general

bethskurrie
2020-03-04 19:09
@294simon are you on the very latest version of the Pact Broker?

bethskurrie
2020-03-04 19:13
There are definitely test cases for bi directional pacts for can I deploy. I wonder if the rows for the second pact are being truncated by the row limit.

bethskurrie
2020-03-04 19:18
I can't replicate the issue myself.

simon.nizov
2020-03-04 20:44
@bethskurrie is it intentional that both directions are shown in the same matrix?

bethskurrie
2020-03-04 21:44
Yes

bethskurrie
2020-03-04 21:44
You can't deploy just the consumer portion of an application. You deploy it as an application, and it has a role as both a consumer and a provider. The URL that you used to get there is just a convenience for the real query.

bethskurrie
2020-03-04 21:46
You'll notice that the form details don't mention consumer or provider.


bitsurfing
2020-03-04 22:59
has joined #general

alex.yianni
2020-03-05 04:49
has joined #general

simon.nizov
2020-03-05 06:51
Yes that always bothered me :D

simon.nizov
2020-03-05 06:54
It's probably the order+row limit that's the problem then. One direction has thousands of builds/versions more than the other. Is it possible to order by date in the query? The column header only orders what's already on the page.

bethskurrie
2020-03-05 06:55
Pactflow or OSS?

simon.nizov
2020-03-05 06:55
OSS

bethskurrie
2020-03-05 06:55
Yes, but not without a code change.

bethskurrie
2020-03-05 06:56
The best way for you to see results now is to put in the version numbers you care about.

bethskurrie
2020-03-05 06:56
It will be sorting by consumer name, then provider name, then date

bethskurrie
2020-03-05 06:56
You need it to sort by date, the consumer/provider

bethskurrie
2020-03-05 06:58
I can change the code and put out a release, but it'll have to be tomorrow.

simon.nizov
2020-03-05 07:04
That'll be great! No rush :blush:

smilewithvammy
2020-03-05 09:09
has joined #general

davidmolinero.com
2020-03-05 09:26
I can?t reproduce the problem anymore, I am getting the full log now and the state handlers are executed?

davidmolinero.com
2020-03-05 09:26
but this was definitely not working for me over the weekend

matt.fellows
2020-03-05 10:34
:man-shrugging:

matt.fellows
2020-03-05 10:34
weird

matt.fellows
2020-03-05 10:35
sorry I wish I could tell you more. I don?t think we?ve released anything recently that would affect that

tainguyen
2020-03-05 11:21
has joined #general

tainguyen
2020-03-05 11:24
hello

tainguyen
2020-03-05 11:26
I would like to send a POST request, where the request body get value from provider state However I am facing the issue: The request body content is escaped after it is rebuilt by using value injected from provider state https://github.com/DiUS/pact-jvm/issues/1031 Does anyone help me to solve this problem?

tainguyen
2020-03-05 11:26
Thanks alot

matt.fellows
2020-03-05 11:29
#pact-jvm

zshahnan
2020-03-05 12:23
has joined #general

davidmolinero.com
2020-03-05 13:09
thanks anyway, I?ll keep an eye on it

chakravarthi.sara
2020-03-05 15:12
has joined #general

jarmy
2020-03-05 16:33
has joined #general

reemadhiman92
2020-03-05 19:25
has joined #general

2020-03-05 21:52
A new post has been created in *Feature Requests*


bethskurrie
2020-03-05 21:53
Give it a vote if you're keen @hendrik

bethskurrie
2020-03-05 22:17
Peeps who are using the Pact Broker/Pactflow, if you're looking for a high level list of the tasks that need to be done to integrate your CI with a broker, there's a checklist here: https://docs.pact.io/pact_broker/set_up_checklist

hendrik
2020-03-06 07:45
Done

sjdl
2020-03-06 11:07
has joined #general

labardinim
2020-03-06 15:12
has joined #general

phil.brock
2020-03-06 19:17
has joined #general

regi24
2020-03-06 22:06
has joined #general

dashrath.mundkar545
2020-03-07 15:38
has joined #general


dashrath.mundkar545
2020-03-07 15:45
any solution guys? anyone using pact broker behind keycloak proxy?

bethskurrie
2020-03-08 21:58
Only basic auth and bearer tokens are supported @dashrath.mundkar545

abhi358
2020-03-09 01:03
has joined #general

dashrath.mundkar545
2020-03-09 07:41
do I have to include bearer token on pact container as ENV variable?

dashrath.mundkar545
2020-03-09 07:42
if possible could you provide me example??

bethskurrie
2020-03-09 07:49
Sorry, I mean the pact clients only support basic auth and bearer tokens.

bethskurrie
2020-03-09 07:49
The oss pact broker only supports basic auth

bethskurrie
2020-03-09 07:50
The bearer token code was written to support http://pactflow.io

dashrath.mundkar545
2020-03-09 07:50
Okay

dashrath.mundkar545
2020-03-09 07:51
I looks like kaycloak and basic auth is not working together

bethskurrie
2020-03-09 07:51
I don't know how keycloak works for protecting an api unfortunately.

bethskurrie
2020-03-09 07:52
My gut feel is that what you're trying to do is probably not possible.

dashrath.mundkar545
2020-03-09 07:53
Yes

dashrath.mundkar545
2020-03-09 07:54
what I did is that I allowed basic auth on conatiner and I also added keycloak for browser based login? but it gives me 400 error

bethskurrie
2020-03-09 07:54
Pactflow allows you to have different auth for the UI and the API but we've been able to do that only by separating those concerns at the code level.

bethskurrie
2020-03-09 07:54
From the outside, I can't see how it could be done.

dashrath.mundkar545
2020-03-09 08:06
okaz

karl
2020-03-09 10:02
Update from my side! It had to do with the library and how it handled paths, it's not documented very clearly!

karl
2020-03-09 10:02
But now it works hah!

karl
2020-03-09 10:03
So thanks for your help

wesleythomaswilliams
2020-03-09 10:15
:+1:

karl
2020-03-09 10:28
Hey guys! I'm wondering about the pact write mode: Update, Overwrite and Merge. We have it setup so that local devs on their own laptops can publish to the broker with the version x.x.x-dev. I would like for every push to the version to overwrite since it's a dev version. However when I set the provider pact write mode to overwrite, it just keeps adding more x.x.x-dev to the matrix?

karl
2020-03-09 10:30
When publishing the consumer pact file ii overwirtes correctly, but the provider verification publishes new results and does not overwrite old ones. I'm guessing it should overwrite and the "revision" number should increment?

karl
2020-03-09 10:36
Also when publishing the first consumer pact file overwrite doesn't work, just states "No pact files found". I was expecting it to publish if nothing exists and overwrite if there is already one that exists.

dashrath.mundkar545
2020-03-09 10:49
Hi @bethskurrie,

dashrath.mundkar545
2020-03-09 10:50
Where I can get pact broker api token?

karl
2020-03-09 10:50
Also when using TypeScript it states that the different values for the following Type "PactfileWriteMode" are: "overwrite" | "update" | "merge", I use overwrite, when running the consumer test and the message comes up: [2020-03-09T11:07:02.659Z] INFO: pact-node@10.5.0/26881 on karl-Dell-Precision-M3800: Could not find command "overwrite".

karl
2020-03-09 12:20
I'm also wondering if the pact files should be commited to version control?

simon.nizov
2020-03-09 12:30
Nope. The broker is how you should share pacts. Your CI build should generate the pact files (by running the test suite) and publish them to the broker.

karl
2020-03-09 12:40
Ok, that's what I do currently great!

slimak2387
2020-03-09 13:31
has joined #general

vasilisnx
2020-03-09 14:08
has joined #general

dikili
2020-03-09 14:50
has joined #general

nithya.ganesan
2020-03-09 16:59
has joined #general

ahsan_bhai
2020-03-09 17:35
I am looking for some clarification in regards to the recent fix for this issue: https://github.com/DiUS/pact-jvm/issues/768 I've tried to test with `4.0.7` with `@IgnoreNoPactsToVerify` annotation. I get NullPointerException on `PactVerificationContext`. It looks like `context` variable is still set to null when there are no pacts found in pact broker. ```@IgnoreNoPactsToVerify @ExtendWith(SpringExtension.class) @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT ) @Provider("invalid-provider") @PactBroker( host = "${pact.broker.host}", port = "${pact.broker.port}", tags = "${pact.consumer.tag}", authentication = @PactBrokerAuth(username = "${pact.broker.username}", password = "${pact.broker.password}") ) public class ProviderTests { @LocalServerPort private int serverPort; @BeforeEach void setupTestTarget(PactVerificationContext context) { System.out.println(context); // this returns null context.setTarget(new HttpTestTarget("localhost", serverPort, "/")); } }``` Does anyone have any idea how to NOT fail pact provider tests in JUnit5 when pacts cannot be found. I assume `IgnoreNoPactsToVerify` is for that purpose. But it just doesn't seem to work as desired with JUnit5.

bethskurrie
2020-03-09 19:32
These questions are best asked in the #pact-broker channel @karl

bethskurrie
2020-03-09 19:34
The pact file write mode is only for the mock service. It does not relate to the Pact Broker.

bethskurrie
2020-03-09 19:37
It tells the mock service how to deal with existing pact files that are already in the folder.

bethskurrie
2020-03-09 19:37
If you're just starting out, I would leave this as its default value. (ie. don't set it)

bethskurrie
2020-03-09 19:37
Setting it to a custom value is only for advanced use cases.

bethskurrie
2020-03-09 19:39
Having devs publish from their laptops is an unusual approach. What are you trying to achieve?

bethskurrie
2020-03-09 19:40
You can't in the OSS code @dashrath.mundkar545

bethskurrie
2020-03-09 19:40
It's only implemented in http://pactflow.io

bethskurrie
2020-03-09 19:40
The OSS pact broker only supports basic auth

bethskurrie
2020-03-09 19:42
You would need to make your own docker container and use some Rack Middleware that checks for bearer tokens.

bethskurrie
2020-03-09 19:45
Best to ask in the #pact-jvm channel @ahsan_bhai

ahsan_bhai
2020-03-09 19:48
Thank you for your reply @bethskurrie

bethskurrie
2020-03-09 19:49
No data in the pact broker is ever lost unless you delete it explicitly. Publishing a pact with the same consumer version makes a new revision, rather than deleting the existing one. If you change the "group by" selection in the matrix page to "latest by consumer version and provider version" you'll only see the latest revision.

bethskurrie
2020-03-09 19:50
Also, if that's not your default view, you're probably not on the latest broker version, and it's worth updating.

aaron
2020-03-09 21:34
has joined #general

2020-03-10 08:09
A post in *Feature Requests* has been marked as *in progress*

karl
2020-03-10 08:18
Aha I gotcha, ok I'll remove the pactWriteMode completely thanks! Regarding the local dev thing, to increase dev time and reduce wait time on the CI: one little change, commit, push, open up CI UI, wait for build, wait for contract tests to pass or fail = it just takes far too much time from a dev. So I've dedicated a version for devs (x.x.x-dev) so they can make the change, contract test locally(which would push to the broker) and just check the broker immediately to see if their change made the contract test pass, this means they can be confident when pushing to the repo the CI will pass. This was also the reason I was looking into the "overwrite", I was hoping it was the option to overwrite previous verifications, since in the case of x.x.x-dev we don't care about previous versions. We do however care about the x.x.x versions and they are set via the CI. I hope you understand my thought of mind? (I basically want to reduce dev time and reduce the amount of failed builds in the CI due to contract test failings)

bethskurrie
2020-03-10 08:43
I do understand


bethskurrie
2020-03-10 08:48
Typically, we recommend making changes to pacts on a branch of the consumer, and to only merge once the pact has been successfully verified, to avoid blocking master.

bethskurrie
2020-03-10 08:48
Would this not work for you?

dikili
2020-03-10 16:51
~hi i would like my provider test result of pact file be sent to http://pact-broker site~

dikili
2020-03-10 16:52
~how do i manage to do this ?~

dikili
2020-03-10 16:52
~can i use the APIs ?~

dikili
2020-03-10 16:54
~i use pactflow ui~

dikili
2020-03-10 17:19
hi, i have a pact file submitted to pact broker (i use pactflow) via api end point

dikili
2020-03-10 17:23
i need the provider to verify the Pact, in my local it is working fine but this is the provider code, can you advise how i can amend it to get provider test will work and i can see in the pactflow dashboard that it is verified after running it ? var comp= new PactClient(); //this is calling the api endpoint /pacts/provider/provider/consumer/Service_Consumer/latest to retrieve the pact file which works fine var pact= comp.GetPact(); var config = new PactVerifierConfig { Outputters = new List<IOutput> { new XUnitOutput(_output) }, Verbose = true }; // Act + Assert Uri pactFile = new Uri(pact.ResponseUri.ToString()); //test fails in the below code new PactVerifier(config) .ServiceProvider("Service_Consumer", "https://dev-apiendpoint.co.uk/mobile-api/") .HonoursPactWith("pactcontract") .PactUri(pact.ResponseUri.ToString()) .Verify( description: "A request is made", providerState: "A GET request for getting titles is submitted");

dikili
2020-03-10 18:24
@here in the above code i changed PactUri with .PactBroker(pact.ResponseUri.AbsoluteUri) as i use pact broker( pactflow) , but it still fails, can you pls advise me what i am not doing right pls ?

dikili
2020-03-10 18:26
@here with this error: PactNet.PactFailureException: 'Pact verification failed. See output for details. If the output is empty please provide a custom config.Outputters (IOutput) for your test framework, as we couldn't write to the console

dikili
2020-03-10 18:26
@here your support appreciated!

bethskurrie
2020-03-10 19:28
@dikili best to ask in the channel for your language, #pact-net

bethskurrie
2020-03-10 19:28
Also, you need to turn on the publishing.


matt.fellows
2020-03-10 21:42
Also - if you could format your code that would help readability a lot

bethskurrie
2020-03-10 21:47
I've released this in 2.51.0-1 @simon.nizov

vaikar.abhijeet
2020-03-11 04:30
has joined #general

vaikar.abhijeet
2020-03-11 04:43
Hello :man-raising-hand: I'm here to understand some principles and concepts in contract testing in general. Based on all that I have read about contract testing / consumer driven contract testing I have many doubts. Here they are: 1. Is contract testing and consumer driven contract testing different? 2. This page: https://docs.pact.io/consumer/contract_tests_not_functional_tests gives an example that verifies status code of service as part of contract test. Why is status code verification part of contract tests? 3. Is it correct to say that the difference between functional and contract tests is that the scenarios for both can be same but the verifications/checks are different? Functional tests for correctness of the values in the response and contract tests for the correctness of the schema structure? 4. Why do we say contract testing should be about catching bugs in the consumer? If the contract is meant for the provider shouldn't it be bugs in the provider because if the provider breaks the contract the consumer will get affected.

vaikar.abhijeet
2020-03-11 04:55
To give a bit of a background, I am working on setting up a strategy for contract tests for `gRPC based microservices` in my organisation. To do that, I'm getting the foundation of what and how contract testing works.

vaikar.abhijeet
2020-03-11 05:44
Also, 5. I read here: https://martinfowler.com/bliki/ContractTest.html that contract tests are not supposed to be part of regular build pipeline, they can be run once in day. How would that work if a provider's contract is changed and deployed to production and the contract tests don't run as part of the provider's build pipeline?

simon.nizov
2020-03-11 06:28
Awesome, thanks!

abubics
2020-03-11 06:35
1. Consumer-driven contract testing is a specific kind of contract testing. In the Fowler link you added, it's mentioned: > To reduce the chances of unexpected breaks in contracts, it's useful to move to a https://martinfowler.com/articles/consumerDrivenContracts.html approach.

abubics
2020-03-11 06:37
2. HTTP is an application-level protocol, and often status codes are used to indicate operation completion status. If you have a different schema, where, for example, everything returns a status of 200, but potentially errors in the body, this approach may be less relevant.

abubics
2020-03-11 06:39
3. Functional tests usually check the validity of state changes. Contract tests intend to verify interaction effects (and not side-effects). They may have some overlap, as you mentioned :slightly_smiling_face:

abubics
2020-03-11 06:40
4. Contract tests can catch bugs in both the consumer and provider. The classes of test on each side may differ.

abubics
2020-03-11 07:25
5. That post is old, and kinda hints at using functional tests as a proxy for contract tests. The workflow described by pact is more advanced, and designed to be automated, fast, and run in CI on every commit, for both sides of each contract.

s1apped
2020-03-11 09:36
Hi. What is best approach to using @State. Lets say we have provider service A and consumer services B and C. Service A provides details about car e.g color, type, hp, mark Service B only needs mark, color and service C hp and type. So now consumers are responsible for defining @State e.g ```.given("Car exists with details expected by service B") .given("Car exists with details expected by service C")``` and provider responds appropriately. What about common state like throwing message when car is not found. Should be share state between multiple consumers?

joseph.haig
2020-03-11 09:43
Is it possible to remove a version tag using `pact-broker`? I would like to tag a consumer?s contract as (for example) `deploy` so that the provider can use that in the ?pact verify? step. Then, when I tag the contract for production, I?d like to remove `deploy`.

bethskurrie
2020-03-11 09:44
You can just keep adding them.

bethskurrie
2020-03-11 09:45
You typically use the latest for a particular tag anyway.

bethskurrie
2020-03-11 09:46
/... /latest/prod etc

bethskurrie
2020-03-11 09:47
You can send a http delete to the resource url if you really want to, but it's rarely necessary in the normal flow of things.

bethskurrie
2020-03-11 09:47
The only time it's really necessary is if you're rolling back to a previous version in prod. You have to remove the tag from the version you're undeploying.

joseph.haig
2020-03-11 09:48
Hmmm, OK. I know I can have multiple tags but I was thinking of not cluttering, so remove the ?deploy? tag when adding the ?prod? tag. Alternatively, can a ?pact verify? select the latest that doesn?t have a particular tag. We have just discovered (first time the contract changed) that the provider is configured to check against the latest prod. Hence, our (the consumer) pipeline failed the can-i-deploy.

bethskurrie
2020-03-11 09:49
I'm confused

bethskurrie
2020-03-11 09:49
Yes, it should check the latest prod

bethskurrie
2020-03-11 09:49
So you know it's backwards compatible

bethskurrie
2020-03-11 09:49
Otherwise, the provider might deploy to prod and break it.

bethskurrie
2020-03-11 09:50
You typically tag with the branch name and the environment name. The provider would generally verify master and prod.

joseph.haig
2020-03-11 09:51
I?m deploying a new version of the consumer. It publishes a new contract but it is not yet tagged as production, as it hasn?t made it there yet. The provider then runs the ?pact verify? but it takes the latest tagged version, and so ignores the one the consumer has just published.

bethskurrie
2020-03-11 09:51
That means it's compatible with the latest dev version, and backwards compatible with the prod version.

bethskurrie
2020-03-11 09:51
You should tag when you publish

joseph.haig
2020-03-11 09:51
OK, I?m missing that. Thanks.

bethskurrie
2020-03-11 09:52
Let me find you the docs on tagging


dikili
2020-03-11 09:53
Thank you @bethskurrie i did not realise #pact-net channel, thank you for your help, i will revise what you mentioned and if i still can not get it working with the formated latest code i will ask for support at #pact-net

dikili
2020-03-11 09:53
thanks

wesleythomaswilliams
2020-03-11 10:07
I think that's specifically talking about contracts with external services. If you own all the services you're contract testing, integrating it with your pipeline is the way to go. imo.

dikili
2020-03-11 10:21
I also started learning CDCT approach recently, and i really benefited from these questions/answers, i have one more question, in the ideal scenerio in the ci/cd pipeline, should both consumer and provider tests run ? from my understanding running the provider test on the pipeline should suffice before deployment if no change is made ? And also when i look at the provider test verifications can there be more than one test ? it looks like to me all provder does it check the contract and pass parameters of the actual service etc.. and call Verify() method , why is there a notion where it looks like there can be more than one provider test ?

dikili
2020-03-11 10:21
thanks

bethskurrie
2020-03-11 10:33
You can share states. Just make sure the consumers are using type based matching so the exact values don't matter.

bethskurrie
2020-03-11 10:34
Some other Pact implementations allow you to namespace the states by consumer name.

bethskurrie
2020-03-11 10:36
If you're finding the lack of namespacing is a problem, raise an issue in pact-jvm, because we were just talking about it the other day.

bethskurrie
2020-03-11 10:36
I suspect with type based matching, it's not such an issue, because we haven't had many people asking for it over the years.

matt.fellows
2020-03-11 10:48
Yes. That article is misleading, and is probably a bit out of date with regards to tools like Pact

matt.fellows
2020-03-11 10:48
(dated 2011)

matt.fellows
2020-03-11 10:49
Pact (and SCC) contract tests are generally fast, cheap and can be run as often as unit tests - so you should definitely do that as a starting point

matt.fellows
2020-03-11 10:51
> n the ideal scenerio in the ci/cd pipeline, should both consumer and provider tests run ? Not in the same pipeline (at least, not usually). You?re usually not changing them both at the same time, they?re often developed/owned by separate teams. They have separate lifecycles.

matt.fellows
2020-03-11 10:51
Run the respective contract tests for consumer and provider in each of their pipelines

matt.fellows
2020-03-11 10:53
> And also when i look at the provider test verifications can there be more than one test ? it looks like to me all provder does it check the contract and pass parameters of the actual service etc.. and call Verify() method , why is there a notion where it looks like there can be more than one provider test ? I?m not exactly sure what you?re asking. But the ?verify? is just the command to tell Pact to fetch all of the contracts (consumers and their expectations) and then test that every single one of those can be satisfied by the provider - in most project, these could be considered hundreds of tests (many scenarios, checking headers, body, status code etc.)

matt.fellows
2020-03-11 10:53
> Is contract testing and consumer driven contract testing different? Yes. See Andras as per above. But basically, consumer-driven is just a philosophical position that says ?consumers drive the contract design?, and Pact makes that easier to do. Contract testing is simply ensuring that a contract is compatible (on both sides) > This page: https://docs.pact.io/consumer/contract_tests_not_functional_tests gives an example that verifies status code of service as part of contract test. Why is status code verification part of contract tests? Why _wouldn?t_ you think it?s part of the contract? > Is it correct to say that the difference between functional and contract tests is that the scenarios for both can be same but the verifications/checks are different? Functional tests for correctness of the values in the response and contract tests for the correctness of the schema structure? I wouldn?t split it that way, albeit as has been stated there may be overlap. Contract tests are about the messages that go back and forward, and if both sides are able to agree on how they communicate. Functional testing is more about what both sides _do_ in response to those messages - did the email get sent off? Did the user state update? etc. > Why do we say contract testing should be about catching bugs in the consumer? If the contract is meant for the provider shouldn?t it be bugs in the provider because if the provider breaks the contract the consumer will get affected. Contract tests also ensure that the consumer does what it says. All to often, consumers say ?we need all of these things? but don?t validate that their code actually does it. This means that when the provider comes to change, they don?t know what the impact of the change would be. If we ensure the consumer behaves as expected, the contract is exactly what the consumer needs - no more or less. This is good for everyone

dikili
2020-03-11 11:22
Ok, sorry i guess i could not communicate well, What i was trying to say is , if consumer produced one pact file, one provider test to verify it would suffice is this right? what is the scenerio/use case for adding multiple provider tests in one class since Verify command in one test does all the verification of the pact which means many tests , creating multiple provider classes does not make sense, is this right , is it more clear now ? One of [Fact] public void TestProvider() {//do the verify} is sufficient to handle all the verifications, is there a scenerio where i need to add multiple of above TestProvider2() etc... in one project ?

s1apped
2020-03-11 11:42
basically what I found that having 2 consumer calling 1 provider enforeces some naming convenction for @State becasue you can't have 2 exact same @States even in separate consumers. I think that common state for things like errors is ok. I will take a look into namespacing

s1apped
2020-03-11 11:44
With sharing states issue is that consumer dictates what it should be so with sharing it might be a hassle

matt.fellows
2020-03-11 11:51
Oh right, then yes I believe that's the case across all languages. Sorry for any confusion!

adamadiopzongo
2020-03-11 14:48
has joined #general

timo
2020-03-11 15:00
has joined #general

dikili
2020-03-11 15:04
@bethskurrie when you say turning it on now i use this config; var config = new PactVerifierConfig { Outputters = new List<IOutput> { new XUnitOutput(_output) }, ProviderVersion = "1.0.0", PublishVerificationResults = true, CustomHeaders = new Dictionary<string, string> { { "Authorization", "Bearer xxxx" } }, }; is there anything else i need to do for turning it on as far as you aware because i can not see any ? thank you

bethskurrie
2020-03-11 21:25
@dikili I don't know, as I'm not a JVM developer.

bethskurrie
2020-03-11 21:26
Best to ask in the #pact-jvm channel

bethskurrie
2020-03-11 21:27
Or is that Pact Net?

neil
2020-03-11 23:34
Yeah that?s .NET

neil
2020-03-11 23:34
`PublishVerificationResults = true` will publish the result of the verification to the broker

bethskurrie
2020-03-12 00:44
Pact message people. You know how we tell people what scope of each of the consumer and provider to cover in each of the tests (out the back door of the consumer, covering as much of the provider as you need)? How much of the consumer/provider is a good amount when you're testing message pact?

unitsix
2020-03-12 02:41
has joined #general

bethskurrie
2020-03-12 07:13
Good article on hexagonal architecture in the Netflix tech blog mentions they want to use contract testing, and links to http://docs.pact.io https://netflixtechblog.com/ready-for-changes-with-hexagonal-architecture-b315ec967749

matt.fellows
2020-03-12 08:57
Does it support bearer tokens Neil? I didn't see that on the link above

bethskurrie
2020-03-12 09:03
@matt.fellows yes, pact net does.

neil
2020-03-12 09:27
Yeah I think i see the problem. Replied in the thread in #pact-net

matt.fellows
2020-03-12 09:46
In https://www.slideshare.net/mobile/DiUSComputing/serverless-microservices-test-smarter-not-harder I argue for hexagonal architectures and suggest (in pact tests) that you should test the adapter (and not the protocol handler)

matt.fellows
2020-03-12 09:47
If we provided tools for specific message protocols - websockets, kafalka, AMQP etc then I would test both the port and adapter

matt.fellows
2020-03-12 09:47
But really, the same advice as HTTP

bethskurrie
2020-03-12 09:49
I've just been having a conversation on twitter where nobody is able to actually explain the difference between hexagonal and layered architecture, and yet they still insist there is a difference. Tomorrow's job is for you to explain to me what it is!

matt.fellows
2020-03-12 09:52
Ha!

matt.fellows
2020-03-12 09:52
Arguably Hexagonal is a form of layered arch.

bethskurrie
2020-03-12 10:11
As far as I can see, it's just sensible separation of concerns.

matt.fellows
2020-03-12 10:12
I like it because it's simple, easy to explain and easy to implement

bethskurrie
2020-03-12 10:12
Hm. Nobody I've seen has been able to explain it :-P

matt.fellows
2020-03-12 10:14
I'm going to peruse your Twitter timeline now...


simon.nizov
2020-03-12 12:24
Damir, one of the authors of the article, did a talk about this same topic at EuRuKo 2019. https://www.youtube.com/watch?v=YUX2tl3BMpw

jpieree1fchd
2020-03-12 12:38
has joined #general

dikili
2020-03-12 12:50
@here just a quick question, for the published pact files on pactflow, if we want to remove them is it possible to do on the UI ?

engin.marshall
2020-03-12 13:51
has joined #general

wesleythomaswilliams
2020-03-12 14:27
While I've been experimenting with Pact I've deleted quite a few. I usually delete my pacticipant, rather than the pact file, but it can all be done inside the HAL Browser for the API

dikili
2020-03-12 14:36
thanks

dikili
2020-03-12 14:37
@bethskurrie @neil thank you

dikili
2020-03-12 14:38
also i realised you need to provide ProviderVersion as well in order for this to work

sarathojha
2020-03-12 15:31
has joined #general

dikili
2020-03-12 15:39
@here I have a question as a result of interesting behaviour I am getting from pact: I run a consumer test with consumer2 and provider2 and consumer test passes and produces the pact as consumer2-provider2.json PactBuilder .ServiceConsumer("consumer3") .HasPactWith("provider3"); then i change the name and leave everything same to consumer3 and provider3 , the test then fails with error : http://System.IO.FileNotFoundException : Could not find file 'c:\source\contractfile\pacts\consumer3-provider3.json'. and when i look at the folder i do not see that file, and sometimes no files is being created and sometimes what gets created is the previous one which is consumer2-provider2.json ultimately since i expect consumer3-provider3.json test fails, does anyone understand the issue here please ?

wieslaw.mlynarski
2020-03-12 17:13
has joined #general

wieslaw.mlynarski
2020-03-12 17:31
Hey everyone. I noticed an incompatibility while updating between, "au.com.dius:pact-jvm-provider-junit5:4.0.6" "au.com.dius:pact-jvm-provider-junit5:4.0.7" https://github.com/DiUS/pact-jvm/blob/6fd8adbc33fe472cd5e3a1299cfda54c74b6ff15/provider/pact-jvm-provider/src/main/kotlin/au/com/dius/pact/provider/ProviderClient.kt#L297 the issue is that the code changed from "application/json", to "text/plain; charset=ISO-8859-1" which as a result makes the test fail, the application under test does not accept "text/plain". I am checking if I can create a fix for that.

bethskurrie
2020-03-12 19:29
@wieslaw.mlynarski shouldn't you be setting your own content type header anyway?

bethskurrie
2020-03-12 19:29
I would imagine that overrides the default that the JVM code sets.

bethskurrie
2020-03-12 19:30
Please ask in #pact-net @dikili

bethskurrie
2020-03-12 19:32
@dikili you can delete them through the old OSS UI. You'll see a blue toggle button at the top of the screen.

bethskurrie
2020-03-12 19:34
You can delete a single pact on the pact page (click the ...) and you can delete all the pacts for an integration on the index page by clicking on the ... button next to the integration.

matt.fellows
2020-03-12 21:41
The docs mentioned that from what I could see

bethskurrie
2020-03-12 22:11
@tjones once tried to explain it to me...

tjones
2020-03-12 22:55
In my view, they?re largely the same thing in different words

bethskurrie
2020-03-12 23:00
FFS. That's what I've been suspecting all along.

bsigney
2020-03-12 23:02
has joined #general

matt.fellows
2020-03-12 23:35
haha

matt.fellows
2020-03-13 00:03
OK so here?s my take on it (probably controversially): 1. Hexagonical architecture _is_ a type of layered architecture (it just arranges layers a little differently). 2. The aims of both are largely to provide separation of concerns and modularity 3. Both have strong direction dependency - the inner layers of hexagonal should not know about the outer. Each layer only knows about the layer directly beneath 4. Layered architecture is more broad - it?s fractal. For example, you can apply it to a distributed system (e.g. client server) or to a single system (monolithic app) 5. Hexagonal architecture is generally applied to a single application boundary / process. One of it?s stated aims is to increase the testability of applications 6. Hexagonal architecture establishes a common vocabulary that can be used to talk about specific abstractions within code bases - ports, adapters, repositories, services, domain (they are not all original of course) 7. One notable difference is that it separates the idea of ?presentation? to simply ?inputs? and ?outputs?. Presentation is typically at the ?top? of a layered architecture. But that has some consequences, because often times presentation moves in different directions (not just ?inbound? from a user). Having inputs and outputs (an abstraction of presentation if you will) gives increased flexibility and resolves some of the coupling problems a layered architecture may introduce solving that challenge But a lot of the difference is splitting heirs. TL;DR - hexagonal architecture is a specific implementation of a layered architecture

abubics
2020-03-13 02:27
I basically agree . . . clean & hexagonal are pretty much the same thing, and both have directionality embedded in the definition. They're a specific kind of layered arch. There are many other kinds of layered architectures, with different directionality profiles and topologies :slightly_smiling_face:

bethskurrie
2020-03-13 02:29
I'd love an example :wink:

bethskurrie
2020-03-13 02:30
So far I've heard, it's just a different way of conceptualising the same thing, with some different labels.

bethskurrie
2020-03-13 02:31
I want to understand how it would change the way I'd write or structure my code.

bethskurrie
2020-03-13 02:32
for example, the PB has very clearly defined and well separated classes. HTTP handler is separate from body parsing, completely separate from business logic, and everything goes through a repository (even if the respository does return Sequel models rather than POROs).

bethskurrie
2020-03-13 02:33
Is that hexagonal?

bethskurrie
2020-03-13 02:33
Each of those concerns is orthogonal

bethskurrie
2020-03-13 02:33
Unlike some opinionated frameworks where all your routes/requests/validation etc are very tightly coupled

matt.fellows
2020-03-13 02:36
Here is a port (the lambda handler), adapter (the kinesis specific handler), and the business objects (service, repository, domain)

matt.fellows
2020-03-13 02:37
:point_up: very basic/crude example, but hopefully gives you an idea. I?m not sure it really matters that you can say ?that?s a hexagonal architecture? in hindsight - the goal isn?t to be hexagonal, but to be able to do the things you describe.

matt.fellows
2020-03-13 02:38
terminology is probably the main identifier, assuming the other properties exist

abubics
2020-03-13 03:06
The main thing from clean architecture is that the inner layers don't know about the outer layers. Inner is more abstract (domain concerns & modelling), and outer is more concrete (specific protocols, libraries, platforms, etc). Due to the implications of these properties, you should be able to plug different http libraries, or database drivers, for example, without changing any domain code. Likewise, you should be able to swap presentation layers easily (e.g. move from react to svelte, or use the core in Android and some other JVM target). There are some patterns that may be less obvious to inexperienced developers, like how to invert the directionality of some inter-layer interfaces. There are some ways to enforce the architecture, like having layers in their own modules, or banning imports from certain areas.

abubics
2020-03-13 03:12
What often happen in frameworks like Spring, etc, is a top-to-bottom layering, where the domain logic is distributed across several layers. This is canonically not "clean", because the domain concerns aren't modelled separately from platform concerns, and the layers usually know about each other, bidirectionally. You can make Spring clean, but it's tricky because it blends some concerns in some of the layers, and encourages configuration tentacles & annotation leakage.

matt.fellows
2020-03-13 03:12
Indeed

matt.fellows
2020-03-13 03:13
The abstractness is more of an emphasis in hexagonal, and something not really communicated in (traditional) layered architectures

matt.fellows
2020-03-13 03:13
it doesn?t mean you can?t do it, because of course you can

bethskurrie
2020-03-13 03:16
I'm going to blame java

matt.fellows
2020-03-13 03:18
ahmmm also Rails

bethskurrie
2020-03-13 03:19
zactly

bethskurrie
2020-03-13 03:19
however, Rails was invented as a backlash to java frameworks, so I'll still blame java.

matt.fellows
2020-03-13 03:21
lol

tjones
2020-03-13 03:31
I blame OO

bentstuart
2020-03-13 05:25
has joined #general

bentstuart
2020-03-13 05:27
Howdy there. I am wondering if anyone would be able to help me with pact-jvm pact messaging https://github.com/DiUS/pact-jvm/issues/1047

bethskurrie
2020-03-13 05:28
Try #pact-jvm-help @bentstuart


bentstuart
2020-03-13 05:29
Thanks @ben7091

bethskurrie
2020-03-13 05:36
Hey people. Is anyone interested in doing some slack plugin dev to help new users onboard to our slack community? We'd like to make a welcome bot that posts a private message to new users, in the #general channel. The free welcome bot lets you do either a public message (which ends up being noisy for everyone else) or a PM (which nobody ever really notices). There's a template for writing a welcome bot in the Slack docs. It would be a fun little job for someone who has more free time than I do! Let me know if you'd be interested.

bradyzp
2020-03-13 21:36
has joined #general

bheemreddy181
2020-03-13 23:25
I can give a try if you can direct me

sumeshs572
2020-03-16 15:29
@bethskurrie could you please confirm which version of pact broker have this latest UI feature, is u see pactfoundation/pact-broker or dius/pact-broker in dockerhub

matt.fellows
2020-03-17 00:09
Anybody here used Pact with Mulesoft before?

engin.marshall
2020-03-17 09:13
Or with NestJs? :slightly_smiling_face:

tausif2909
2020-03-17 10:52
Hello I am looking for example to update request while running provider verification for below calls `/api/asset/1234` & `/api/assets?assetId=1234` .


tausif2909
2020-03-17 10:56
Can someone share the example to handle such cases in Java (JVM Maven) based framework?

matt.fellows
2020-03-17 10:57
The feature is probably called ?request filters? - try searching that

matt.fellows
2020-03-17 10:57
also check out #pact-jvm-help


tainguyen
2020-03-17 11:03
Is that you're looking for?

tausif2909
2020-03-17 11:10
ok, I tried to use request filters like below but it worked for updating path, not working for query parameters like `/api/assets?assetId=1234`.

tausif2909
2020-03-17 11:11
```@TargetRequestFilter public void updateRequest(HttpRequest request) throws Exception { HttpGet httpGet = (HttpGet) request; URIBuilder builder = new URIBuilder(httpGet.getURI()); builder.setPath(builder.getPath().replaceAll("/api/assets/20000", "/api/assets/" + mediaAssetId) .replaceAll("/api/assets/21000","/api/assets/" + rootGroupAssetId)); System.out.println("Built request is "+request); }```

matt.fellows
2020-03-17 11:12
Check the API docs for URIBuilder - I?m sure it has an API to handle query params

tainguyen
2020-03-17 11:12
U can use queryParameterFromProviderState

tainguyen
2020-03-17 11:13
how about update request body?

tausif2909
2020-03-17 11:15
Yes, But I dont find any example of it


kevin.meiresonne
2020-03-17 12:48
Is there a way to have flexible matching on the response status code? We want to specify in our pact that for a given state, the response can be a 4xx status code We can't use the regex matcher, as that only works on string values, whereas the status code is a numeric

matt.fellows
2020-03-17 12:49
no, it has to be exact (at this moment). I think all libraries are consistent on this

nerea.tamayo
2020-03-17 16:18
Hi!! Do you know if there is somthing for reporting benefits we get using Pact?I mean, I?d like to generate report in order to show the errrors we avoid applying consumer driven contract testing

nerea.tamayo
2020-03-17 16:18
Any ideas?

wieslaw.mlynarski
2020-03-17 16:37
@bethskurrie the Interaction looks something like this ```{ "method": "POST", "path": "/postEndpoint", "body": { .... } }``` In this interaction there is no content type. I am aware it could be set. In this case after upgrading version 4.0.6-> 4.0.y the default content type changed setting it to "text" (before was application/json) causing the service endpoint to return `expected status of 204 but was 415` I posted this PR https://github.com/DiUS/pact-jvm/pull/1046 to try go around this in situation when you know that the payload is a "JSON" document and no header is specified.

kevin.meiresonne
2020-03-17 18:38
If you're using the pact broker maybe you can use the pact broker metrics API It gives you an overview of stats on your pacts and their verifications. e.g. ```... "verificationResults": { "count": 35457, "successCount": 45824, "failureCount": 3522, "distinctCount": 40245, "first": "2017-1-24T11:37:46+00:00", "last": "2020-03-17T16:28:50+00:00" }, ...``` Every failed pact verification is a potential error you avoided. Although this would heavily depend on your workflow, as while developing a new feature/change you could have quite a few failures when pushing code and triggering pact verifications. I guess it depends a bit on what you consider "avoided errors"

matt.fellows
2020-03-17 20:20
Great question Nerea! We'd like to add first class metrics into Pactflow, but feel free to raise a feature request and talk about the things you'd like to see. Failed verifications are one. I would also look at metrics from use of can-i-deploy. On a current client, we wrapped this command and sent data to datadog to measure this

matt.fellows
2020-03-17 20:21
We also have done some preliminary work to measure cycle times - e.g. how long from when a contract started to being deployed to prod

steffen.vulpius
2020-03-17 23:48
has joined #general

steffen.vulpius
2020-03-17 23:53
Hi, I'm going through the pact workshop in Go and am stuck at Step 3. It seems no pact file is written.

matt.fellows
2020-03-18 00:00
can you please post CLI output in #pact-go ?

steffen.vulpius
2020-03-18 00:08
thanks @matt.fellows

networkandcode
2020-03-18 06:01
has joined #general

nerea.tamayo
2020-03-18 09:25
Nice!!thanks a lot, I?m going to spend some time on this in order to suggest some features!!Thanks!!

nerea.tamayo
2020-03-18 09:26
Nice, I?ll have .a look, thanks!!

matt.fellows
2020-03-18 09:36
Awesome - that?d be great, thanks Nerea

bethskurrie
2020-03-18 09:46
I'd be interested to hear your thoughts @nerea.tamayo

bethskurrie
2020-03-18 09:49
One of the great benefits of using pact is that bugs get fixed before code is even committed, but the downside is, that does make it hard to count them!

matt.fellows
2020-03-18 09:50
this is true

matt.fellows
2020-03-18 09:51
I think this is where metrics emitted from CLI tools would help - if we rely on metrics solely from the Broker, then we only get part of the picture.

matt.fellows
2020-03-18 09:51
Instrumenting calls like can-i-deploy, and failed local verifications could be illuminating

bethskurrie
2020-03-18 09:52
We can count deployments that have been prevented due to missing or failed verifications.

bethskurrie
2020-03-18 09:52
Auth would be tricky.

matt.fellows
2020-03-18 09:52
Another option could be to always publish the results (but not treat them as failures in the broker). This way we get fine grained metrics (essentially, the publish flag is just a toggle to say ?metric? or ?real?)

matt.fellows
2020-03-18 09:52
yeah

bethskurrie
2020-03-18 09:53
Devs shouldn't be using write tokens

bethskurrie
2020-03-18 09:53
So it would have to be a special endpoint.

matt.fellows
2020-03-18 09:53
I think our current API access key model needs improvement. The idea of across the board ?read-only? and ?write-only? will have to change with RBAC etc.

matt.fellows
2020-03-18 09:54
For example, you _should_ be able to modify details scoped to your user (e.g. your email address, name, password)

bethskurrie
2020-03-18 09:54
Good point

matt.fellows
2020-03-18 09:54
I know I?m conflating various roadmap items here, but good to have the full picture in view

matt.fellows
2020-03-18 09:55
I think a simpler starting point is to simply have a metrics receiver endpoint, and instrument CLI/frameworks that run locally

matt.fellows
2020-03-18 09:55
P.S. Happy 3 year anniversary!!! :tada:

bethskurrie
2020-03-18 09:56
Yes, that could work.

matt.fellows
2020-03-18 09:58
@kevin.meiresonne keen to hear your thoughts. The metrics endpoint is fairly rudimentary, is it something you actually use?

kevin.meiresonne
2020-03-18 10:09
No, tbh, I just found it by accident yesterday when browsing the API :slightly_smiling_face:

kevin.meiresonne
2020-03-18 10:09
It's rudimentary, but nice to get a global idea on how much we use the pact broker

matt.fellows
2020-03-18 10:10
turns out quite a bit

kevin.meiresonne
2020-03-18 10:11
not sure if there's a way to get metrics on a particular tag? Like "show me all verification metrics on the master branches"

pawarsumit12
2020-03-18 14:06
has joined #general

arho.huttunen
2020-03-18 18:55
has joined #general

bethskurrie
2020-03-18 21:12
No, but that's a good idea @kevin.meiresonne

anoop.nair
2020-03-19 03:37
has joined #general

jks
2020-03-19 13:13
Is '$.foo.item.#text' a valid matcher for ```<foo><item>1</item><item>2</item><item>3</item></foo>``` if we wanted to match text nodes? pact-jvm is throwing an exception: ```http://au.com.dius.pact.core.model.InvalidPathExpression: Expected either a "*" or path identifier in path expression "$.foo.item.#text" at index 11``` I realize this description is for rust https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_matching, but since it's for the pact-specification I was hoping it was same for pact-jvm.

uglyog
2020-03-19 22:00
I initially developed the XML matchers to use `@name` to match an attribute and `#text` to match the combined text nodes, but have since realised that the matchers will be applied to the text contents of a node anyway and so targeting the text explicitly is not needed.

mick.mccarthy
2020-03-19 23:01
has joined #general

jks
2020-03-20 14:09
Thanks. As, I'm looking at XML matching I'm starting to recognize the differences between XML and JSON. Arrays for instance, say I have XML like: `<foo><title>my list</title><item>1</item><item>2</item><footer>my footer</footer></foo>` a JSON would be equivalent to: `{"foo": {"title": "my list", "item": [1,2], "footer": "my footer"}}` For JSON, if I wanted to match each instance of item with a different matcher I believe `$.foo.item[0]` and `$.foo.item[1]` matchers would work. However, I don't believe these matchers would work for the XML case. I haven't tried this yet, so if I'm wrong forgive me. Will that notation work for XML matching or are the brackets just used for matching element attributes?

adadache
2020-03-20 15:02
has joined #general

shero86
2020-03-20 16:34
hi guys, I have a valid contract with generated `Date` for request. So after every running the contract is generating almost the same (except the Date field), and when the contract is publishing, Pact broker assuming that this is a new version of contract. Any suggestions, how I can ignore that Date field for contract versioning? To match versions according to matcher? I tried with `generate` , but it didn?t work for me (using typescript).

matt.fellows
2020-03-20 22:20
Can you not have the date update each time - i.e. in the matcher, provide a hard-coded date as the example but use a regex to allow it to be diffeent? Please share your code in #pact-js and we?ll help you out

uglyog
2020-03-20 22:44
No, those should work. What I have come to realize is that `$.foo.item` should match all the items in XML, while in JSON it won?t.

waquino
2020-03-21 03:52
has joined #general

jks
2020-03-21 15:08
Thanks again. I'll write some tests to get a better understanding for myself.

krosan
2020-03-21 19:28
has joined #general

vaikar.abhijeet
2020-03-22 10:42
Thanks all for such great replies. Really appreciate your efforts to explain :slightly_smiling_face: I'm still quite confused where to draw the line between functional testing and contract testing. _*Question 1:*_ Regarding functional test why are we talking about `side effects` only? Isn't verifying a `side effect` an integration test? _*Question 2:*_ If my feature is to create a user using a `UserService` where the business logic is: ? User's username should be a combination of first name and last name. ? User's default password should be their government identity that they provide. ? Every user should have a unique id. In this case verifying above will be functional tests right? _*Question 3:*_ Let's say my test-case is to verify that a user should get created when I call `createUser/` then the steps that come to my mind are: 1. Call `/userservice/createUser` with request data 2. Verify that response has the *same values* for user data that I passed in the request. Now this becomes a contract test or a functional test? _*Question 4:*_ For consumer driven contract tests *(without using pact)*, how, from your experiences and real implementations you have come across in organisation, was the continuous integration done? Assumptions: ? Organisation uses Github. ? Each microservice has it's own repository. ? Tests are written in their respective repositories. ? One provider service has many consumers. Is it like this? 1. Provider service code repository has it's functional tests *only*. 2. Consumer service code repository has it's functional tests and consumer tests for the provider. 3. Whenever provider service maintainers make any changes in the provider's code, a build pipeline is triggered on Jenkins (for eg). 4. This pipeline somehow knows that the provider has service B,C,D as consumer services. 5. Pipeline starts the provider service instance. 6. Pipeline triggers provider's functional tests. 7. Pipeline pulls the git repositories of services B, C, D and triggers the consumer driven contract tests. Is that how?

ewa
2020-03-22 11:39
has joined #general

vaikar.abhijeet
2020-03-22 12:25
_*Question 5:*_ If there's a service called OrderService which has an endpoint called GetOrders. So there can be some test-cases like: ? Return orders with specified ids, if found. ? Return empty list if offers don't exist for the user. ? orders include a `delivery_instructions` field if delivery instructions were provided for those orders. So above cases will be contract tests / functional tests?

matt.fellows
2020-03-23 03:18
Thanks for the detailed questions - I think you?re on the right path!

matt.fellows
2020-03-23 03:18
1: IMO an integration test is a type of functional test. At some point, you need to test for side effects - e.g. on a User persistance service, if you call the ?create()? function it should do the persistance thing. I don?t think you wanted to write integration tests for each of those scenarios over and above a unit test (we can go on for ages on the subtle diffeneces between unit/integration but that won?t be instructive) 2. Yes 3. > Let?s say my test-case is to verify that a user should get created when I call createUser/ then the steps that come to my mind are: > Call /userservice/createUser with request data > Verify that response has the same values for user data that I passed in the request. The steps you mentioned aren?t sufficient to test the ?and a user got created bit?, it simply looks at the API data itself. It?s actually neither. It?s the provider?s job to test ?createUser/? API and validate the behaviour - and that?s a form of functional test (probably an integration test given the amount of layers it would need to traverse in the API itself) A contract test simply says ?if POST /users {...}? is sent, I should get back a ?200? with ?these headers? and ?this body {...}? _AND_ that my API client is able to handle the response, and convert it into an internal model suitable for use throughout my code base > Verify that response has the same values for user data that I passed in the request. That sounds like the consumer is doing a functional test of the provider. Don?t do that, that?s just bad practice. That?s the provider?s job (see docs for commentary on this) 4. Yes, pretty much. > Pipeline pulls the git repositories of services B, C, D and triggers the consumer driven contract tests. I think a more broader statement is ?Provider pipeline retrieves the contracts for B, C and D and triggers the consumer driven contract tests?. I can?t think of many good cases where you?d want to be pulling down another projects? git repo.

matt.fellows
2020-03-23 03:23
Question 5: 1 + 2 are definitely contract test things, 3 is a grey area. You?re trying to ensure the client code is able to handle that field or not, it?s not about the functional use case. > So above cases will be contract tests / functional tests? I think you?re trying to find a clear line between functional tests and contract tests. Constantly focussing on that is probably not worth doing, because the truth is, _all_ types of testing overlap. What you should focus on is this: 1. Contract tests - try to find ways to break the communication/messages between systems. Get coverage of all of the API calls, and types of requests/responses that map to your usage patterns 2. Functional tests - try to find bugs in functional requirements to actual implementation. For example, a contract test doesn?t care if a user is added to a DB, a functional test might

shero86
2020-03-23 07:06
thank you! :slightly_smiling_face:

grzegorzkrol90
2020-03-23 08:28
has joined #general

aliihlail
2020-03-23 15:36
has joined #general

aliihlail
2020-03-23 15:39
:raising_hand: Roll call! Who else is here?

ankit992
2020-03-23 15:40
I am but should we do that considering it?s a channel with almost 1500 people

matt.fellows
2020-03-23 20:58
Lots of people are Ali - may I ask what you're trying to do?

elliottmurray
2020-03-24 00:34
I?m not here

christian.roepke
2020-03-24 07:45
has joined #general

llin
2020-03-24 18:19
has joined #general

josue.boix
2020-03-24 19:04
has joined #general

mukheem
2020-03-24 19:52
has joined #general

mukheem
2020-03-24 19:53
:raising_hand: Roll call! Who else is here?

mukheem
2020-03-24 20:34
Can someone quickly help me with the difference between PROVIDER_URL and PROVIDER_SETUP_URL

ryan.dens
2020-03-24 21:05
PROVIDER_URL is the base URL that the requests recorded in the pact from the consumer are replayed against. E.g if you had a contract which has a path of `/foo/bar/baz` your pact verification step will replay the request to `$PROVIDER_URL/foo/bar/baz`

ryan.dens
2020-03-24 21:06
`PROVIDER_SETUP_URL` is a way to to tell your provider verification step who to tell about any provider states that might be specified in your pact

ryan.dens
2020-03-24 21:07
here?s a quick run down on provider states: https://docs.pact.io/getting_started/provider_states

matt.fellows
2020-03-24 21:12
@mukheem which language do you use? Best to ask in that channel directly

matt.fellows
2020-03-24 21:12
In many cases now you can get by without this

mukheem
2020-03-24 21:13
yeah @matt.fellows.I should have put that along with my question

mukheem
2020-03-24 21:15
Thanks @ryan.dens and @matt.fellows I am using Python and I really feel very difficult to get the Provider test done. (It's been 2 days I'm working on it yet :|)

mukheem
2020-03-24 21:15
Let me go thru the above document quickly please.

mukheem
2020-03-24 21:48
Hello there !!! Can someone help me with the answers for the below queries please. 1. When we test PACT against Provider, are we gonna play it against a REAL HTTP server or a MOCKED one ? If it is a MOCKED server, then how are we gonna confirm that our PACT is aligned with the latest version ? 2. I found different versions of Provider Testing. I am using PACT in *Python* Language. Per Documentation, I see Django server is being used. But I am not sure if it is the only way to test PACT against Provider. Can someone help with the latest stuff please.

matt.fellows
2020-03-24 21:49
1. Real 2. Django is obviously the server they use in their example, it can be any http server implementation you choose

bethskurrie
2020-03-24 21:49
@mukheem you're the second person to ask about whether the pact is replayed against a mock provider recently. Is there any documentation out there that suggests that it is?

mukheem
2020-03-24 21:56
Not really @bethskurrie. It might be just a mis-interpretation. Because for newbies like me when we go thru the documentation repetitively, first step In the workflow used Mock server so it was flowing in the sub-conscious. That's it



mukheem
2020-03-24 21:59
along with the Github Wiki for Pact- Python

bethskurrie
2020-03-24 21:59
The animation will help. There are links to it from http://docs.pact.io

mukheem
2020-03-24 22:00
Thanks a lot Beth. Let me just check that. It would really help me in getting vivid picture

2020-03-25 04:13
A new post has been created in *Feature Requests*

2020-03-25 05:28
A post in *Feature Requests* has been marked as *in progress*

jwortmann719
2020-03-25 10:50
has joined #general

cesar.lopes
2020-03-25 11:11
has joined #general

cesar.lopes
2020-03-25 11:13
Hello

daljeet.sidhu
2020-03-25 11:33
has joined #general

fimiere
2020-03-25 12:30
has joined #general

ravi.dasari
2020-03-25 21:25
has joined #general

bethskurrie
2020-03-25 22:22
It's only available in Pactflow @sumeshs572, not the open source version.

sumeshs572
2020-03-25 22:23
Oh is it ?

sumeshs572
2020-03-25 22:25
Thanks for confirming it:+1:

aliihlail
2020-03-25 22:51
Hello, is there any recommendations or examples for consumer java code example for asynchronous messages such as RabbitMq

deepakverma
2020-03-26 00:36
has joined #general

deepakverma
2020-03-26 00:46
Hi there getting error while running pact broker with mysql backend ```! Unable to load application: Sequel::DatabaseError: Mysql2::Error: Index column size too large. The maximum column size is 767 bytes. ```

deepakverma
2020-03-26 00:46
Was unable to found anything related in the documentation. is there any recommended parameter to be set of mysql

bethskurrie
2020-03-26 01:23
@deepakverma can you use postgres instead?

bethskurrie
2020-03-26 01:24
Also, best to ask in the #pact-broker channel


deepakverma
2020-03-26 01:25
Hi @bethskurrie thank you. figured out. the collation was wrong as I was using utf8mb4. sure I will ask in that channel.

matt.fellows
2020-03-26 04:43
Yes. That?s the plan

matt.fellows
2020-03-26 04:43
(sorry this was stuck in ?drafts?)

sagupta
2020-03-26 11:58
Hi all, Can someone please tell me what is the format for providing matching in the json sent to the mock service api http://localhost:80/interactions I am providing this JSON and it adds the interactions . Now how can i provide the matching in the request or response properties. { ?request?: { ?method?: ?GET?, ?path?: ?/companies/7xxxx0/roles/7xxxxe? }, ?response?: { ?status?: 200, ?headers?: { ?Content-Type?: ?application/json; charset=utf-8" }, ?body?: { ?name?: ?admin?, ?userId?: ?7xxxxxe? } } }

bernardoguerr
2020-03-26 13:31
The best way would be to generate the interaction from running it with one of the libraries (pact js, etc).

bernardoguerr
2020-03-26 13:31
so you don't have to know the format of the JSON at all

rbenbolton
2020-03-26 15:11
has joined #general

vadim.sacharow
2020-03-26 16:50
has joined #general

bethskurrie
2020-03-26 19:21
Hi Pacters! If you're a QA you is keen to contribute to OSS, I'd love some help with some manual testing. It shouldn't take long. Don't let the devs have all the fun!

rbenbolton
2020-03-26 23:01
Hey everyone, new to this workspace though not new to pact. I just started a new job and pact I think is the main reason I landed it. Working on implementing pact in Go but I?ll be very interested in the #protobufs as my new company heavily uses gRPC.

matt.fellows
2020-03-26 23:04
I thought I recognised the face - hello again!

matt.fellows
2020-03-26 23:05
Amazing that Pact has helped, and thanks for being such an advocate. We?re moving forward and gRPC is now being considered much more closely - we?ll continue the discussion in there

rbenbolton
2020-03-26 23:05
Hey there! You?re probably more familiar with @gbeckmann from Instructure. I was there until just recently, but I?m a big fan hope to be a more active one as well.

matt.fellows
2020-03-26 23:06
I recognise the face as I?m sure we were on a call once, but perhaps you have a familiar face. Yes, Gentry, Matt and Robert L were the main guys

rbenbolton
2020-03-26 23:08
Yep! I didn?t attend as many meetings - I worked in a different product group, but pact was an essential piece to our testing strategy.

sagupta
2020-03-27 00:02
@bernardoguerr true however still have you tried using matching in this json itself or you have an idea on how can i provide it

bernardoguerr
2020-03-27 13:18
Like I said, if you create the interactions programatically, and just make a simple API call to the endpoint you're testing, the JSON contract will be generated. If you don't want to do this always, you can do it just once, and then you will have an idea of what the JSON is supposed to look like. And from then on, you'll know how to do it using the JSON. In essence, it will be something similar to (e.g.): ```"matchingRules": { "$.body": { "min": 1 }, "$.body[*].*": { "match": "type" } }``` which would be included under the appropriate key (in this case the response). Although I don't see why you would do it this more complicated way that requires you to know the much more error prone JSON formatting, as opposed to using a provided API. Remember that there is a lot of different matching options, and they are provided to you through an API (a language binding) for a reason. As far as I know, they haven't documented the underlying JSON structure (although I'm sure you can find it somewhere in the code). Like I said, the easiest way is choosing a language binding and generating the contract from there, even if it's a one time thing. You'll probably waste more time trying to figure out the JSON formatting than just doing it that way

2020-03-29 22:31
A post in *Feature Requests* has been marked as *complete*

kaz.udesh
2020-03-29 23:18
has joined #general

ina.lopez
2020-03-29 23:22
has joined #general

tjones
2020-03-30 00:10
Nice catch!

2020-03-30 05:57
A post in *Feature Requests* has been marked as *closed*

richard.allen
2020-03-30 09:21
has joined #general

godfrey.carnegie
2020-03-30 10:32
has joined #general

davidpihlaja
2020-03-30 19:08
has joined #general

theuiser
2020-03-30 22:32
has joined #general

jinah.adam
2020-03-30 23:21
has joined #general

siddharth.gupta
2020-03-31 12:08
has joined #general

paras.vora1801
2020-04-01 09:08
has joined #general

ina.lopez
2020-04-01 21:14
Has anyone gotten this issue before: _`INFO: pact-node@10.8.0/42995 on ina: Checking if it it possible to deploy`_ _`INFO: pact-node@10.8.0/42995 on ina: Asking broker at http://localhost:80 if it is possible to deploy`_ _`WARN: pact-node@10.8.0/42995 on ina: Pact exited with code 1.`_ _`ERROR: pact-node@10.8.0/42995 on ina:`_ _`can-i-deploy produced non-json output:`_ _`No value provided for required options '--pacticipant'`_ ```./src/test/pact/candeploy.js var pact = require('@pact-foundation/pact-node'); let opts = { retryWhileUnknown: 3, retryInterval: 5, pacticipants: ["a-consumer", "b-provider"], versions: [process.argv[2]], pactBroker: 'http://localhost:80', to: process.argv[3] }; pact.canDeploy(opts).then(function (result) { console.log("success " + result) done() }) .catch(function(error) { console.log("failure " + error) done() });``` ```./package.json "scripts": { "build": "webpack --config webpack.prod.js", "lint": "eslint --ext=.js,.jsx src/", "start": "webpack-dev-server --config webpack.dev.js", "test": "jest", "test:pact": "cross-env CI=true react-scripts test --runInBand --setupFiles ./src/test/pact/setup.js --setupFilesAfterEnv ./src/test/pact/jest-wrapper.js --testMatch \"**/*.test.pact.js\"", "publish:pact": "node ./src/test/pact/publish.js", "candeploy:pact": "node ./src/test/pact/candeploy.js" }, ...``` `~ npm run candeploy:pact -- feature-123 dev`

matt.fellows
2020-04-01 22:18
Hi @inaki.varebeke, the ?pacticipants? property is not actually an arary of strings, but an array of ?selectors?. Nevermind the specifics of what that is just now, but see https://github.com/pact-foundation/pact-node/blob/master/src/can-deploy.spec.ts#L55 for an example input

matt.fellows
2020-04-01 22:24
I?ve just fixed the docs on the `pact-node` website, because they were broken - my apologies

lbraymusso
2020-04-02 05:32
has joined #general

sacharya_pact
2020-04-02 05:36
has joined #general

adadache
2020-04-02 08:25
Is there any way to use the `pact-provider-verifier` with multiple outputs? I want to have a .xml output in RspecJunitFormatter to `/tmp/reports/pactReport`, but also want to keep stdout for CI/CD. The above results in using the `-f` and `-o`, where `-o` disabled stdout.

tjones
2020-04-02 08:26
I don?t believe this is currently supported, but would be a reasonable feature request

bethskurrie
2020-04-02 08:28
Tim is right. It's not currently supported, but it could be.

bethskurrie
2020-04-02 08:28
Raise an issue in the Pact provider verifier repository

bethskurrie
2020-04-02 08:30
@matt.fellows is it called pacticipants?

bethskurrie
2020-04-02 08:32
Could it be renamed pacticipant versions?

matt.fellows
2020-04-02 08:33
Yes and yes. I'll mark that enhancement after feeding time at the zoo is complete

ryanlevell
2020-04-02 12:53
has joined #general

adadache
2020-04-02 14:40
I?ll. In the meantime, I am executing it twice, as I have an option to disable publishing verification results. :confused: :smile: So I can get both output?

christopher.richard
2020-04-02 15:01
has joined #general

christopher.richard
2020-04-02 17:21
:wave: ~Hi everyone/anyone! I'm working on a POC of PACT and have hit my first really blocking snag so far with the pact-verifier CLI in pact-python. Anyone at all familiar with that who might be able to answer some questions?~

christopher.richard
2020-04-02 17:47
Heading to the python channel!

ina.lopez
2020-04-02 23:25
While running Broker and Jenkins in docker container, has anyone come across below error: ```console.error node_modules/jest-jasmine2/build/jasmine/Env.js:290 Error: listen EADDRNOTAVAIL: address not available 172.17.0.1:8099 Error: connect ECONNREFUSED``` Here is my setup.js ```const path = require('path'); const Pact = require('@pact-foundation/pact').Pact; global.port = 8099; global.provider = new Pact({ cors: true, port: global.port, log: path.resolve(process.cwd(), 'pacts/logs', 'pact.log'), loglevel: 'debug', dir: path.resolve(process.cwd(), 'pacts'), spec: 2, pactfileWriteMode: 'update', consumer: 'b-consumer', provider: 'a-provider', host: '172.17.0.1' }); For host, I tired: localhost, 127.0.0.1, 172.17.0.1, 192.168.99.1```

bethskurrie
2020-04-02 23:26
Best to ask in the #pact-broker channel @ina.lopez

matt.fellows
2020-04-02 23:27
that looks like an issue unrelated to the broker

bethskurrie
2020-04-02 23:27
Agreed. I think your docker set up is not right.

matt.fellows
2020-04-02 23:27
You?re setting the port to `8099` and when the test framework starts up, it?s trying to start a service on that port

matt.fellows
2020-04-02 23:27
If the port is not available, you will get that error

matt.fellows
2020-04-02 23:28
It could be unavailable because of a parallel process using the same port, because something didn?t shut down correctly etc.

ina.lopez
2020-04-02 23:28
I did a grep -w '8099/tcp' /etc/services and nothing was using it.

ina.lopez
2020-04-02 23:28
did I forget to mention I tried many ports

matt.fellows
2020-04-02 23:29
My suggestion is to leave host blank, and leave port blank. Pact JS will try to find an available port, and return what port it found in when `setup()` ends

matt.fellows
2020-04-02 23:29
You can then use that to configure your http client

matt.fellows
2020-04-02 23:29
> did I forget to mention I tried many ports maybe! :slightly_smiling_face: (or I missed it)

ina.lopez
2020-04-02 23:30
but I am using this global.port in my actual test

matt.fellows
2020-04-02 23:30
It certainly looks like an issue in your environment though. Perhaps you don?t have permission to bind ports?

matt.fellows
2020-04-02 23:31
so can you not do something like this (pseudo js): ```const provider =new Pact(?) before(() => { provider.setup().then(config => { global.port = config.port }) }) ```

matt.fellows
2020-04-02 23:31
Hardcoding the port is basically never going to be a good thing, because of the chances of port conflicts. If you do run Docker with a private network per container, then you might be OK

ina.lopez
2020-04-02 23:32
let me try. Good advise

ina.lopez
2020-04-02 23:40
Well, with that fix, at least it is not complaining about connection refused :slightly_smiling_face: But it does spin forever...

matt.fellows
2020-04-02 23:40
Did the setup promise return or reject?

matt.fellows
2020-04-02 23:41
ok, ignoring pact for a moment, are you able to start a service within that docker container or a port of your choosing?

matt.fellows
2020-04-02 23:41
e.g. something like `python -m http.server 8099` should do it (python 3)

matt.fellows
2020-04-02 23:41
`python -m SimpleHTTPServer 8099` for Python 2

matt.fellows
2020-04-02 23:42
of course there are other linux tools e.g. `nc -l 8099`

ina.lopez
2020-04-02 23:42
returns `Serving HTTP on 0.0.0.0 port 8099 ..`

matt.fellows
2020-04-02 23:43
have you tried `0.0.0.0` as the listen port for Pact?

matt.fellows
2020-04-02 23:43
maybe you can only bind to public address?

ina.lopez
2020-04-02 23:43
I have not tried 0.0.0.0

matt.fellows
2020-04-02 23:44
it might be Pact trying to check if an ipv6 port is available

ina.lopez
2020-04-02 23:45
perhaps

ina.lopez
2020-04-02 23:53
Oh man, I tried just about everything... I ran out of options. Maybe I should start drinking :slightly_smiling_face: It is 5o'clock here in SF :slightly_smiling_face:

matt.fellows
2020-04-02 23:58
My suburb just lost power. ETA is 6pm (7 hours away). I have 3 workshops today that I'm either attending/running... I might have to join you

matt.fellows
2020-04-02 23:58
Chat later I'm sorry. Heading into first one

ina.lopez
2020-04-03 00:01
ok

mukheem
2020-04-03 06:07
Is it feasible to implement PACT for those Interactions where the request and response are not in JSON but are XMLs ?

matt.fellows
2020-04-03 07:02
In Rust yes, in JS sort of (we just released a beta for testing), and in JVM it?s a sort of also

matt.fellows
2020-04-03 07:02
coming soon, but help wanted is the best answer I can give

mukheem
2020-04-03 07:09
Okay thanks @matt.fellows.

mukheem
2020-04-03 07:10
Help wanted ?? How ca nwe helpyou @matt.fellows

matt.fellows
2020-04-03 07:10
which language - assuming Python?

mukheem
2020-04-03 07:10
Yes, It's Python :slightly_smiling_face:

matt.fellows
2020-04-03 07:10
see https://github.com/pact-foundation/pact-reference/ - that?s where the underlying engine that does it all will have it

matt.fellows
2020-04-03 07:11
Sorry, I also lost power at that moment. Let me know how you go. You might need to hack the `net.js` file to find a combination that works

mukheem
2020-04-03 07:11
Let me check it.

bethskurrie
2020-04-03 07:31
Haha, sneaky work around!

2020-04-03 07:44
A new post has been created in *Feature Requests*

2020-04-03 07:48
A post in *Feature Requests* has been marked as *complete*

2020-04-03 07:48
A post in *Feature Requests* has been marked as *complete*

2020-04-03 07:51
A post in *Feature Requests* has been marked as *in progress*

2020-04-03 07:52
A post in *Feature Requests* has been marked as *in progress*

2020-04-03 07:53
A post in *Feature Requests* has been marked as *in progress*

2020-04-03 07:53
A post in *Feature Requests* has been marked as *complete*

bethskurrie
2020-04-03 07:56
Did you end up using the pact-provider-verifier or pact-js @adadache?

bethskurrie
2020-04-03 07:56
@tjones the way rspec handles mutlile output files is `--format format1 --out out --format format2 --out out2`

bethskurrie
2020-04-03 07:56
How much would pact-js blow up if we tried to support that?

adadache
2020-04-03 08:02
@bethskurrie pact-provider-verifier using cli. :slightly_smiling_face: Actually using pac-cli docker.

adadache
2020-04-03 08:03
The best and only solution I use is the latter? no environment setup (at least any other thank docker)

adadache
2020-04-03 08:03
We are shooting containers in DinD CI/CD pipelines.

adadache
2020-04-03 08:04
Docker in Docker made us invincible with Pact.

bethskurrie
2020-04-03 09:06
cool, I can support multiple outputs very easily then.

s1apped
2020-04-03 12:22
Hi. I have a question about best practice to handle below scenario: Endpoint returns response object with multiple properties and nested objects. Some of the nested objects have different implementation and can return additional properties. What is the best approach when creating contract? Create multiple contracts with state for each of the implementation?

mrudzki
2020-04-03 14:36
has joined #general

bwoodhouse322
2020-04-03 15:23
has joined #general

ina.lopez
2020-04-03 18:49
The problem was the docker image. I downloaded stand-alone Jenkins. I did leave Broker in docker image since it was also configuring PostGRES db for me. Man, I tell you California wine is the best. I found me an amazing Cabernet and after 2 glasses, everything started making sense :)

ina.lopez
2020-04-03 18:51
Is there a way to delete a Webhook created in Pact Broker, without deleting Pacticipant?

cesar.lopes
2020-04-03 19:20
Hello, imagine a scenario were we need to mock two distinct services in the same a test, how should we use pact for that?

ina.lopez
2020-04-03 19:22
found documentation :slightly_smiling_face: DELETE against your webhook URL. i.e. in postman: ```DELETE http://localhost/webhooks/TzQoXESDkN7g-YMOdIX4SQ```

bernardoguerr
2020-04-03 20:24
Good question! The way I've done it is that normally per scenario I test one single integration. If your service depends on more than one, I usually just mock the other service to give the happy path success response with any mocking tool (e.g. nock in JS). This allows me to generate a contract for that single integration, and just test the different variations for that integration. Then I do the same with the other integration. Use Pact Mock Server for the integration I'm trying to test at that time, and use any mocking tool for the other, assuming it gives the happy path response

cesar.lopes
2020-04-03 20:38
ok, that should do it, ty

matt.fellows
2020-04-03 22:15
That?s great to hear!

matt.fellows
2020-04-03 22:16
I was in SF in late 2018 (during the Camp fire :disappointed: ) but did make it to Napa. The wine was lovely, although I?m usually a Shiraz kind of guy :wink:

matt.fellows
2020-04-03 22:24
yep - every resource in Pactflow would work as you might expect.

matt.fellows
2020-04-03 22:24

matt.fellows
2020-04-03 22:25
There is an article for this somewhere on the docs site too

tjones
2020-04-04 05:49
@bethskurrie I don?t think pact-node supports multiple outputs at the moment, but it would be an easy change

cesar.lopes
2020-04-04 12:03
hello, can?t find anything about that

bernardoguerr
2020-04-04 12:38
Btw @matt.fellows it would probably be interesting to make this mocking capability part of the Pact libraries itself. I think it would keep the whole test within the Pact ecosystem, instead of needing another external library. I mean, your mock server already does this, it's just that in this case you just want to create a very simplified interaction that doesn't generate a contract. Either that or some sort of "depends on" concept whereby an interaction may depend on another being there WDYT?

cesar.lopes
2020-04-04 13:52
that would be great

ina.lopez
2020-04-05 01:27
My Pact Broker is on Docker image, accessible on localhost:80. My Jenkins is running independently on my mac, accessible on localhost:8080. I was able to call my Jenkins job using Postman with `Jenkins-Crumb` and `Authorization` headers. Now, I am trying to make Pact Broker webhook call my Jenkins job, but it's throwing error: ``` Error executing webhook fGe8FbvT-IF2IJt35nfZxg Errno::EADDRNOTAVAIL - Failed to open TCP connection to localhost:8080 (Cannot assign requested address - connect(2) for "localhost" port 8080``` Anyone have any idea why this is happening?

bethskurrie
2020-04-05 01:28
Please ask questions related to the pact broker in the #pact-broker channel.

bethskurrie
2020-04-05 01:28
This is a docker issue.

bethskurrie
2020-04-05 01:29
Are you using docker-compose?

ina.lopez
2020-04-05 01:29
yes

bethskurrie
2020-04-05 01:29
You need to give the webhook the service name of the jenkins service

bethskurrie
2020-04-05 01:30
the pact broker is trying to connect to its own localhost

bethskurrie
2020-04-05 01:30
from within the pact broker container, it needs to access the jenkins container via the jenkins container's host name.

bethskurrie
2020-04-05 01:31
you'll need a ```depends_on: - jenkins```

bethskurrie
2020-04-05 01:31
in your definition of your broker

bethskurrie
2020-04-05 01:31
and vice versa, so the the broker can connect to jenkins.

bethskurrie
2020-04-05 01:32
Not sure how it works when each container depends on the other :thinking_face:

ina.lopez
2020-04-05 01:35
I am not sure how to define jenkins in the this file, since jenkins is not part of that container...

ina.lopez
2020-04-05 01:36
I am so new to all of this :neutral_face:

ina.lopez
2020-04-05 02:32
jenkins is not running in a container. I have it running by iteslf on port localhost:8080

matt.fellows
2020-04-05 03:16
OK, so localhost _within_ a container is not the same as localhost _outside_ of a container

matt.fellows
2020-04-05 03:17
i.e. if the host?s localhost is `127.0.0.1` and the docker container is not sharing the same network space (and that is highly likely, and recommended - especially in CI) then `localhost` from within a container is not talking to the same thing

matt.fellows
2020-04-05 03:18
You would need to either a) ensure the same network space is used (e.g. bridged networking mode) or b) pass in to the broker container dynamically, the actual IP address it can be reached on

matt.fellows
2020-04-05 03:19
is this just for local testing? Or your actual CI setup?

bethskurrie
2020-04-05 03:44
@ina.lopez if you'd like to see a working CI/CD set up with a consumer and provider, I've just made a demo here https://github.com/pactflow/example-consumer


bethskurrie
2020-04-05 03:45
Having proper host names makes it a bit simpler.

bethskurrie
2020-04-05 03:46
You can fork the repos, grab a free broker from http://pactflow.io and update the environment variables to point to your own broker.

bethskurrie
2020-04-05 03:47
You'll just need to replace the username and password env vars with PACT_BROKER_TOKEN as the new pactflow accounts use bearer tokens, not basic auth.

mcruzdrake
2020-04-05 16:29
has joined #general

cesar.lopes
2020-04-05 22:24
```Hello, I want to test the same request path with different queries, for example abc-com?a=1&b=2 and hhttp://abc.com?a=3&b=4 abc-com?a=1&b=2 and hhttp://abc.com?a=3&b=4 I can see both contracts on json file, but when I run the tests the second test will use the first contract.```


bethskurrie
2020-04-05 22:27
Which language @cesar.lopes?

cesar.lopes
2020-04-05 22:28
typescript

bethskurrie
2020-04-05 22:28
I mean which pact implementation - sounds like pact-js

cesar.lopes
2020-04-05 22:28
yep

bethskurrie
2020-04-05 22:28
are you testing both interactions at the same time?

bethskurrie
2020-04-05 22:28
ie. are they in separate tests, or the same one?

cesar.lopes
2020-04-05 22:29
same file but in separated describe/interactions

bethskurrie
2020-04-05 22:29
they should be in completely separate contexts then.

bethskurrie
2020-04-05 22:30
when you say, the second uses the first contract, do you mean the response for the second request is the one you defined in the first interaction?

cesar.lopes
2020-04-05 22:30
yes

matt.fellows
2020-04-05 22:31
Can you please share your code setup?

bethskurrie
2020-04-05 22:31
can you give us a working example that demonstrates the issue please? You can fork pact-js and modify one of the examples in the example directory.

cesar.lopes
2020-04-05 22:31
Ok, I?ll ty

cesar.lopes
2020-04-05 22:59
Amazing news, this is a problem on the software not at the testing tool :slightly_smiling_face: so much winning

matt.fellows
2020-04-05 22:59
:slightly_smiling_face:

cesar.lopes
2020-04-05 22:59
ty

matt.fellows
2020-04-05 22:59
np

cesar.lopes
2020-04-05 23:00
should we use pact for unit tests? I questing this because on the most cases we will need to mock function as well?

abubics
2020-04-05 23:42
It's really a unit-testing framework for network boundaries, so *I* would say yes ;)

cesar.lopes
2020-04-05 23:43
:+1:

matt.fellows
2020-04-05 23:43
What Andras said


bethskurrie
2020-04-05 23:43
^^ Got some guides on that @cesar.lopes

matt.fellows
2020-04-05 23:44
You can probably get into splitting heirs about what is/isn?t a unit test, but it?s not very helpful. In the end, we find it best tested alongside other unit tests

cesar.lopes
2020-04-05 23:58
ty all

ric.yik
2020-04-06 06:52
has joined #general

martin.nilsson
2020-04-06 13:09
has joined #general

paras.vora1801
2020-04-06 16:36
Hello, I am trying to write a consumer side test, please see the code below: ```package com.inq.ceapi.contract.test; import http://au.com.dius.pact.consumer.dsl.PactDslJsonBody; import http://au.com.dius.pact.consumer.dsl.PactDslWithProvider; import http://au.com.dius.pact.consumer.junit.PactHttpsProviderRule; import http://au.com.dius.pact.consumer.junit.PactVerification; import http://au.com.dius.pact.core.model.PactSpecVersion; import http://au.com.dius.pact.core.model.RequestResponsePact; import http://au.com.dius.pact.core.model.annotations.Pact; import org.apache.commons.collections.map.HashedMap; import org.apache.http.HttpResponse; import org.apache.http.client.fluent.Request; import org.apache.http.util.EntityUtils; import org.json.JSONException; import org.json.JSONObject; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.junit4.SpringRunner; import static org.junit.Assert.assertThat; import static http://org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.equalTo; import http://java.io.IOException; import java.util.Map; @RunWith(SpringRunner.class) public class ConsumerTests { @Rule public PactHttpsProviderRule auth_server = new PactHttpsProviderRule("auth_server", "localhost", 10443, true, PactSpecVersion.V3, this); static String END_POINT_AUTH = "/oauth-server/oauth/token"; @Pact(consumer = "ceapi", provider = "auth_server") public RequestResponsePact createPactToFetchAuthToken(PactDslWithProvider builder) { Map<String, String> requestHeaders = new HashedMap(); requestHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); requestHeaders.put( "Authorization","Basic Y2VhcGlDbGllbnRJZDpjZWFwaUNsaWVudFNlY3JldA=="); Map<String, String> responseHeaders = new HashedMap(); responseHeaders.put("Content-Type", "application/json;charset=utf-8"); return builder .given("A valid authorization token is returned") .uponReceiving("A request to fetch the authorization token") .method("POST") .headers(requestHeaders) .path(END_POINT_AUTH) .body(new PactDslJsonBody() .stringType("client_id", "ceapiClientId") .stringType( "grant_type","client_credentials")) .willRespondWith() .status(200) .headers(responseHeaders) .body(new PactDslJsonBody() .stringType("access_token", "access_token") .stringValue("token_type", "Bearer") .integerType("expires_in", 60) .stringType("scope", "read write") .stringType("jti","a5fa8e08-9790-430b-81e3-509e8653656a") .array("sites") .closeArray()) .toPact(); } public JSONObject buildResponseObject(String authServerBaseUrl) throws IOException, JSONException { HttpResponse response = http://Request.Post(authServerBaseUrl + END_POINT_AUTH) .addHeader("Content-Type", "application/json;charset=utf-8") .execute().returnResponse(); assertThat(response.getStatusLine().getStatusCode(), is(equalTo(200))); JSONObject jsonObject = new JSONObject(EntityUtils.toString(response.getEntity())); return jsonObject; } @Test @PactVerification(value = "auth_server", fragment = "createPactToFetchAuthToken") public void getAuthToken() throws IOException, JSONException{ JSONObject responseJson = buildResponseObject(auth_server.getUrl()); } }```

paras.vora1801
2020-04-06 16:36
Somehow, the mock provider server is unable to initiate, `io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Can't assign requested address` `at io.netty.channel.unix.Errors.newIOException(Errors.java:122)` `at io.netty.channel.unix.Socket.bind(Socket.java:287)` `at io.netty.channel.kqueue.AbstractKQueueChannel.doBind(AbstractKQueueChannel.java:688)` `at io.netty.channel.kqueue.KQueueServerSocketChannel.doBind(KQueueServerSocketChannel.java:61)` `at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:558)` `at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1358)` `at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501)` `at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486)` `at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:1019)` `at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:254)` `at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:366)` `at io.netty.util.concurrent.AbstractEventExecutor.safeExecute$$$capture(AbstractEventExecutor.java:163)` `at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java)` `at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)` `at io.netty.channel.kqueue.KQueueEventLoop.run(KQueueEventLoop.java:276)` `at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)` `at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)` `at java.lang.Thread.run(Thread.java:821)` Can anyone help here please?

kyle.hammond
2020-04-06 17:52
Probably the #pact-jvm-help channel would be a better place for this question.

matt.fellows
2020-04-06 22:11
Have you checked to see if the port is already in use? That would be the obvious one

matt.fellows
2020-04-06 22:11
Either that, or you?re unable to start a port (privileges)


tjones
2020-04-07 00:50
I haven?t!

matt.fellows
2020-04-07 00:50
I noticed that Pact JS is included in the microservices template, so that?s pretty cool


tjones
2020-04-07 00:57
Yeah, the sequence diagram there reads like Pact JS

tjones
2020-04-07 00:57
I tried to make a generic sequence diagram while writing the intro docs, but each framework is so different

matt.fellows
2020-04-07 00:59
yeah, that?s the strength and weakness of Pact I think. It can be made to fit into all scenarios, but because of that, it?s less instructive.

matt.fellows
2020-04-07 00:59
Pact JVM has the opposite problem - so many options, it?s hard to get to the right one, even though they pretty much all exist

tjones
2020-04-07 01:01
I mean, Pact JS has opinions about how to structure your code (as in, you?re going to have a bad time if you?re spreading your API calls around rather than abstracting them in a module). I just happen to strongly agree with Pact-JS.

tjones
2020-04-07 01:01
I?ve been thinking we should make a documentation page about that.


tjones
2020-04-07 01:02
It?s less relevant to JVM land, but for some reason JS has a culture of putting the whole API call where you need the data, maybe because it?s usually one line and a callback

tjones
2020-04-07 01:03
I?ve seen things like: ```const someData = await api(endpoints.someWhere, api.headers);```

matt.fellows
2020-04-07 01:15
sorry in a meeting

matt.fellows
2020-04-07 01:15
yes, I see that a lot also

matt.fellows
2020-04-07 01:15
It doesn?t often need to be marshalled/unmarshalled to DTOs and all of that stuff

paras.vora1801
2020-04-07 03:00
@matt.fellows I am unable to use any of the port, tried changing the numbers, no luck.

matt.fellows
2020-04-07 04:04
Just so I?m clear. Are you able to run _anything_ on any port? Independent of Pact, that is

matt.fellows
2020-04-07 04:05
For exampe, if on linux, you could do `nc -l 8080` to check if port `8080` is available. If you can?t run a command like this, you may not be able to open ports. Are you running in Docker? or your machine? What?s the OS? Can you please find a way for us to reproduce the problem?

enash
2020-04-07 05:52
has joined #general

paras.vora1801
2020-04-07 06:20
@matt.fellows Somehow the binding error has been resolved however, I am facing an `500 Internal Server Error` while executing the code: ```return InsecureHttpsRequest.httpsPost(url + encodePath(path)) .addHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") .addHeader("Authorization","Basic Y2VhcGlDbGllbnRJZDpjZWFwaUNsaWVudFNlY3JldA==") /*.bodyForm(new BasicNameValuePair("grant_type", "client_credentials")) .bodyForm(new BasicNameValuePair("client_id", "ceapiClientId"))*/ .bodyForm(new BasicNameValuePair("grant_type", "client_credentials"), new BasicNameValuePair("client_id", "ceapiClientId")) .execute().returnResponse();```


paras.vora1801
2020-04-07 06:22
@matt.fellows It is unable to connect to the provider server

matt.fellows
2020-04-07 06:32
should it be https?

matt.fellows
2020-04-07 06:32
How did you resolve the other problem? That feedback would be nice for others just in case they have the same issue

paras.vora1801
2020-04-07 06:34
Yes, the provider service is hosted under https protocol

matt.fellows
2020-04-07 06:35
the real one, or the mock one Pact JVM is setting up?

paras.vora1801
2020-04-07 06:35
The mock provider server

matt.fellows
2020-04-07 06:35
ok.

matt.fellows
2020-04-07 06:36
Are there any logs suggesting why there is a 500?

paras.vora1801
2020-04-07 06:36
```InsecureHttpsRequest.httpsPost(url + encodePath(path))``` It is throwing 500 status code right at this line.

paras.vora1801
2020-04-07 06:38
`2020-04-07 11:59:05,038 INFO [o.s.t.c.s.DefaultTestContextBootstrapper] - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.inq.ceapi.contract.test.ConsumerTests], using DelegatingSmartContextLoader` `2020-04-07 11:59:05,045 INFO [o.s.t.c.s.AbstractContextLoader] - Could not detect default resource locations for test class [com.inq.ceapi.contract.test.ConsumerTests]: no resource found for suffixes {-context.xml}.` `2020-04-07 11:59:05,045 INFO [o.s.t.c.s.AnnotationConfigContextLoaderUtils] - Could not detect default configuration classes for test class [com.inq.ceapi.contract.test.ConsumerTests]: ConsumerTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.` `2020-04-07 11:59:05,078 INFO [o.s.t.c.s.DefaultTestContextBootstrapper] - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]` `2020-04-07 11:59:05,095 INFO [o.s.t.c.s.DefaultTestContextBootstrapper] - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@ca18cdee, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@becdcaf0, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@833481f9, org.springframework.test.context.support.DirtiesContextTestExecutionListener@502eed96, org.springframework.test.context.transaction.TransactionalTestExecutionListener@75d79da6, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@b4186aa3, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@bea92b05, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@cee9994f, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@4b7d666, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@3b6f441e, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@8cee8a96, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@996d3600]` `2020-04-07 11:59:05,360 WARN [o.s.b.t.j.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer] - __Found multiple occurrences of org.json.JSONObject on the class path:__ jar:file:/Users/paras.vora/.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class_ file:/Users/paras.vora/n_workspace/rt/commons/commons-json/target/classes/org/json/JSONObject.class_ jar:file:/Users/paras.vora/.m2/repository/org/json/json/20160212/json-20160212.jar!/org/json/JSONObject.class__You may wish to exclude one of them to ensure predictable runtime behaviour_` `2020-04-07 11:59:05,364 INFO [o.s.c.s.GenericApplicationContext] - Refreshing org.springframework.context.support.GenericApplicationContext@526afac0: startup date [Tue Apr 07 11:59:05 IST 2020]; root of context hierarchy` `2020-04-07 11:59:05,869 INFO [Application] - No ktor.deployment.watch patterns specified, automatic reload is not active` `2020-04-07 11:59:05,910 INFO [Application] - Responding at https://localhost:10443` `2020-04-07 11:59:06,858 ERROR [Application] - Unhandled: POST - /oauth-server/oauth/token`

ukrainian1991
2020-04-07 08:50
has joined #general

ukrainian1991
2020-04-07 08:53
Hi! Is there a way to use PACT for microservices with gRPC communication? I see that issue for gRPC support is open. Are there any workarounds?

tjones
2020-04-07 08:54
I haven?t used gRPC, but you might get some mileage out of the message pact support, maybe

matt.fellows
2020-04-07 09:24
See also #protobufs

matt.fellows
2020-04-07 09:25
I know they?re not the same, but it?s basically a proxy for that conversation

ukrainian1991
2020-04-07 09:28
Thanks for info

artur.mkr
2020-04-07 14:51
has joined #general

yuniorbv
2020-04-07 15:55
has joined #general

ina.lopez
2020-04-07 22:47
```it is only safe to deploy the consumer if it was verified against the production version of the provider.*``` https://docs.pact.io/provider so, does this mean that when triggered by broker, Provider CI verify: 1. gets the latest provider prod version from broker (PROD_VERSION=pact-broker describe-version...) 2. checks it out from git, git checkout ${PROD_VERSION} 3. runs provider server locally, verifies and publishes results (PACT_PUBLISHED=${pactPublished} PACT_PUBLISH_RESULTS=true run pact tests)

bethskurrie
2020-04-07 22:48
Yes, that is the way you would do it if necessary.

bethskurrie
2020-04-07 22:48
Most people don't seem to have found it necessary though.

bethskurrie
2020-04-07 22:48
I think if the consumer and provider release cycles are close enough that it doesn't really come up very often.

bethskurrie
2020-04-07 22:51
I'll add an example to the provider codebase when I'm working on it next.

matt.fellows
2020-04-08 00:11
to add to this sentiment, I?ve also never fully reached the Pact nirvana either - but I?ve never experienced an issue where I?ve actually needed that scenario. Not saying it?s not required, but in my experience not having done that has never caused issues

matt.fellows
2020-04-08 00:11
If you?ve gotten this far in the process - you?re doing _very well_

bethskurrie
2020-04-08 00:13
I'd try without it for a while, and only add it in if you find it necessary.

ina.lopez
2020-04-08 01:51
```As you have two different builds running the pact verifications (one when the provider changes, one when the contract changes) it is best to use a provider version number that is deterministic (eg. does not include your CI build number) so that a verification from either job is recorded with the same version number. This will help you when it comes to using the can-i-deploy tool``` Am I understanding this right, or Consumer should use `GIT_HASH` and Provider should use something "deterministic"... something developers change, as in *package.json.version* ?

bethskurrie
2020-04-08 01:52
use the git hash unless there's some reason that makes this impossible.

bethskurrie
2020-04-08 01:52
for both consumer and provider

bethskurrie
2020-04-08 01:54
I'll update the docs to clearly state that the git sha is the best option wherever possible.

matt.fellows
2020-04-08 01:57
I usually go with something like `semver-SHA` e.g. `1.0.0-a12xy8en`

bethskurrie
2020-04-08 01:57
This doc is a good explanation of versioning and version numbers https://docs.pact.io/getting_started/versioning_in_the_pact_broker

siddharth.gupta
2020-04-08 07:41
Hi there , I am beginner with Pact , I have been able to run consumer and provider tests provided at https://github.com/pact-foundation/pact-net. But I have question for the experts , when we test the provider APIs which interacts with an external component for example a SQL db , how do we deal with such scenario when running contract tests on local developer machine . As we do not deploy the services instead use self hosted routing .

2020-04-08 11:14
A post in *Feature Requests* has been marked as *complete*


sridhar_murari
2020-04-08 14:29
has joined #general

anguyen0815
2020-04-08 15:37
has joined #general

anguyen0815
2020-04-08 15:52
Good morning guys, I'm using pactflow for the broker and just wondering how to use WIP feature with pending pacts. I know I can do ``` consumerVersionSelector: [{ tag: "prod", all: true }, { tag: "master", latest: true } ],``` to retrieve all prod pacts and the latest master pact. How do I also make it retrieve WIP/pending pacts?

bethskurrie
2020-04-08 21:08
To turn on the pending, you need to set enablePending: true @anguyen0815

bethskurrie
2020-04-08 21:09
The wip pacts is slightly different. I'm not sure if @matt.fellows has added support for that yet.

bethskurrie
2020-04-08 21:09
You need to give it a date.

bethskurrie
2020-04-08 21:10
I've just checked the code, and it's not supported yet. I'll raise an issue for it.

anguyen0815
2020-04-08 21:13
@bethskurrie thanks for your fast response. do you know when it will be available to use? just an estimate would help a lot.

matt.fellows
2020-04-08 21:42
Which language - JS?

matt.fellows
2020-04-08 21:42
Beth I didn?t realise WIP pacts was a thing already, I?ll get that added to JS/Go today

anguyen0815
2020-04-08 21:48
@matt.fellows I'm using JS

matt.fellows
2020-04-08 21:53
cool, thanks

matt.fellows
2020-04-08 21:53
I?ll try and get that added today

anguyen0815
2020-04-08 22:09
you guys are awesome. thank you!

matt.fellows
2020-04-08 22:10
:+1:

bethskurrie
2020-04-08 22:10
I've created a documentation issue and a matching one in pact js.

eric.jones
2020-04-09 12:11
has joined #general

anguyen0815
2020-04-09 16:11
Hi guys, quick question about pact verifier. Our backend is in Elixir so we can't use Ruby. It looks like there are 2 dockers out there that we can use for verifying pacts https://hub.docker.com/r/pactfoundation/pact-cli and https://hub.docker.com/r/dius/pact-provider-verifier-docker. Which one should I use? It looks like the second one is only about verifying pacts and the first one includes everything.

komeershettyvinod
2020-04-09 16:36
has joined #general

kjtester
2020-04-09 16:47
has joined #general

kjtester
2020-04-09 16:49
:wave: I?m here! What?d I miss?

ina.lopez
2020-04-09 23:12
In the example-provider: https://github.com/pactflow/example-provider/blob/master/product/product.pact.test.js _TRAVIS_BRANCH_ is used as a tag. What I am reading in https://docs.pact.io/pact_nirvana makes me think that we should perhaps tag it differently. What is considered *stable tag*? ```In the provider verification configuration, change the pact that is being verified from the latest pact to the latest pact for the stable tag. This will help keep your provider builds green.```

bethskurrie
2020-04-09 23:15
They're not contradictory, but it seems the set up guide does not explain it clearly enough.

bethskurrie
2020-04-09 23:15
Stable just means "master" - but some teams don't use branch based workflows, so I was trying to use a non-workflow specific term.

bethskurrie
2020-04-09 23:16
That's right.

bethskurrie
2020-04-09 23:17
Use the pact cli, because you'll be able to use it for other parts of the workflow (can I deploy, webhook creation etc)

bethskurrie
2020-04-09 23:18
It's Ruby under the hood, but because it just uses http to do the verifications, it doesn't make a difference which language it's in.

anguyen0815
2020-04-09 23:25
thank you for the info!

faisallarai
2020-04-10 00:26
has joined #general

matt.fellows
2020-04-10 11:58
v9.9.3 should be out soon @anguyen0815 which has the WIP feature

anguyen0815
2020-04-10 13:24
that's so awesome. excited to start using it. thanks guys!!

l.dziedziul
2020-04-10 14:07
has joined #general

david.tran
2020-04-10 16:20
has joined #general

rahulpandey8920
2020-04-12 19:22
has joined #general

rahulpandey8920
2020-04-12 22:10
Hello, Is there any standalone way of generating documentation from a pact json file which looks like the one shown in pact broker ?

bethskurrie
2020-04-12 22:11
The code exists in the Ruby gem

bethskurrie
2020-04-12 22:11
I'll see is it's accessible in the standalone

rahulpandey8920
2020-04-12 22:20
Thanks Beth! That would be helpful.

bethskurrie
2020-04-12 22:24
`pact/bin/pact docs --pact-dir ./pacts --doc-dir docs`

rahulpandey8920
2020-04-12 22:45
Thanks! That works. :slightly_smiling_face: I didn't know that the documentation is created in MarkDown format. Somehow I assumed it to be some sort of HTML.

bethskurrie
2020-04-12 22:47
Oh, yes. The html is actually generated from the markdown.

bethskurrie
2020-04-12 22:49
The markdown came first, before we had the pact broker, and then I took the markdown and used a library to turn it in to html.

rahulpandey8920
2020-04-12 22:51
Yeah, that makes sense. I am not using pact broker yet and was just looking to get a better view of the interactions so thought of generating the report.

bethskurrie
2020-04-12 23:08
When it was written, we were checking pacts in to the repository, so the markdown was in there to, and so it rendered as HTML in the browser.

bonnie.malec
2020-04-13 02:23
has joined #general

christopher.richard
2020-04-13 12:21
This is super cool.

rahulpandey8920
2020-04-13 20:21
@bethskurrie is the library that is used to turn the markdown into html an open source library ?

cody
2020-04-13 20:42
has joined #general

rahulpandey8920
2020-04-13 23:07
Hello :wave: I am trying to find any documentation and practices around how does the provider sets up the state. I've come across this statement from https://docs.pact.io/provider/using_provider_states_effectively > _The provider team sets up the relevant provider state by creating one alligator with the name Mary._ Would this mean creating an alligator in the actual database and running the provider with all its external dependencies ?

rahulpandey8920
2020-04-13 23:08
Or we could stub all the external dependencies of the provider when running the contract tests ?

rahulpandey8920
2020-04-13 23:09
Is there any example of a producer implementing the setting up of the state I could refer to ?

uglyog
2020-04-13 23:10
It's up to the provider team to decide what needs to be done. But the intention of the provider states is to put the provider service in the correct state to return the correct response.

uglyog
2020-04-13 23:11
If there is a database, creating records there can work. So can mocking out the database layer

matt.fellows
2020-04-13 23:12
What language are you using @rahulpandey8920?

matt.fellows
2020-04-13 23:12
Each language should have at least an example of doing that, so I?d suggest going to the language docs for that

rahulpandey8920
2020-04-13 23:26
In my case, the provider is a REST API implemented in C# dotnet. So would it mean creating an endpoint which would take the state as a string and put the provider service in that state ?

matt.fellows
2020-04-13 23:26
yep!


rahulpandey8920
2020-04-13 23:32
Thanks @matt.fellows! I can see that the provider has a middleware which helps in setting up the expected state.

matt.fellows
2020-04-13 23:33
Working late btw :P

matt.fellows
2020-04-13 23:34
I was doing the same about the same time last night :raised_hands:

rahulpandey8920
2020-04-13 23:40
Have lost track of days and time these days :smile:

rahulpandey8920
2020-04-13 23:41
Thanks for your help.

matt.fellows
2020-04-13 23:41
:smile:

derekhu
2020-04-14 01:38
has joined #general

derekhu
2020-04-14 04:23
Is there any way to combine the pact with swagger?

aaron590
2020-04-14 05:55
has joined #general



artur.ashyrov
2020-04-14 18:30
has joined #general

2020-04-15 02:32
A post in *Feature Requests* has been marked as *in progress*

2020-04-15 02:32
A new post has been created in *Feature Requests*

2020-04-15 04:17
A post in *Feature Requests* has been marked as *in progress*

2020-04-15 04:18
A post in *Feature Requests* has been marked as *planned*

2020-04-15 04:20
A new post has been created in *Feature Requests*

2020-04-15 04:24
A post in *Feature Requests* has been marked as *planned*

2020-04-15 08:32
A new post has been created in *Feature Requests*

chandanakurumeti27
2020-04-15 12:24
has joined #general

safiyya
2020-04-15 13:25
Hi all, I?m a beginner with Pact. Perhaps a dumb question but what is the advantage of using contract testing & Pact in a Typescript world? If I were to create a shared Typescript library as a ?schema repository? for all our async messages payloads (similar to a schema registry for messages), what is the benefit of introducing Pact in my testing suite?

l.dziedziul
2020-04-15 13:46
A shared Typescript library can lead to synchronized deployments of all your services, which basically turn them into a distributed monolith. Ownership of the schema would be also problematic. Each change in the schema can potentially break non-related services because you aren?t aware of the parts of the schema it was relying on. You can also have a bit different serialization settings in each service result with different date format in json.


james.salamon
2020-04-15 14:33
has joined #general

travis.anderson
2020-04-15 15:11
Hello everyone :wave: I have been auditing my organization's automated testing strategy and developing a comprehensive strategy moving forward. My plan is to have it heavily build around Pact but it leaves a very small gap https://docs.pact.io/consumer/contract_tests_not_functional_tests#does-the-provider-do-the-right-thing-with-the-request. Does anybody have any examples, theoretical or otherwise, about how they covered this small gap in testing? I am in the JavaScript universe so my idea was to utilize supertest or a similar library then reach into the given database to verify the "side effects." Preferably these tests would be run in a deployed environment too.

d.drinfeld
2020-04-15 16:54
has joined #general

d.drinfeld
2020-04-15 16:57
Hi folks, very new to Pact? Not sure if I missed this in documentation, maybe someone can point me to it. Does provider verification have to run on a live instance of the provider, or can it be run at build time? I am particularly interested in Java side of things.

wesleythomaswilliams
2020-04-15 17:04
The way pact works is it's effectively simulating requests from your consumer (based on the pact file contents). So it doesn't matter where or when you're doing verification on the provider because it's being tested in isolation.

wesleythomaswilliams
2020-04-15 17:05
I'm working on the java side too (with spring)

d.drinfeld
2020-04-15 17:07
So when doing provider verification, are you running that on a live instance of the provider? I.e. do you stand up a provider instance and run against that, or run the provider verification during build time, in a form of junit test? Sorry if I sound completely off, still try to wrap my mind around it.

wesleythomaswilliams
2020-04-15 17:08
It's run at build time as a junit test.

d.drinfeld
2020-04-15 17:08
Okay, that makes sense then. In that case you don?t need to stand up the web server or anything like that to run verification. Its run as part of the unit test, where you can respond to the requests with crafted responses for specific use cases. (With DB and and everything else stubbed out)

d.drinfeld
2020-04-15 17:20
Reading through docs, provider verification still seems to run against a live instance? I.e. ``` @TestTarget public final Target target = new HttpTarget(8080);``` So a server is run at localhost, on port `8080` against which the verification is happening? I am understanding this correctly?

wesleythomaswilliams
2020-04-15 17:26
I guess it depends what you mean by live instance. The service has to be able to respond to the calls being simulated by pact, but you'll likely be mocking out any dependencies. Here's an example with java, junit5 and spring (which may just confuse things further for you): ```@Provider("myProvider") @EnableAutoConfiguration @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = { myProviderSearchControllerV1.class }, properties = { "server.port=1337" }) @PactBroker( host = "${pact.broker.host}", scheme = "https", port = "443", authentication = @PactBrokerAuth(token = "${pact.broker.token}")) public class ProviderPactTest { @LocalServerPort private int port; @MockBean private myProviderWrapperService myProviderWrapperService; @MockBean private ValidationService validationService; @BeforeEach void setupTestTarget(PactVerificationContext context) { context.setTarget(new HttpTestTarget("localhost", port, "/")); }```

wesleythomaswilliams
2020-04-15 17:27
I've left out the tests etc, but that may give an idea

d.drinfeld
2020-04-15 17:30
I think I am beginning to understand, thank you Wes.

wesleythomaswilliams
2020-04-15 17:31
No worries, I still get confused by it.

yka
2020-04-15 18:59
has joined #general

matt.fellows
2020-04-15 23:15
So within your question you can still split apart tests: ? Unit ? Integrat_ion_ (not integrat_ed)_ ? End to End (or integrated)

matt.fellows
2020-04-15 23:15
For Unit, that is obvious, you should have some coverage there

matt.fellows
2020-04-15 23:18
Integration is complicated, because it?s a vague term. It?s going to depend a lot on the types of side effects you need to test. If it?s just data states, then that should be fairly easy to do. There are various layers you can test this at also. Two common approaches are: 1. Component level (e.g. persistance layer, routing layer, domain etc.) 2. Black-box (or ?hermetic server?) style, when you mock out 3rd party dependencies (typically other APIs/systems) and run tests from the outside, and assert behaviour 3. Integrated - where you test with real dependencies (this is the old school mentality and is hard to draw a line) I would highly recommend reading this article that goes into a lot more detail https://martinfowler.com/articles/microservice-testing/

matt.fellows
2020-04-15 23:20
So I think Wes has answered it. But I?ll come from a slightly different angle. You want to think about it a bit like a unit test. A good rule is that it should be able to run on your laptop/desktop without an internet connection (so this would generally preclude it being an externally deployed/hosted provider)

matt.fellows
2020-04-15 23:21
You can point verification at a staging/test environment, but you lose some of the value of contract testing, because you won?t get feedback during development that you?re about to break something. Ideally, you never push up a change that breaks a contract at all

travis.anderson
2020-04-15 23:46
Wow, awesome stuff @matt.fellows thank you for the run down! I'll take a look at this and see what kind of strategy I can put together. I appreciate the help!

2020-04-16 00:18
A new post has been created in *Feature Requests*

matt.fellows
2020-04-16 02:25
Next week, @uglyog @beth (http://Pactflow.io) (http://Pactflow.io) and I will be presenting a lunch and learn session at Pactflow?s parent company (DiUS) on ?Lessons learned whilst building a SaaS business?. If you?re interested in hearing a bit about our journey, we?d love for you to join us. We?ll cover a bit about our origins, the challenges of balancing OSS and commercial interests and talk about the mistakes we?ve made along the way. The event starts at 12:30 AEST on Tuesday 21st April: * 22:30 EDT (Monday evening) * 19:30 PDT (Monday evening) * 04:30 CEST (sorry :disappointed: !) Sign up here https://docs.google.com/forms/d/e/1FAIpQLSfBb7UBVoIfW4ioOyiWTG2ha0zhOpsV5Xs_ie3py-znWYdXUw/viewform

tjones
2020-04-16 02:26
Signed up! Is lunch provided?

tjones
2020-04-16 02:26
(I?m kidding, of course)

tjones
2020-04-16 02:26
Well, not about signing up. I definitely did that.

matt.fellows
2020-04-16 02:27
Virtual lunch. We?ll share food emjoi

pbarrientos
2020-04-16 02:27
:broken_heart:

matt.fellows
2020-04-16 02:31
:smile:

mkairys
2020-04-16 08:06
has joined #general

jan.falek
2020-04-16 13:00
has joined #general

d.drinfeld
2020-04-16 13:53
Yep, thats a good point, was thinking about that today? Thanks Matt!

pavel.azarau
2020-04-16 15:50
Hi. Are you going to share a recording?

komeershettyvinod
2020-04-16 17:43
@matt.fellows hey one quick question on a regular unit test, does junit tests also need a local server to run?

safiyya
2020-04-16 18:04
Thanks @l.dziedziul, very helpful.

giuseppe.salvatore
2020-04-16 18:46
has joined #general

giuseppe.salvatore
2020-04-16 18:49
Hi everyone

giuseppe.salvatore
2020-04-16 19:18
I have been interested in the contract testing and started to look at the pact approach. It's quite interesting... so far I managed to write consumer side testing to generate the pact contracts, publish the contracts to a broker and now I was trying to look at the verification options that are there.

giuseppe.salvatore
2020-04-16 19:19
I am using spring boot with maven project for the provider but I am struggling to find a clear example or some documentation.

giuseppe.salvatore
2020-04-16 19:19
can anybody please help me a bit?

matt.fellows
2020-04-16 21:11
Yes!

matt.fellows
2020-04-16 21:12
I think JVM automatically manages this for you but I'm not 100% sure sorry. It probably depends on other things, like which framework you use (e.g. spring boot)

theuiser
2020-04-16 21:48
Hi, all. I?m looking for good examples for a consumer to generate a Pact contract that is only concerned about types and not values. I?m using the pact-jvm-consumer-java8 jar. Having some challenges using Matchers. I?m looking for a JVM equivalent of the *Matchers*.*somethingLike* method in Pact JS

wesleythomaswilliams
2020-04-16 22:24
We use Java 8, Junit 5, Maven and Spring Boot. Does that fit your profile? If so I can help.

giuseppe.salvatore
2020-04-16 22:53
yeah thanks a lot, I guess I can make it fit

giuseppe.salvatore
2020-04-16 22:54
As far as I have seen around you can either user a maven plugin to perform your verification or you can write provider unit tests

uglyog
2020-04-16 22:54
The `LambdaDslJsonArray` class has an `eachLike` method

giuseppe.salvatore
2020-04-16 23:07
but yeah if you can point me to some example that would greatly appreciated

giuseppe.salvatore
2020-04-16 23:11
at the moment I am taking a look here https://github.com/DiUS/pact-jvm/tree/master/provider

abubics
2020-04-16 23:23
Maybe a little hard to find, but there's https://github.com/DiUS/pact-jvm#service-providers with a list of ways to verify, and links to examples

abubics
2020-04-16 23:26
There's also https://github.com/DiUS/pact-workshop-jvm, that has similar `gradle` instructions, if that helps :slightly_smiling_face: I typically use `gradle`, so I'm not sure what kind of state the other examples are in.

abubics
2020-04-16 23:30
(that's all for JVM, of course, but let us know if you're targeting other platforms)

bethskurrie
2020-04-16 23:42
Looking for a dockerized version of the Travis CLI for a Pact workshop and found `lirantal/travis-cli`. Thanks @liran.tal!

matt.fellows
2020-04-16 23:47
Nice!

bethskurrie
2020-04-16 23:56
Reckon you'd have a chance to update the gem? I keep getting "Outdated CLI version, run `gem install travis`"

wesleythomaswilliams
2020-04-17 07:55
@giuseppe.salvatore We went down the provider unit test path.


giuseppe.salvatore
2020-04-17 08:31
Thanks @wesleythomaswilliams @abubics

giuseppe.salvatore
2020-04-17 08:33
I was looking at the two options: with Maven plugin and within provider with Junit4 (I guess the can-i-deploy is a third option to verify the pact on provider side right?)

wesleythomaswilliams
2020-04-17 08:44
can-i-deploy is more for when you integrate your tests into your pipeline so that changes that break a contract don't get into production.

giuseppe.salvatore
2020-04-17 08:45
:+1:

joao.salles
2020-04-17 09:35
has joined #general

matt.fellows
2020-04-17 10:40
Wes you're a machine - first answer at 8:35am local time, and just now at 6:44pm our local time. :pray:

giuseppe.salvatore
2020-04-17 10:52
I keep getting this error: ```[ERROR] Failures: [ERROR] ContractTest.account-service-api - A request for an existing account that has at least one product returns the data 0 - Expected a response type of 'application/json' but the actual type was 'text/plain' 1 - assert expectedStatus == actualStatus | | | 200 | 400 false 2 - Expected a header 'Content-Type' but was missing``` Which makes me think that the real service is not running... but not sure why, it looks like from the test code perspective a @TestTarget is the only thing that goes up ```@RunWith(SpringRestPactRunner.class) @Provider("product-service-api") @PactBroker(host = "http://my-pact.co.uk", port = "443", scheme = "https", consumers = "account-service-api") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class ContractTest { @TestTarget public final Target target = new SpringBootHttpTarget(); @State("default") public void user1Exists() { // nothing to do, real service is used } }```

wesleythomaswilliams
2020-04-17 11:25
It might not be relevant, but we don't use ```@RunWith(SpringRestPactRunner.class)``` Our annotations ```@Provider("id") @EnableAutoConfiguration @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = { idSearchControllerV1.class }, properties = { "server.port=1337" }) @PactBroker( host = "${pact.broker.host}", scheme = "https", port = "443", authentication = @PactBrokerAuth(token = "${pact.broker.token}"))``` And we use ```@LocalServerPort private int port; @BeforeEach void setupTestTarget(PactVerificationContext context) { context.setTarget(new HttpTestTarget("localhost", port, "/")); }``` Is that helpful?

giuseppe.salvatore
2020-04-17 11:27
I think the last bit might be ok for me as I have SpringBootTest.WebEnvironment.RANDOM_PORT but I will give it a go with the @SpringBootTest annotation as it seems like you provided a rich configuration that I might be missing

giuseppe.salvatore
2020-04-17 11:28
> Is that helpful? I did want to say "Every little helps" ...

wesleythomaswilliams
2020-04-17 11:28
My Spring knowledge comes from our devs, so I'm not massively clued up on it. They just tell me it's magic. :wink:

giuseppe.salvatore
2020-04-17 11:30
I am with you 100%. I am finding that my java knowledge since 6 years ago is quite obsolete and instead of knowing the java language now people want to know how you configure your application with tons of bloody annotations

wesleythomaswilliams
2020-04-17 11:30
You're pretty much exactly in the same boat as me :smile:

giuseppe.salvatore
2020-04-17 11:33
I might have found the problem!

giuseppe.salvatore
2020-04-17 11:33
Verifying now :computer:

giuseppe.salvatore
2020-04-17 11:47
The power of black magic!!! So I am going to share this with you because I think it's a good one. Basically the short version is: there were 2 problems with the consumer side pact that didn't match what the provider was exposing 1. the provider wanted a correlationId into the header and 2. it was returning an arrays of products not only one

giuseppe.salvatore
2020-04-17 11:48
but as the consumer in his tests wasn't giving the header param the provider was failing the check with a 400 (bad request)

giuseppe.salvatore
2020-04-17 11:48
(which in fairness is another test I could add)

giuseppe.salvatore
2020-04-17 11:49
I find all of this very nice and although I am new to all of this (I was testing GPU driver stuff in C++ only 8 months ago) I think the progress I am making thanks to community and people like you is amazing

giuseppe.salvatore
2020-04-17 11:50
So thanks everyone for the support, really, really appreciated :pray:

matt.fellows
2020-04-17 13:49
That sounds like good progress to me! You've worked out how the tool works, found a potential bug and had a chat with another team :clap:

anguyen0815
2020-04-17 15:37
Hi guys, I posted this in pact-ruby channel 2 days ago. just trying again here. any suggestion/recommendation is appreciated! ```Hi guys, I have been trying to write consumer tests for a file upload api and it has to do with image/binary files. I couldn't get it to work so far and it looks like the mock service couldn't handle the binary file. I saw that there is this ticket https://github.com/pact-foundation/pact-mock_service/issues/32. Is that issue still applicable? If so, do you guys have any recommendations as far as testing image upload goes?```

darshan
2020-04-17 15:51
has joined #general

paolaagudelo10
2020-04-17 16:27
Hi everyone, someone can help me with this problem? The broker is already up because the test are verified, but when try to publish the verification result to the broker, the result the following message appears pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.2/lib/pact/provider/verification_results/publish.rb:103:in `publish_verification_results': Error returned from verification results publication 500 {"error"=>{"message"=>"An error has occurred. The details have been logged with the reference agMzWQbfmU", "reference"=>"agMzWQbfmU"}} (Pact::Provider::VerificationResults::PublicationError) i am using "PactNet.Linux.x64" Version="2.5.3" in a jenkins pipeline

giuseppe.salvatore
2020-04-17 18:27
.

giuseppe.salvatore
2020-04-17 18:27
How do you publish the result?

paolaagudelo10
2020-04-17 18:50
@giuseppe.salvatore the PactNet library contains the publish to broker property

giuseppe.salvatore
2020-04-17 20:09
something like this?

giuseppe.salvatore
2020-04-17 20:10
```var pactPublisher = new PactPublisher("http://test.pact.dius.com.au", new PactUriOptions("username", "password")); pactPublisher.PublishToBroker( "..\\..\\..\\Samples\\EventApi\\Consumer.Tests\\pacts\\event_api_consumer-event_api.json", "1.0.2", new [] { "master" });```

theuiser
2020-04-17 20:18
Thanks, @uglyog. I?ll take a look.

paolaagudelo10
2020-04-17 20:46
@giuseppe.salvatore

paolaagudelo10
2020-04-17 20:49
and that configuration is used in the test like this :

paolaagudelo10
2020-04-17 20:49
IPactVerifier pactVerifier = new PactVerifier(config); pactVerifier .ProviderState($"{uri}/provider-states") .ServiceProvider("provider", ServiceUri) .HonoursPactWith("consumer") .PactUri(URL) .Verify();

marzieh312
2020-04-18 08:17
has joined #general

gunjan.arora
2020-04-18 23:14
has joined #general

jayeshdalal7
2020-04-19 12:25
has joined #general


matt.fellows
2020-04-19 21:19
I think there is an issue on the JS repo also that might have some tips too

bethskurrie
2020-04-19 22:33
@paolaagudelo10 are the details you've pasted the actual details you're getting the error for?

bethskurrie
2020-04-19 22:33
I can't see that error reference in the logs for Pactflow anywhere.

bethskurrie
2020-04-19 22:33
Also, the application doesn't run on http - it's https.

eduardopceleste
2020-04-20 04:15
has joined #general

dsmith
2020-04-20 11:43
has joined #general

dsmith
2020-04-20 11:47
Good Day All, I have just started out using Pact. Working on a Kotlin project . I've created a pact file by creating the consumer test. I am now at the provider end of the solution. I require a custom header to be send when making the request in the Provider Test. Has anyone got this right in Kotlin? I looked at PactVerificationContext and found it only has host, port, path .. no headers.

matt.fellows
2020-04-20 11:48
Are you using gradle?

dsmith
2020-04-20 11:48
```@BeforeEach fun before(context: PactVerificationContext) { context.target = HttpsTestTarget( host = "http://dummy-host.com", port = 443, path = "/dummy-path") }```

dsmith
2020-04-20 11:48
i am yes


chris.spencer
2020-04-20 12:30
has joined #general

dsmith
2020-04-20 13:00
Thank you! I'll give it a shot and let you know

dsmith
2020-04-20 13:17
Schweet! Works like a charm, thanks again :slightly_smiling_face:

paolaagudelo10
2020-04-20 14:02
@bethskurrie yes bet that is the log that I am getting in the Jenkins output

matt.fellows
2020-04-20 14:08
:raised_hands:

bethskurrie
2020-04-20 20:02
First thing change the http to https @paolaagudelo10

bethskurrie
2020-04-20 20:04
Can you send another of the error references and I'll see if I can find it in the logs.

paolaagudelo10
2020-04-20 22:10
@bethskurrie Do you refer that my provider should be with https ? Why? I was looking in the documentation and all the examples have the providerURL with HTTP, however, if you refer to the broker URL I already have them with https .. btw thanks for your helping I really appreciate it

bethskurrie
2020-04-20 22:14
Http or https just depends on how the broker is deployed. You can't use http if it's only running https (which most servers should these days). The examples just assume you know how your broker is running.

bethskurrie
2020-04-20 22:16
@paolaagudelo10 could you try publishing again so I can have a look at the logs?

paolaagudelo10
2020-04-20 22:36
@bethskurrie I have deployed again and now I am not having the problem without any changes :confused:

bethskurrie
2020-04-20 22:55
Well, that's annoying and good at the same time!

duncan.kennedy
2020-04-20 23:09
has joined #general

bethskurrie
2020-04-21 00:13
Hey pact peeps. Ron, Matt and I did Y Combinator's start up school last year. One of the concepts they talked about was "the magic moment", which is the moment that a new user decides "Ah!! this is the thing I've been looking for all my life!! I must have it!!!" I'd be really interested to know from you all, what had you just done with Pact when you had that "aha!" moment? Generating a contract? Running the verifications? Using can-i-deploy? Seeing the verification results in Pactflow? Or, was it more just a moment of understanding rather than an action? Please do share!

ina.lopez
2020-04-21 00:36
I am still waiting for the "aha" moment :slightly_smiling_face: Getting there....

abubics
2020-04-21 00:37
As a somewhat early adopter, and after a couple of years of tedious and flaky integrated test suites (read: torture) just the fundamental concept was enough to convince me :sweat_smile: Using it, and getting all the value quickly just sealed the deal further :ok_hand:

abubics
2020-04-21 00:38
(that's a couple of years of consulting . . . before that I was making mobile games, where there was no testing whatsoever)

bethskurrie
2020-04-21 00:39
If it doesn't happen, let us know what didn't work for you. There are legitimate reasons why it doesn't help in 100% of cases. I've got a half written blog post about it actually.

bethskurrie
2020-04-21 00:40
But I hope it does!

bethskurrie
2020-04-21 00:40
"Honey, I'm just 'testing' my game... yeah... I know, working late sucks..."

ina.lopez
2020-04-21 00:50
When I create a new feature branch and make some changes, I then run contract tests and publish pact to Pact Broker and I continue with my Marry way. (CI build) Meanwhile Pact broker calls Provider and verifies this Pact. How does this later tell me that this feature branch in consumer code is/isn't ready to be merged into master? At the time of master build?


ina.lopez
2020-04-21 00:53
I could be just confusing myself

ryan.dens
2020-04-21 01:50
Magic moment was seeing it catch the same kind of bugs our integration tests did, but early on. It did a lot to build trust :raised_hands:

bethskurrie
2020-04-21 02:39
Using webhooks to send notifications to something like Slack, or to post back a github commit status is the best way @ina.lopez. There's a post on it here: http://blog.pact.io/2018/07/16/publishing-pact-verification-statuses-to-github/

bethskurrie
2020-04-21 02:41
If you're using can-i-deploy, you get the feedback as part of the consumer build too. Here's an example: https://travis-ci.com/github/bethesque/example-consumer/builds/160698464

matt.fellows
2020-04-21 02:42
?Lessons learned building a Saas business? is on now - join here: https://meet.google.com/xns-yoku-oum You can interact with us with live Q&A here: ? http://www.slido.com ? event code: #82934

matt.fellows
2020-04-21 02:42
I can see a bunch of you already - thanks for joining!

tjones
2020-04-21 03:31
Good talk! Thanks! :clap:

matt.fellows
2020-04-21 03:33
Thanks for coming Tim!

ina.lopez
2020-04-21 15:14
Great. This is exactly what I needed. It says I will need at least https://github.com/pact-foundation/pact_broker/releases/tag/v2.47.1 version of Broker. Is there a way to tell the version of Pact Broker through the browser? I don't own that service.

rbenbolton
2020-04-21 16:55
The ?magic moment? for me was when I realized this was the thing we needed to keep providers from breaking dependent services within out product suite as we split out monolithic applications into micro-services. When we added a second application that depended on the first, things were constantly breaking and coordination between the two was terrible. But, plans were to add more apps/services. Once pact was in place, these breaking changes stopped almost completely. Also realizing the power it gave those consumer applications to control the types and parameters around the data they received and place expectations around it.

jon.stevens
2020-04-21 22:07
has joined #general

matt.fellows
2020-04-22 00:56
For those of you who missed the session yesterday, here is the recording: https://www.youtube.com/watch?v=w50VOIRHFcQ&feature=youtu.be Thanks again for those who attended and asked us difficult questions :) If you have any feedback questions, you know where to find us!

s.garcha
2020-04-22 09:59
has joined #general

sbartsa
2020-04-22 11:34
has joined #general

sbartsa
2020-04-22 11:38
For us the aha moment was when we realised we could pass the same test files from the consumer to the provider. We had tons of tests passing which were quite useless since they were testing old implementation, and gave us no actual value.

sbartsa
2020-04-22 11:42
Hello everyone. I am digging into creating a full fledged CI for our contract tests. The problem is to fully automate this procedure we have a problem when we want to publish a new contract from a feature branch and test against the provider on master since, profoundly, it is going to fail. I researched and came across the `pending_contracts` which seems to solve this issue impeccably. Does anyone have any more information on how we can use this functionality? P.S. We are using `pact-jvm` , `maven` and `junit` in our tests. Reached here following this article (http://blog.pact.io/2020/02/24/how-we-have-fixed-the-biggest-problem-with-the-pact-workflow/) Thank you in advance!

matt.fellows
2020-04-22 20:04
Yes, you can head to the HAL browser and look at the response headers. There is a x- header with the version in it

ina.lopez
2020-04-22 20:51
found it :slightly_smiling_face: thank you

corey
2020-04-22 22:40
has joined #general

artur.ashyrov
2020-04-23 05:07
Hello everyone. I have a question on proper way of using Pact for contracts testing. How to properly test contracts when my service consumer A consumes API of service provider B but interacting with B through api gateway? Gateway basically authorizing the request and adds some headers to proxied request. Thanks in advance! PS: to me it seems that authorization should not be a part of contract here but the main problem for me that B will not verify contracts without request headers that are added on gateway(response is just passed as is). Of course i could consider gateway as consumer and producer at the same time - but it sounds like an overkill in my case

bethskurrie
2020-04-23 05:48
If the headers are simple and consistent, I'd add them in a filter when doing the verification step.

bethskurrie
2020-04-23 05:48
It's a tricky one, and comes up a bit

bethskurrie
2020-04-23 05:48
What are the headers that the called code expects?

bethskurrie
2020-04-23 05:49
Can you decouple it from the business logic as middleware?


artur.ashyrov
2020-04-23 05:54
thanks for quick response. Yes i?ve seen this article request flow is something like this: consumer headers: Authorization abcd gateway exchanges this for: X-Customer-Id X-Cusomer-Currency and proxies the request(or rejects it if auth token is expired etc). Which means that X-Customer-* headers are part of provider?s verification(but not the contract from consumer?s side)

artur.ashyrov
2020-04-23 05:56
at the moment - the only way around i see is to implement both consumer/provider states on my front api gateway. but as i mentioned - looks smelly to me(because of tests/contracts duplication)

bethskurrie
2020-04-23 05:56
Yeah, I'd just add them at verification time

bethskurrie
2020-04-23 05:57
It's an internal concern of the deployed provider, if you see the gateway and the app as one system from the outside.

bethskurrie
2020-04-23 05:58
If it's unlikely to change often, or have complex logic, I think it would be OK.

artur.ashyrov
2020-04-23 05:58
ok so i was thinking in right direction you mean? i need to add them(X-Customer-* headers) on verification phase of service B correct?

bethskurrie
2020-04-23 05:58
Yes

artur.ashyrov
2020-04-23 05:59
ok will dig in this direction then. Thank you very much Beth and have a good day :slightly_smiling_face:

bethskurrie
2020-04-23 05:59
You too. Happy quarantine.

bernardoguerr
2020-04-23 09:44
Hey @artur.ashyrov I wrote this article where I solved this problem before. My use case was also a lambda behind API Gateway. https://medium.com/dazn-tech/pact-contract-testing-dealing-with-authentication-on-the-provider-51fd46fdaa78 It might help you

artur.ashyrov
2020-04-23 10:45
will check it out

anja.gruss
2020-04-23 10:46
has joined #general

asher.feil
2020-04-23 19:20
has joined #general

dham
2020-04-23 21:28
has joined #general

dham
2020-04-23 21:30
hello friends!

dham
2020-04-23 21:34
we are having a mysterious issue. we are running pact broker on kubernetes, and it looks like it crashed earlier today (due to an unrelated cluster issue) but now pact-broker is crash looping with this message: ```Connecting to database with config: {:adapter=>"postgres", :user=>"clearcover", :password=>"*****", :host=>"pact-broker.[REDACTED].us-eas ? ? pact-broker ! Unable to load application: Sequel::DatabaseConnectionError: PG::ConnectionBad: expected authentication request from server, but received H ```

dham
2020-04-23 21:35
I am able to connect to the DB via DataGrip

dham
2020-04-23 21:35
also, we have not changed our deployment of pact broker in months, and it was working fine earlier this week

matt.fellows
2020-04-23 23:14
I?m assuming you?ve tried the obvious - restart the app?

bethskurrie
2020-04-23 23:19
"Received H"? Is there part of the message I'm not seeing?

evanrosal
2020-04-24 04:30
has joined #general

mbieganski.infomatt
2020-04-24 12:39
has joined #general

shurik
2020-04-24 14:15
has joined #general

dham
2020-04-24 15:07
we did get it to work eventually. We are running Istio, and when we disabled the Istio sidecar it worked again. We don't know what the issue was exactly but I don't think it was anything to do with Pact broker. Thanks!

fafa029
2020-04-25 05:00
has joined #general

dinh.che
2020-04-27 04:44
has joined #general

thibaud.stevelinck
2020-04-27 09:17
has joined #general

thibaud.stevelinck
2020-04-27 09:34
Hello there! I would like to know if you have a rough idea of when pact-ruby would fully support V3matcher. Kind regards

bethskurrie
2020-04-27 09:34
Sorry, I don't know.

bethskurrie
2020-04-27 09:35
I may have some time in the next few months, depending on pandemic!

thibaud.stevelinck
2020-04-27 09:35
ok thanks

bethskurrie
2020-04-27 09:35
Is there a particular matcher you're after @thibaud.stevelinck?

thibaud.stevelinck
2020-04-27 09:37
Not really at the moment, only investigating as we've planned to use pact.

praneethkumar
2020-04-27 10:30
has joined #general


lukasz.kaniowski
2020-04-28 13:44
has joined #general

lukasz.kaniowski
2020-04-28 14:03
Hello guys and gals, hope everyone is having a nice day! We?ve recently started integrating pact into our workflow and as such I just wanted to say hello to the community :wave:

eleftherios
2020-04-28 15:09
has joined #general

matt.fellows
2020-04-28 21:16
Awesome, thanks for joining us! Let us know how we can help

sen.rudrappa
2020-04-29 08:15
has joined #general

jake.chandrasakera
2020-04-29 16:08
has joined #general

maciej.olko
2020-04-29 17:49
has joined #general

stephen.rhodes
2020-04-29 18:19
has joined #general

stephen.rhodes
2020-04-29 18:19
where would be the best place for me to ask some graphql related questions ?

leonardo.k.magalhaes
2020-04-29 21:22
has joined #general

matt.fellows
2020-04-29 21:36
what language are you using? Probably in that channel, albeit perhaps we should create a GraphQL specific channel

preethighalke
2020-04-30 05:49
has joined #general

stephen.rhodes
2020-04-30 09:20
JavaScript,

stephen.rhodes
2020-04-30 09:25
i was wondering about how flexible the withQuery method is... for example: If i define, ```query { id name }``` in theory.. this creates a contract that will cover a query that queries id, name... so if i do a query somewhere that will just be .. ```query { id }``` ... i am ... in theory, just querying something that has already been covered in a contract. .. I know this very different to how REST works, but as GraphQL is different, should contracts for GraphQL be changed to cover partials ?

jsanchez
2020-04-30 11:45
has joined #general

sonya.chauhan
2020-04-30 15:26
has joined #general

sonya.chauhan
2020-04-30 15:46
Hello all, I have started looking into using Contract testing in our project. We have a frontEnd (react app) and Bff (Graphql .net core) API. FrontEnd which is the consumer, I can use the pact library to generate the contract file.. which then gets publish via pact broker .. so the Api can pick the file and verify it. My biggest problem is that on BFF (API), we have couple of dependencies on other systems. Like Authentication being one, for which we use some other system.. and then to fetch data also we are dependent on some other system. So what's the best practice/way to run the verification of pact file on provider's end ? will it run like a integration test at Providers end ?

malex.y
2020-04-30 20:19
has joined #general

matt.fellows
2020-04-30 22:06
No you should probably stub the other layers. The docs have a section on this somewhere

matt.fellows
2020-04-30 22:07
FAQs I think

bethskurrie
2020-04-30 23:53
These are slides on stubbing in the provider from a workshop I did recently. I need to add them to the docs.


kaypee90
2020-05-01 00:16
has joined #general

preethighalke
2020-05-01 05:46
Hi All, Can you point me to an example Provider Test which works with JUnit4, I'm unable to get my sample test working as it ends up with InitializationError. I'm using pact-jvm-provider version 4.0.10. Many Thanks in advance. Regards


uglyog
2020-05-01 05:52
Just note that that test is unsing ClientDriverRule to create a mock provider. You should use your actual provider.

sonya.chauhan
2020-05-01 09:31
Thanks Beth.. I will read though the doc.

bheemreddy181
2020-05-01 11:57
The slides are really helpful thanks Beth

preethighalke
2020-05-01 11:58
Thank you @uglyog the example helped. I'm able to run my providertest now. Many Thanks.

julie_woodford
2020-05-01 12:05
has joined #general

zibyte
2020-05-01 12:31
has joined #general

dan.h.lee329
2020-05-02 01:53
has joined #general

tyler.morris
2020-05-03 04:00
has joined #general

tyler.morris
2020-05-03 04:02
qq, reading over the docs on https://github.com/pact-foundation/pact-js#provider-api-testing it looks like you should use the providerStatesSetupUrl to have the provider state set on the provider via a put method, but the e2e examples show the use of a stateHandlers property on the verifier options. The typedef for pact shows providerStatesSetupUrl under "DeprecatedVerifierOptions". Is the going forward way for provider state via this stateHandler method and not via the api route?

matt.fellows
2020-05-03 04:04
yes, this is correct

matt.fellows
2020-05-03 04:04
I?ll update the docs now to show that field as deprecated

tyler.morris
2020-05-03 04:06
Oh awesome thanks! Any reason in particular the move away from the url to the methods on the test running side? I know there's more recent stuff related to pact testing support for events and other non api based things

matt.fellows
2020-05-03 04:09
There are a bunch of reasons: 1. Having to standup a separate HTTP endpoint is pretty ugly 2. A lot of people struggle with the concept 3. People who get it, complain that they don?t want to ?change? their provider for the purposes of testing 4. Function mapping is much simpler, hides away this complexity and feels a lot more natural/ergonimic

matt.fellows
2020-05-03 04:09
If you disagree though, i would love to chat/understand further!

tyler.morris
2020-05-03 04:31
Nope, that makes perfect sense. Im in node atm so adding a route conditioned on a process env is easy, but does add code the setup. Thanks again for the info! :slightly_smiling_face:

nqdung.itus
2020-05-03 09:56
has joined #general

srinivasan.sekar1990
2020-05-03 10:41
has joined #general

krishnam.misc
2020-05-03 12:44
has joined #general

krishnam.misc
2020-05-04 05:00
I see few errors like below when _jest_ tests are run. ERROR: The process "23412" not found. [2020-05-04T04:55:16.578Z] ERROR: pact-node@9.0.7/12924 on LTIN114925: Pact Binary Error: C:/ComCast/TestCafe/ContractTesting/pact-js-master/pact-js-master/examples/jest/node_modules/@pact-foundation/pact-node/standalone/win32-1.70.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.1.1/lib/pact/mock_service/request_handlers/interaction_post.rb:1:in `require': cannot load such file -- pact/mock_service/request_handlers/base_administration_request_handler (LoadError)

tjones
2020-05-04 05:09
@krishnam.misc Can you try updating to the latest pact-js and see if this still happens?

matt.fellows
2020-05-04 05:22
the issue looks like the well-document windows file path issue

matt.fellows
2020-05-04 05:22
Please try moving your path closer to the root of `c:`

tjones
2020-05-04 05:22
Ah yes, so it is

matt.fellows
2020-05-04 05:23
classic, how the fuck is this still happening, windows issue

tjones
2020-05-04 05:40
I think this is a problem because for some reason I set the default log to `error` in jest-pact

tjones
2020-05-04 05:40
pact-node tests the windows path length and will warn if it is too long

tjones
2020-05-04 05:40
I?ll update jest-pact

krishnam.misc
2020-05-04 05:57
Thanks for all super quick responses!

krishnam.misc
2020-05-04 07:38
So, that apparently is due to the workspace name (lengthy). I see below warning now. 2020-05-04T07:36:53.989Z] INFO: pact@9.2.1/22480 on LTIN114925: Setting up Pact with Consumer "MyConsumer" and Provider "MyProvider" using mock service on Port: "8991" [2020-05-04T07:36:54.060Z] ERROR: pact-node@9.0.7/22480 on LTIN114925: Pact Binary Error: WARN: Ignoring unsupported matching rules {"min"=>1} for path $['query']['catId'][] [2020-05-04T07:36:54.060Z] ERROR: pact-node@9.0.7/22480 on LTIN114925: Pact Binary Error: WARN: Ignoring unsupported matching rules {"match"=>"type"} for path $['query']['catId'][][*]* [2020-05-04T07:36:54.063Z] INFO: pact@9.2.1/22480 on LTIN114925: Pact File Written [2020-05-04T07:36:54.064Z] INFO: pact-node@9.0.7/22480 on LTIN114925: Removing Pact with PID: 7004 PASS __tests__/index.spec.js (5.023s) Test Suites: 3 passed, 3 total Tests: 4 passed, 4 total Snapshots: 0 total Time: 21.312s Ran all test suites matching /__tests__\\/i. [2020-05-04T07:36:55.327Z] INFO: pact-node@9.0.7/22480 on LTIN114925: Deleting Pact Server with options: {"consumer":"MyConsumer","cors":false,"dir":"C:\\ContractTesting\\pact-js-master\\pact-js-master\\examples\\jest\\pacts","host":"127.0.0.1","log":"C:\\ContractTesting\\pact-js-master\\pact-js-master\\examples\\jest\\logs\\mockserver-integration.log","pactFileWriteMode":"update","port":8991,"provider":"MyProvider","spec":2,"ssl":false} PS C:\ContractTesting\pact-js-master\pact-js-master\examples\jest>

abubics
2020-05-04 07:39
Probably good to move this over to #pact-js now :slightly_smiling_face:

krishnam.misc
2020-05-04 07:40
Sure

gromov.yuriy
2020-05-04 08:57
has joined #general

gromov.yuriy
2020-05-04 09:11
Hi. I'm looking for a way to migrate pact-broker data from one instance to another. Is there some standard way to do so or I just have to migrate DB? Is there some ready-baked script for that? Many thanks.

bethskurrie
2020-05-04 09:11
Import and export the db is the easiest way.

bethskurrie
2020-05-04 09:11
Both postgres?

gromov.yuriy
2020-05-04 09:11
Yep same versions

matt.fellows
2020-05-04 09:13
Why are you migrating? Upgrade or something?

bethskurrie
2020-05-04 09:13
pg_dump and pg_restore is the way I do it.

gromov.yuriy
2020-05-04 09:13
I did a dump, restored to another database, run pact-broker on a new database, but it crashed with an error about inconsitency in data

gromov.yuriy
2020-05-04 09:14
We had it in test and developers already have some data in it, now we are migrating it into production and they say that they need that data.

bethskurrie
2020-05-04 09:14
I do it all the time. What's the error?

gromov.yuriy
2020-05-04 09:15
I need to do that one more time, I deleted all the error logs.

gromov.yuriy
2020-05-04 09:17
I guess it is because guys that made that test instanse run database in the default postgres database (postgres), but I need to run it in its own dedicated db (pact-broker), may be an issue in restoring to db with different name

bethskurrie
2020-05-04 09:33
Well, let me know when you have the error. Can't help you much until then!

gromov.yuriy
2020-05-04 10:20
I did it, it works. The issue was that I didn't know much about postgres (simple issue with permissions) :) Sorry for disturbing.

bethskurrie
2020-05-04 10:21
Glad you've got it sorted.

gromov.yuriy
2020-05-04 10:22
Thank you for willing to help.

mykeandreas_pact
2020-05-04 10:23
has joined #general

matt.fellows
2020-05-04 11:11
Ah, makes sense

matt.fellows
2020-05-04 11:11
Always good to know the use cases. Helps us with ensuring pactflow and our OSS tooling stays relevant

mykeandreas_pact
2020-05-04 11:42
I have a questions regarding pact verification on a Provider which is in python. right now we are using pactman-verifier https://github.com/reecetech/pactman#verifying-pacts-against-a-service for pacts verification. This has a disadvantage that is run in a service, so when ever you want to run the tests on your Provider, you have configure the other services, for each state, from the scope of the service in which you are running the tests. The database of the service in which you run the verification with `pactman-verifier` is cleared for each pact. My issue is that i have to manually do some housekeeping to clean or configure other services based on the provider states from within the scope of the service in which I am running the pact verification. Is there a better way to verify the pacts in a microservices architecture ? Can you configure multiple services with the same pact provider state ?

krishnam.misc
2020-05-04 11:49
How do we debug pacts?

matt.fellows
2020-05-04 11:50
Maybe start a new thread elsewhere (e.g. #pact-js) on this. Do you have a specific issue?

krishnam.misc
2020-05-04 11:52
Well, I have an endpoint to test how pact actually works and want to debug the whole flow once so I am comf with the workspace

sidhartha.k.subudhi
2020-05-04 12:05
has joined #general

chandanakurumeti27
2020-05-04 12:33
Hi , I wanted to use `pact-jvm-consumer` dependency to support (testNG @Test annotation )and not `pact-jvm-consumer-junit.2.11` as my consumer code base is using testNG framework. Is there any possibility to use `pact -jvm-comsumer` dependency which can support TestNG. Cannot really use `pact-jvm-consumer-junit.2.11` for my consumer code base, please help me to find the solution here in this case. looking forward to some suggestions. Thanks, Chandana

chandanakurumeti27
2020-05-04 13:13
Can someone please help me understand the difference between `pact-jvm-consumer` and `pact-jvm-consumer-junit` dependencies ?

matt.fellows
2020-05-04 13:31
Please ask in #pact-jvm-help

matt.fellows
2020-05-04 13:32
Out of curiosity, did you receive a welcome message asking to request questions in the appropriate language channel? Just want to check that's working

chandanakurumeti27
2020-05-04 13:36
Yes, i did receive. But thought that general channel is something where i can request for suggestions for general questions. Sorry, will ask my doubts in appropriate channels from now.

rjaladurgam
2020-05-04 18:21
has joined #general

rjaladurgam
2020-05-04 18:22
Could a test file have multiple @Pact and @Test annotations? For example, to test GET, POST and DELETE methods of an API

rjaladurgam
2020-05-04 18:34
How to use the pending pacts feature?

wesleythomaswilliams
2020-05-04 20:27
Yes

john.richards
2020-05-04 21:10
has joined #general

nick.smith3128
2020-05-04 21:46
has joined #general

matt.fellows
2020-05-04 21:48
All good, just checking!

nick.smith3128
2020-05-04 21:49
hi. has anyone seen a really odd `pactfoundation/pact-stub-server` behaviour? My Spring Boot app calls to a service hosted in `pactfoundation/pact-stub-server`, calls which fail every other time (with no response from the server). i.e ```for (int i=0 ; i < 20; i++) { try { accountApiService.getAccount(accountId); http://log.info("XXXXXXX - {} passed", i); } catch (Exception e) { http://log.info("XXXXXXX - {} failed", i); } }``` produces: ```XXXXXXX - 0 failed XXXXXXX - 1 passed XXXXXXX - 2 failed XXXXXXX - 4 passed etc```

matt.fellows
2020-05-04 21:52
No that's... Strange. If you can provide a repro outsiders can use we'd appreciate an issue

john.richards
2020-05-04 21:56
Hello! I am looking to use PACT with this stack: Ruby, SNS, and SQS. I see a lot of simple examples for instance in the ruby workshop for Pact. That use the mock service and a port. How could I do this to emulate messages queues like SQS? Pact.service_consumer "Zoo App" do has_pact_with "Animal Service" do mock_service :animal_service do port 1234 end end end

jlklein
2020-05-04 22:08
has joined #general

jlklein
2020-05-04 22:09
QQ, I have been reading a lot about PACT and one argument is this does not solve UI testing. What is the recommended approach lets say for an angular project?

nick.smith3128
2020-05-04 22:09
ill try to sort out out

bethskurrie
2020-05-04 22:16
Angular can be tricky I believe. Someone wrote a blog on this recently @jlklein https://medium.com/@dany.marques/how-to-set-up-pact-tests-with-angular-jest-ae157f272428

bethskurrie
2020-05-04 22:16
The recommended approach for UI testing is to use the pact generated in the unit tests as a HTTP stub using one of the pact stub server implementations.


2020-05-04 22:47
A new post has been created in *Feature Requests*

bethskurrie
2020-05-04 22:49
I've just thrown together some docs here: https://docs.pact.io/consumer/using_pact_to_support_ui_testing

nick.smith3128
2020-05-04 22:54
whilst making a test rig for this i discovered that it was the dependency `io.github.openfeign:feign-httpclient`

nick.smith3128
2020-05-04 22:55
that was causing this issue

nick.smith3128
2020-05-04 22:55
thanks for your help anyway

matt.fellows
2020-05-04 22:57
:+1:


bethskurrie
2020-05-04 23:03
It looks like Ruby is the consumer, and as you can see, the consumer side DSL is not quite finished.

bethskurrie
2020-05-04 23:03
If you're keen to use it, I can make it happen however.

bethskurrie
2020-05-04 23:05
@mykeandreas_pact yes - you generally stub any downstream services during the verification phase.


mykeandreas_pact
2020-05-04 23:08
But this are services from my provider, which I would like to test along with the pacts, not external services.

bethskurrie
2020-05-04 23:15
I think we have a different understanding of what "service" means in this context.

bethskurrie
2020-05-04 23:15
It is expected that at the start of each provider state set up that your clear all state associated with the previous interaction.

bethskurrie
2020-05-04 23:16
It's much safer to clean up at the start of an interaction than the finish, because you can never be certain of what happened in the test before this point in time.

bethskurrie
2020-05-04 23:17
I always do a "db reset" at the start of each of my provider states.

bethskurrie
2020-05-04 23:18
I just wrote a new page on using Pact to support UI testing here: https://docs.pact.io/consumer/using_pact_to_support_ui_testing

bethskurrie
2020-05-04 23:18
It's a bit light on detail because I don't have time to do too much on it right now, but I've raised a feature request to provide some code examples.

john.richards
2020-05-04 23:21
@bethskurrie@bethskurrie@bethskurrie We would love to use it. I could also help in development if it is open source.

bethskurrie
2020-05-04 23:22
The code is mostly done - I got stuck on the naming :laughing:

john.richards
2020-05-04 23:23
Haha fair enough.

bethskurrie
2020-05-04 23:23
I'll see if I can find where I was up to

bethskurrie
2020-05-04 23:24
Ok, it's because I ended up with a `builder` object in both the consumer and provider contexts that did different things.


bethskurrie
2020-05-04 23:25
On the consumer side, the `builder` (see https://github.com/pact-foundation/pact-message-ruby/blob/master/spec/features/create_message_pact_spec.rb#L11) is the thing that you use to build the interactions.

bethskurrie
2020-05-04 23:26
On the provider side (which is already released) the builder is the thing that creates concrete examples of the messages to be returned to the pact verifier for matching against the pact.

john.richards
2020-05-04 23:26
Awesome!

john.richards
2020-05-04 23:26
Looks good

bethskurrie
2020-05-04 23:27
So, my problem was - I didn't want two things called `builder` but I couldn't think of what to call the consumer `builder`.

bethskurrie
2020-05-04 23:27
So I stopped because nobody was actually asking for the code yet!

bethskurrie
2020-05-04 23:28
Maybe you have some idea.


john.richards
2020-05-04 23:31
Oh yikes. I always pick out-there names. I like ?architect?, ?assembler?, or ?fabricator? haha

bethskurrie
2020-05-04 23:32
ha!

bethskurrie
2020-05-04 23:32
I'm trying to keep it in line with the other implementations.

bethskurrie
2020-05-04 23:33
I don't use message queues very much.

bethskurrie
2020-05-04 23:33
Can you read the specs here and tell me if the DSL makes sense to you? https://github.com/pact-foundation/pact-message-ruby/blob/master/spec/features/create_message_pact_spec.rb

john.richards
2020-05-04 23:36
Yes that is the most basic usage for a message. The DSL looks correct

bethskurrie
2020-05-04 23:39
I'll see if I can get this finished in the next few days. I can't remember where I was up to well enough to describe what would need doing for you to do it.

bethskurrie
2020-05-04 23:40
I'll let you know if there's something you can help out with though :slightly_smiling_face:

john.richards
2020-05-04 23:40
Ok let me know. We are planning to use it for a very big system.

bethskurrie
2020-05-04 23:40
:thumbsup::skin-tone-3:


rjaladurgam
2020-05-05 05:45
@wesleythomaswilliams is there any example you have?

wesleythomaswilliams
2020-05-05 08:25
Is this what you're after @rjaladurgam ```public class myConsumerPactTest { @Pact(provider = "", consumer = "") public RequestResponsePact putCall(PactDslWithProvider builder) throws Exception { return builder .given("") .uponReceiving("") .path("") .query("") .method("PUT") .willRespondWith() .status(201) .body(putResponse) .toPact(); } @Pact(provider = "", consumer = "") public RequestResponsePact getCall(PactDslWithProvider builder) throws Exception { return builder .given("") .uponReceiving("") .path("") .query("") .method("GET") .willRespondWith() .status(200) .body(getResponse) .toPact(); } @Test @PactTestFor(pactMethod = "putCall") void testPut() throws Exception { } @Test @PactTestFor(pactMethod = "getCall") void testGet() throws Exception { } }```

mykeandreas_pact
2020-05-05 08:29
Ok, in my understanding, the provider is the entire BE and the consumer is the mobile app in this case. In the BE there are multiple microservices, the way how pact verifier works, it runs the pact verification in the context of a microservice. If you run it through `pytest` it will create a test database before the tests start and it will clear that database automatically for each test. The issue is that it clears only the database for that microservice, and as there are multiple microservices, I need to manually clear the database for the other ones before each pact test.

mykeandreas_pact
2020-05-05 08:48
Maybe I am missing something here, I?ve looked on the documentation but I can?t see how the Pact verification can be run against the Provider and not against a microservice

bethskurrie
2020-05-05 08:56
I don't feel like we have the same understandings of the terms here. Perhaps you could draw me a diagram and mark the components that have a pact between them.

mykeandreas_pact
2020-05-05 08:56
Ok, I will try to do that later today, thanks for the help

bethskurrie
2020-05-05 08:56
Is your backend an aggregation service?

mykeandreas_pact
2020-05-05 09:07
No, the backend is composed of multiple microservices

mykeandreas_pact
2020-05-05 09:07
each one with its own purpose

bethskurrie
2020-05-05 09:07
you need a pact with each of the microservices separately

bethskurrie
2020-05-05 09:08
You can't have a single pact that covers multiple services

mykeandreas_pact
2020-05-05 09:08
and if you perform a normal http call, you will hit the API endpoint and from there multiple micro services get called and in the end you will get the response

bethskurrie
2020-05-05 09:09
let's go back to the drawing plan.

bethskurrie
2020-05-05 09:09
I'm in australia, so I'll be offline in a couple of hours. If I don't get back to you tonight, I'll respond in the morning.

mykeandreas_pact
2020-05-05 09:10
That is a big time difference

mykeandreas_pact
2020-05-05 09:10
I am in Europe

bethskurrie
2020-05-05 09:10
yeah, it does make it tricky

mykeandreas_pact
2020-05-05 09:11
But this is not urgent, I will try to explain as clear as possible

bethskurrie
2020-05-05 09:11
:thumbsup::skin-tone-3:

mykeandreas_pact
2020-05-05 09:11
Thanks

ajinkya.pande
2020-05-05 09:50
has joined #general

ajinkya.pande
2020-05-05 15:18
Hello , i am new to pact. one question i have should i mock the actual end point for dependent server or the logic in service where endpoints API's accessed?

rjaladurgam
2020-05-05 16:32
Thanks @wesleythomaswilliams. Wasn't sure that multiple pacts and tests could be written in a single java file

wesleythomaswilliams
2020-05-05 16:32
No worries, it's working just fine for me.

rjaladurgam
2020-05-05 16:33
Would it be possible for consumer tests to fail if the provider doesn't have the API yet?

wesleythomaswilliams
2020-05-05 16:38
Both consumer and provider are independent of each other. Their link is the contract that the consumer creates and the provider verifies. So while the provider is dependent on their being a contract to verify, the consumer has no such dependency as it is creating the contract.

rjaladurgam
2020-05-05 16:42
isn't it unsafe if a consumer is pushed to prod without the provider having the correct API. I am trying to see how the consumers to be protected too. Read something about pending pacts feature

rjaladurgam
2020-05-05 16:43
What is the channel for UI tests?

rjaladurgam
2020-05-05 16:43
@bethskurrie Could you please help on why "While we don't recommend you generate pacts from your UI tests, you can use Pact to support your UI testing using one of a few approaches." ?

wesleythomaswilliams
2020-05-05 16:47
```isn't it unsafe if a consumer is pushed to prod without the provider having the correct API. I am trying to see how the consumers to be protected too. Read something about pending pacts feature``` Depends how you define "unsafe". You have less overall validation without the provider side testing, but presumably you have lots of other types of tests validating your consumer outside of contract tests. Many people write services without contract tests and while the risk to quality might be higher, that doesn't stop them going to production. The quality requirements of your business/industry might be higher, I've no idea. Personally, I would put contract tests in place once both the consumer and provider were ready for them, but I don't think that should prevent you writing consumer tests in the meantime. Would love other people's thoughts on that.

wesleythomaswilliams
2020-05-05 16:51
As an example, before I left my last job, we developed microservices for three years and never implemented contract testing.

rjaladurgam
2020-05-05 16:52
My view was to flag errors in the consumer tests if the provider doesn't have the API

wesleythomaswilliams
2020-05-05 16:55
I'm not sure I understand that last message. Can you explain what you mean by "if the provider doesn't have the API"

rjaladurgam
2020-05-05 17:11
Sorry, let me be more clear. I mean if the provider hasn't written the API or API doesn't return the responses expected. How could we show some errors when consumer tests are written

mykeandreas_pact
2020-05-05 18:16
I think I realized what is the issue of our current implementation. Pact-verifier runs inside one of the microservices, lets say Microservice A, we run pact-verifier with pytest to take advantage of the pytest functionality, but this limits the configuration of Microservice B, during pact tests

mykeandreas_pact
2020-05-05 18:16
So now, during pact tests, we reset the DB of Microservice B from within Microservice A

mykeandreas_pact
2020-05-05 18:16
After more investigation I understood that the pact-verifier needs to be outside of the Backend, and just run like a normal app the prerecorded pacts against the Backend API, and pass the provider states before each pact.

nhodaly
2020-05-05 18:39
has joined #general

rjaladurgam
2020-05-05 19:38
Is there any recording of the advanced pact workshop?

jlklein
2020-05-05 21:07
Thanks @bethskurrie. I would love to see some examples on this topic.

wesleythomaswilliams
2020-05-05 21:35
Your test would (and should) have no knowledge of the provider API/service. However, the can-i-deploy tool that Pact provides, which you integrate into your build pipeline, would stop the pipeline if it found no provider. It gives output like: ```Computer says no ¯\_(?)_/¯ CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? ------------------------|-----------|----------------------------|-----------|--------- consumer-service | 35eb3c2 | provider-service | ??? | ??? [There is no verified pact between version 35eb3c2 of consumer-service and the latest version of provider (818cab2)``` @matt.fellows can you have a read of the thread and just make sure I'm advising @rjaladurgam correctly.

matt.fellows
2020-05-05 23:22
Thanks Wes, yes that?s pretty much it

matt.fellows
2020-05-05 23:23
Ramana - your unit tests are your unit tests and have no access to outside systems. Think of Pact as a unit test, it should not have access to the real provider - the whole point of contract testing is to get away from this end-to-end, integrated testing issue

matt.fellows
2020-05-05 23:23
Of course, unit tests can put in assumptions about things that are simply not true - like an endpoint on a provider that doesn?t yet exist

matt.fellows
2020-05-05 23:24
That?s where the `can-i-deploy` check comes in. It says ?hey, I want to deploy consumer A to production, does the provider in production support my expectations??. If the answer is no, you have a failed build

matt.fellows
2020-05-05 23:24
no sorry, we are looking to do more of these publicly soon though


bethskurrie
2020-05-06 01:26
Ok, I'm glad you've worked it out @mykeandreas_pact

bethskurrie
2020-05-06 01:26
That diagram wasn't quite what I was after - I meant a diagram that showed how your HTTP services talked to each other, and which services the pact was between.


sbartsa
2020-05-06 07:52
Hello everyone! Does anyone know any more information about the `pending pacts` and how we can use them? Thank you in advance :slightly_smiling_face:

bethskurrie
2020-05-06 07:52
You need to be using Pactflow at the moment.

matt.fellows
2020-05-06 07:53
I love that people know about pending pacts but don?t - feels so secretive!

bethskurrie
2020-05-06 07:53
And Pact js, go, or net.

bethskurrie
2020-05-06 07:53
Or python

matt.fellows
2020-05-06 07:53
And some select? that

bethskurrie
2020-05-06 07:57
You can see an example consumer pipeline here https://github.com/pactflow/example-consumer @rjaladurgam

bethskurrie
2020-05-06 07:59
You can see how to enable the feature in this step of our CI/CD workshop https://github.com/pactflow/ci-cd-workshop/blob/master/workshop/02_protecting_the_provider.md

2020-05-06 08:02
A new post has been created in *Feature Requests*

sbartsa
2020-05-06 08:02
Perfect. So specifically for jvm distributions we'll have to wait a bit, right?

2020-05-06 08:03
A post in *Feature Requests* has been marked as *in progress*

bethskurrie
2020-05-06 08:04
Yes. Ron is working on it.

matt.fellows
2020-05-06 08:04
I think so. I know work has started but not sure where it?s specifically at

martin.nilsson
2020-05-06 08:05
Hi! I want to start using pact but I can?t really wrap my head around how to approach messages (we use a lot of JMS). With messages it feels like I want the provider/consumer inverted, instead the message-consumer I want to use the service-consumer as the pact-consumer. Does that make sense at all? For example appA sends a message to appB, appB may or may not send a response. Here I want to write my consumer tests in appA

bethskurrie
2020-05-06 08:05
You could achieve a similar outcome if you are using can-i-deploy, by running the verifications in a separate process and ignoring the exit code.

bethskurrie
2020-05-06 08:05
Then rely on can I deploy to make sure you don't deploy any broken code.

bethskurrie
2020-05-06 08:06
Or, you could call the new api directly, and then verify each pact url separately, ignoring the results of the pending ones.

bethskurrie
2020-05-06 08:06
Depends how impatient you are!

2020-05-06 08:07
A new post has been created in *Feature Requests*

2020-05-06 08:08
A post in *Feature Requests* has been marked as *in progress*

sbartsa
2020-05-06 08:08
Ah I see, now I understand the can-i-deploy flow cause my scepticism was that the build will fail due to the broken tests.

sbartsa
2020-05-06 08:08
Thanks a lot! You have been doing an amazing job :slightly_smiling_face:

bethskurrie
2020-05-06 08:09
Did you read the pending pacts blog post? I'm guessing that's where you heard about it?

bethskurrie
2020-05-06 08:09
Thanks Stefanos - it's nice to be appreciated!

bethskurrie
2020-05-06 08:10
I've just made a new feature request in canny. You can follow it to be updated when it's out.

bethskurrie
2020-05-06 08:10
Gtg, dinner in Australia!

sbartsa
2020-05-06 08:11
Yes, this is where I can across pending pacts.

matt.fellows
2020-05-06 08:11
And yes, Beth _has_ been doing an amazing job. Pending and WIP pacts are game changers, we need to market that feature better

sbartsa
2020-05-06 08:11
Regards to my other country :flag-au:

ashish_garg5
2020-05-06 09:33
has joined #general

a.smith
2020-05-07 08:09
has joined #general

morten.hekkvang
2020-05-07 08:42
has joined #general

morten.hekkvang053
2020-05-07 08:45
has joined #general

wesleythomaswilliams
2020-05-07 22:06
@bethskurrie @matt.fellows You may find this interesting. The contact tracing app the NHS in the UK is developing is making use of Pact: https://github.com/nhsx/COVID-19-app-Android-BETA/blob/master/app/src/test/java/uk/nhs/nhsx/sonar/android/app/registration/RegistrationConfirmDevicePactTest.kt

bethskurrie
2020-05-07 22:07
Interesting. Is your one open source? Ours isn't, but people have decompiled it.

matt.fellows
2020-05-07 22:07
I think they were open sourcing it right?

matt.fellows
2020-05-07 22:07
Wow thanks for the share Wes

bethskurrie
2020-05-07 22:08
I haven't heard about any intention to open source it

wesleythomaswilliams
2020-05-07 22:11
Not sure on the open source aspect.


bethskurrie
2020-05-07 22:24
Nice

tjones
2020-05-08 02:28
This is cool! Thank you!

2020-05-08 03:23
A new post has been created in *Feature Requests*

bethskurrie
2020-05-08 03:31
Looking for someone to help create a pact-net e2e example for helping diagnose issues, like we have for the pact-ruby-standalone and pact-js.

2020-05-08 04:40
A new post has been created in *Feature Requests*

2020-05-08 04:41
A new post has been created in *Feature Requests*

2020-05-08 04:42
A post in *Feature Requests* has been marked as *complete*

2020-05-08 04:42
A post in *Feature Requests* has been marked as *complete*

2020-05-08 04:43
A post in *Feature Requests* has been marked as *complete*

tjones
2020-05-08 05:32
Hi everyone! In pact-js land, I?m putting together a common example consumer and provider so that our many JS test framework examples are comparable to each other (currently we have some things covered in some tests, but not others). I?m starting from the Pact-JS workshop example here: https://github.com/pact-foundation/pact-workshop-js What would people want to see in the examples? So far I?ve got: * Success and failure cases * Matching strings / ints and array contents (we get asked about array matching a lot) * Easy broker configuration without too much config (some of the examples use older patterns which require more custom code)

bethskurrie
2020-05-08 05:40
Did you merge my PR for updating the examples?

bethskurrie
2020-05-08 05:40
The publishing code.

bethskurrie
2020-05-08 05:40
Great idea BTW. It just reminded me of the changes I'd made recently.

tjones
2020-05-08 05:42
Yep! Well, Matt did :slightly_smiling_face:

tjones
2020-05-08 05:43
(also, thanks!)

bethskurrie
2020-05-08 05:43
:+1:

tjones
2020-05-08 05:43
I have this long term dream that all the examples will implement the same thing, then we can talk about it everywhere in the docs

tjones
2020-05-08 05:43
I?m probably not the first with this dream

tjones
2020-05-08 05:44
I?m also not planning to do it, at least not all at once.

tjones
2020-05-08 05:44
Starting with pact-js, though

bethskurrie
2020-05-08 05:44
It's good to have dreams

tjones
2020-05-08 05:47
* provider states

tjones
2020-05-08 05:49
John Lennon famously said ?A dream you dream alone is only a dream. A dream you dream together is reality?, Not many people know that the rest of that quote is ?Contract tests help you assert that you?re dreaming the same dream, also I recommend Pact?

bethskurrie
2020-05-08 05:50
HA!

bethskurrie
2020-05-08 05:50
He was stoned at the time...

bethskurrie
2020-05-08 05:51
The recommended tagging and verification set up.

tjones
2020-05-08 05:52
?Eh, what?s that, John?? ?I dunno, check the log files?


tjones
2020-05-08 05:52
Great idea

bethskurrie
2020-05-08 05:54
Now I've got "I dreamed a dream" from Les Mis on my head

matt.fellows
2020-05-08 07:27
Now I have ?a million dreams? from the greatest showman

matt.fellows
2020-05-08 07:27
Oh Hugh

bethskurrie
2020-05-08 08:03
Funny, that's what I said...

priyafa
2020-05-08 13:37
has joined #general

priyafa
2020-05-08 13:45
Hi there, I am a QA engineer. I am just very new to contract testing and read about PACT online today. I am not sure this is the right place to ask. Please redirect me if not. I would like to know whether its right to use PACT in my scenario. I have a rest api to test, which takes data from a third party wcf service , process and gives some result. Can someone please advice ? THanks in advance

pyasi
2020-05-08 13:46
has joined #general

manos
2020-05-08 16:19
Hi everyone! I am a Test Engineer and recently started exploring the Contract way of testing integrations. Having successfully covered server-to-server integrations i am now highly interested in using Pact for Kafka messages integrations in Ruby and Node apps. I am also using a Pact broker. Is there any chance of having a complete implementation for messages in Ruby soon? (including ?honours_pacts_from_pact_broker?) Thank you in advance!

wesleythomaswilliams
2020-05-08 21:55
.

bethskurrie
2020-05-08 23:40
@manos yes, I've recently had someone else asking about this, so it's high on my priority list. You'll see it's in progress on our feature board. https://pact.canny.io/

bethskurrie
2020-05-08 23:41
The consumer support is there for pact-js, and the provider verification support is there for pact-js and pact-ruby. What's missing is the consumer support for pact-ruby, which just has a few things left.

patelaksh412
2020-05-09 06:57
has joined #general

hoagiex
2020-05-09 21:53
has joined #general

xiaoxing.hu
2020-05-11 01:25
has joined #general

lewis.thorley
2020-05-11 09:49
has joined #general

lewis.thorley
2020-05-11 09:59
Just wondered whether anyone has come across or attempted a dart implementation of PACT? My personal drive for this is that I use PACT tests on .net and React projects, but would like to use PACT on flutter projects.

matt.fellows
2020-05-11 10:27
No-one has created one yet - but hey, if you want to get involved we would :heart: to support you

tjones
2020-05-11 10:28
That would be super cool!

elliottmurray
2020-05-11 16:01
The more I?m using Dart the more I like it tbh.

patrick.b.romo
2020-05-11 18:00
has joined #general

wesleythomaswilliams
2020-05-11 21:44
I've got a service that writes messages to a kafka topic and consumes messages from the same kafka topic. Just wondering if that's likely to throw up any issues when I write a consumer and provider test for the service? Also wondering how Pact Flow would represent that in the network diagram.

matt.fellows
2020-05-11 22:49
3 volunteers already! :wink:

abubics
2020-05-11 23:32
I'm working through the Flutter workshops with GDG Sydney atm . . . haven't done much except UI, but I'd be interested to see the progress, and maybe help, too . . . time permitting . . .

bethskurrie
2020-05-12 01:54
I don't even know @wesleythomaswilliams!

bethskurrie
2020-05-12 01:55
About the diagram that is.

bethskurrie
2020-05-12 01:56
I believe it's possible to have a pact with the same consumer and provider - I remember someone doing this once, and there was some issue that I then wrote a test case to cover.


elliottmurray
2020-05-12 06:24
Which covers a lot is ground including basic programming. But has good coverage and plenty of coding. I?m currently doing custom animations and about to move onto firebase

wesleythomaswilliams
2020-05-12 07:56
I'll let you know then. :smile:

bernardoguerr
2020-05-12 10:14
I guess in theory you could always name them differently. Even though it's the same service, you could maybe separate the naming with something that differentiates them. Just a thought!

bethskurrie
2020-05-12 10:49
I wonder what would happen to can-I-deploy!

bethskurrie
2020-05-12 10:50
It'll either work perfectly, or explode in a spiral of meta :exploding_head:

rajeesudh
2020-05-12 16:26
has joined #general

rajeesudh
2020-05-12 17:54
HI All, I am new to this channel, and a QA Engineer... I was wondering If I can create tests using Pact if I just have the endpoints of the API and the json files for the POST ? Do I have to be a developer and have access to the code in order to handle the Provider tests, or can I do it with just the endpoints? I am trying out Pact with .net core btw

kaamilwal
2020-05-12 20:26
has joined #general

matt.fellows
2020-05-12 23:06
Hi! Yes. It?s not designed to be an external API testing tool (e.g. postman). It needs to execute the actual consumer code to generate the contract and ensure it?s always up to date

matt.fellows
2020-05-12 23:07
You could still do it without executing the real client, but you?d run the risk that the test gets out of sync with the actual implementation. But if you wanted to do to just understand the tool, obviously that would be fine. You could then present the case to the developers after showing the value - that?s a pretty standard POC process

hans.brouwer
2020-05-13 08:24
has joined #general

rajeesudh
2020-05-13 09:40
Thanks @matt.fellows, I would like to do that then ..... are you aware of any websites which would give me some on info on doing it this way?

matt.fellows
2020-05-13 10:16
I don't know of any website directly getting you to do it the wrong way, no

matt.fellows
2020-05-13 10:17
Just write a regular pact test based on an example in one of the repositories and adjust to your needs

matt.fellows
2020-05-13 10:17
I'll be honest, you'll need to know how to code or to have access to somebody who can guide you

krishnam.misc
2020-05-13 10:43
Hey @rajeesudh, I can help you there with half cooked stuff. I have managed to generate pact and right now trying to publish a pact. Onc e done, we need to write a Provider test that validates this pact.

francislainy.campos
2020-05-13 10:54
has joined #general

francislainy.campos
2020-05-13 10:57
Hi all, good morning. Could I get some help with this SO question here please? https://stackoverflow.com/questions/61772433/how-to-verify-pact-when-data-returns-items-with-or-without-children-filled-in-o. Many thanks.

bethskurrie
2020-05-13 11:00
I've added a response.

francislainy.campos
2020-05-13 11:17
Thank you. I've just read it now. Unfortunately we don't have access to changing the data removing the skills array for some of the items, but I guess we'll need to live with it, knowing the tests are not checking that part of the response if no other way around that.

francislainy.campos
2020-05-13 11:18
I've marked your SO answer as accepted.

bethskurrie
2020-05-13 11:19
Pact tests work in concert with your overall testing strategy - sometimes it's not possible or convenient to test something with Pact, so you might want to test that particular bit in an integration test (though of course, you'd want to keep those to as few as possible).

rajeesudh
2020-05-13 11:22
That's great @krishnam.misc .......your help would be great

matt.fellows
2020-05-13 12:00
Love the collaboration folks!

simon.nizov
2020-05-13 12:34
Hi all, anyone here using Drone CI and implemented pact webhooks?

krishnam.misc
2020-05-13 13:16
@rajeesudh - javascript

rajeesudh
2020-05-13 13:21
That'scool... could you share some more details , I will decode it to .net :slightly_smiling_face:

bernardoguerr
2020-05-13 13:38
Hi Simon. I've had to do it in a previous company I've worked in. It's a bit of a pain :slightly_smiling_face:

bernardoguerr
2020-05-13 13:40
Happy to help out @simon.nizov, if you have any specific questions

krishnam.misc
2020-05-13 13:51
JS

simon.nizov
2020-05-13 13:53
Hey Bernard, yeah I?m starting to realize it?s not that easy. Did you trigger the builds using Drone?s API? How did you control the steps you wanted to execute?

bernardoguerr
2020-05-13 13:54
I had to build a system to support it. I can kind of show you a diagram of it, sec

bernardoguerr
2020-05-13 14:09
Basically, there are 3 main issues with Drone: 1. There is no webhooks API, so we had to create one ourselves; 2. The API drone exposes, as is, only supports returning the last 50 builds. This is a problem because you want to be able to find the latest build matching something. We happened to already have an internal service that talks directly to the Drone DB to retrieve more than 50 builds; 3. You need to do this in a safe way, as the drone builds could easily have side effects, and you can't have more than one drone file for different purposes. The result was something like this:

bernardoguerr
2020-05-13 14:12
To give you some context: ? The service was the Lambda there (dapact-webhooks); ? We had a manifest.yml file in each repo with some other settings. We added one for pact there. This was one of the checks that the lambda did. If there wasn't a pact: enabled option there , it wouldn't run. The reason for that was because we had to make sure people had adequately prepared their drone pipelines with the appropriate steps; ? We used deployment events (with name pact) to run only the pact tests from the webhook (the regular provider tests were a separate pipeline step from the webhook triggers). This allowed us to only run specific steps (like building, installing, and the pact verification). It did mean that we couldn't have any other steps in the pipeline with generic triggers (meaning that they trigger for any deployment). Thus the need to prepare the pipelines

bernardoguerr
2020-05-13 14:13
(The call to the Github API was to get that manifest file I mentioned. You could of course implement this some other way, instead of a manifest file in each repo, you could keep one in the service you build that lists all the repos that this is enabled in. Or some other way to manage configuration. Up to you - This is basically a safety precaution so people don't go enabling this webhooks Drone flow and mess up other peoples deploys without properly configuring pipelines)

bernardoguerr
2020-05-13 14:18
Also the drone-pe-query is the other internal service we happened to already have, which gives access to more than 50 builds directly from drone's db

simon.nizov
2020-05-13 14:22
Wow! thanks for the great overview @bernardoguerr

simon.nizov
2020-05-13 14:22
Can you tell me more about the ?deployment event: pact? part?

simon.nizov
2020-05-13 14:23
I don?t see a way in drone to make your own manual event ?types?

simon.nizov
2020-05-13 14:23
did you use starlark?

bernardoguerr
2020-05-13 14:24
sorry that might have been misleading

bernardoguerr
2020-05-13 14:25
I believe we used a deployment event to an environment called pact

bernardoguerr
2020-05-13 14:25
we did not use starlark, no

bernardoguerr
2020-05-13 14:25
They were YAML configurations

bernardoguerr
2020-05-13 14:26
Bear in mind this was based on Drone 0.8. Not sure if much has changed with regard to webhooks for Drone 1+, but I don't think so

simon.nizov
2020-05-13 14:27
Well one thing is that now you can paginate and get more than the latest 50 builds :slightly_smiling_face:


bernardoguerr
2020-05-13 14:27
Awesome, so you don't need that intermediate service

bernardoguerr
2020-05-13 14:27
It sounds like all you really need is to build the webhooks service talking to the Drone API. You can even bypass the Github API part like I suggested, if you don't want to deal with that

simon.nizov
2020-05-13 14:28
Yes, I was also thinking about using lambda for that

simon.nizov
2020-05-13 14:30
But I?m still not sure I understand how to skip build steps when triggered through the webhook

bernardoguerr
2020-05-13 14:32
This basically contains details of most of the things you need in this: a function to getAllBuilds. A function to find the latest successful one. a drone token (which we encrypted with KMS) And then use the event *deployment* with *deploy_to* pact (means the drone file would have an environment: pact)

bernardoguerr
2020-05-13 14:32
Well you are not actually "skipping them" . It's just that you configure steps only specifically for the deployment to environment pact, with the things you need to run the pact via a webhook trigger

bernardoguerr
2020-05-13 14:33
so when it makes a deployment to environment pact, it will only run those

bernardoguerr
2020-05-13 14:34
like I said, the only caveat is you have to make sure you don't have generic deployment events (ie ones that run for *every* environment - if you want them, you have to specifically exclude pact on them)

simon.nizov
2020-05-13 14:36
Ah ok! Got it

simon.nizov
2020-05-13 14:36
It?s not documented that you can pass params when triggering a build


bernardoguerr
2020-05-13 14:36
It works :slightly_smiling_face:

bernardoguerr
2020-05-13 14:37
I suggest you play around with the drone API a bit on Postman first, to get a feel for it

simon.nizov
2020-05-13 14:38
Yeah will do. Thanks a lot! :party_parrot:

bernardoguerr
2020-05-13 14:38
One final thing: If you do implement things this way (with deployment and environment = pact), just make sure that your provider also has a regular pact step for running in their own CI. Basically think of verification differently from 2 sources: ? 1 source is the CI of the provider just running normally, like when a provider is running their tests ? the other is from a webhook

bernardoguerr
2020-05-13 14:38
Good luck! :slightly_smiling_face:

krishnam.misc
2020-05-13 14:46
For the overall example to wrok; you need these pieces: Implement Provider Implement Consumer Install pact package from npm Install test runner like Jest Write Consumer test to generate pact json file Execute Consumer test which will generate pact json publish pact file to pact broker Write provider test with pact broker Execute provider test

rajeesudh
2020-05-13 14:49
Thanks @krishnam.misc, I will try and come back if I have any doubts or issues

krishnam.misc
2020-05-13 14:50
yes pls

krishnam.misc
2020-05-13 14:50
will do whatever I could

krishnam.misc
2020-05-13 14:52
About your other Q: pact works on the concept of mocking and gives the flexibility of not having to spin up actual services (prov,cons) to test the contract

rajeesudh
2020-05-13 15:50
does that mean we have to have access to the Modal's (Json rootojects kind of stuffs) ?

bethskurrie
2020-05-14 07:08
Wow. That sounds amazingly complex!

simon.nizov
2020-05-14 07:49
It?s funny because other than this, it?s a really cool and easy tool to use. All our DevOps guys swear by it and say it?s the best CI/CD tool out there :man-shrugging:

aleksmarg
2020-05-14 08:50
has joined #general

szymon.ramczykowski
2020-05-14 08:51
has joined #general

bernardoguerr
2020-05-14 09:09
Yeah that's the same experience I've had. It's really good at what it does, but there are some things it doesn't do. We just happened to need those things :smile:

arindam.datta
2020-05-14 10:33
has joined #general

roshan.lobo
2020-05-14 12:07
has joined #general

ashwin.bakker
2020-05-14 12:16
has joined #general

szymon.ramczykowski
2020-05-14 12:47
Hello and welcome! I am new to PACT testing, and was wondering if it is possible to use it when producer and consumer are in different technologies (i.e. consumer java, producer go).

matt.fellows
2020-05-14 12:48
yep!

matt.fellows
2020-05-14 12:49
Totally one of the main reasons to use Pact - we have language bindings for JS, Java, Go, Ruby, .NET, Python, PHP, Scala, Swift, Rust, R and now C++

matt.fellows
2020-05-14 12:49
I?ve probably missed a language there, but you get the idea

szymon.ramczykowski
2020-05-14 12:58
Thanks Matt. Wondering if there are any tutorials on how to tackle this? Probably we could take producer part for one language, consumer for another. I assume contract would be in a format acceptable for all technologies.

matt.fellows
2020-05-14 13:02
bang on

matt.fellows
2020-05-14 13:02
Start with the consumer. In your case Java


matt.fellows
2020-05-14 13:02
Write your consumer test in whichever variant of build system / test framework

matt.fellows
2020-05-14 13:03
step 2: publish your pact file somewhere (usually a pact broker see https://docs.pact.io/pact_broker about how to run / host your own or use something like http://pactflow.io)

matt.fellows
2020-05-14 13:03
step 3: have your provider _verify_ the contracts


matt.fellows
2020-05-14 13:04
you might also like to do an end-to-end workshop to learn all of the concepts: https://github.com/pact-foundation/pact-workshop-go (all go, but should translate)

szymon.ramczykowski
2020-05-14 15:29
cheers!

krishnam.misc
2020-05-14 15:42
Sorry, was busy with few other things today. Well, you have to generate pact (contract) by mocking the consumer endpoint response

krishnam.misc
2020-05-14 15:42
you shd look into existing example, which is very clear in official website

jacek.okrojek
2020-05-14 21:17
has joined #general

jacek.okrojek
2020-05-14 21:22
Hi all, I am new to Pact but I plan to use, I joined Pact Slack to see what is going on here and get help when I get to problems :slightly_smiling_face:

bethskurrie
2020-05-14 22:00
Welcome @jacek.okrojek

matt.fellows
2020-05-14 23:13
:point_up:

matt.fellows
2020-05-14 23:14
@rajeesudh what have you looked at and tried so far? You?ll find we have examples in the Pact JS repository that cover most cases


matt.fellows
2020-05-14 23:14
:point_up: end-to-end tutorial

mike.geeves
2020-05-14 23:39
has joined #general

mike.geeves
2020-05-15 00:01
Hi :slightly_smiling_face: We are in the process of trying to get a pact poc working with our GitLab CI/CD pipelines, just trying to get my head around a sensible flow. Hoping there might be some useful python examples to share rather than help I'm stuck, but we shall see :joy:

bethskurrie
2020-05-15 00:03
There's a javacript one.


bethskurrie
2020-05-15 00:03
Apart from the actual tests themselves though, most of it is translatable to other languages.

bethskurrie
2020-05-15 00:04
I believe that pact publish is not natively available in pact-python, but you can do it with the docker image, or the pact-ruby-standlone (which requires no ruby).



matt.fellows
2020-05-15 00:05
Also, :clap: for dedication :stuck_out_tongue:

mike.geeves
2020-05-15 00:05
Yeah, using the docker based cli so far

mike.geeves
2020-05-15 00:06
Python seems like a less than idea first language to try with it :D

bethskurrie
2020-05-15 00:06
It's not quite as widely used, but it should be ok.

mike.geeves
2020-05-15 00:07
Thanks, I'll have a look through those as well

mike.geeves
2020-05-15 00:09
Yep, the pact part itself is ok so far, consumer/broker/first part of provider. Looks like it should be really nice if we can persuade everyone else to try it :D

mike.geeves
2020-05-15 00:14
Ohh, sorry also bad wording from me typing on my phone, I meant I'm hoping we might have some examples to share back if successful, python + GitLab less widely used as you say so seems to be less in the way of full examples floating around

bethskurrie
2020-05-15 00:56
I was sure we had a Gitlab webhook trigger in our templates library, but I can't see it https://docs.pact.io/pact_broker/advanced_topics/webhooks/template_lib

matt.fellows
2020-05-15 00:57
hmm yes I recall this too



matt.fellows
2020-05-15 00:57
lol

bethskurrie
2020-05-15 00:57
Need to sync the docs.

matt.fellows
2020-05-15 00:57
But why is the Wiki still alive? That?s going to be a source of confusion and duplication

mike.geeves
2020-05-15 01:46
:thinking_face: currently I'm calling the trigger from the CI itself rather than a webhook back from the broker - that way the consumer build can pause (or fail) waiting for the verification/publish (I need to read many things still, this may be a terrible idea... But that's all once I get past what I even want to do re feature branching/versioning/environments!)

bethskurrie
2020-05-15 02:05
You can use can I deploy to poll for the result.

bethskurrie
2020-05-15 02:06
I would use that instead, because it will be quicker 99% of the time, as with most commits, the pact doesn't change.


bethskurrie
2020-05-15 02:07
The wiki is still alive because it hasn't all been transferred across.

bethskurrie
2020-05-15 02:10
@mike.geeves the ci/cd workshop would be really useful for you to get your head around the flow. You don't need to know JavaScript particularly well to do it.

lbraymusso
2020-05-15 02:56
hey, i'm trying to get a sense for the `pact_mock_service` tool's capability and am curious if there's a way to extend its usage to a more generic service-mocking capability. in other words, would teams that don't yet have interest in using pact for contract testing still be able to use the mock service in order to (temporarily) spin up a dependent service for their local dev environment?

uglyog
2020-05-15 03:10
You can, but you will have to configure it with Pact files. However, the mock server is strict and will only return results if they match what is in the pact files.

uglyog
2020-05-15 03:12
For a more lenient mock server, the https://github.com/pact-foundation/pact-stub-server was created for Android developers to be able to continue prototyping their app without having to create the backend services. You could try that.

lbraymusso
2020-05-15 05:02
got it, that makes sense. and thanks! i'll check `pact-stub-server` out as well :slightly_smiling_face:

tjones
2020-05-15 05:17
How is everyone doing their version numbers for Pact? Are there commonalities, and would automatically picking up versions be something we could generally do? I?m thinking of making a tool (or option) for PactJS which does nice Pact versions for you if you?re using semver on git tags - this is a very common pattern in javascript land, but what about elsewhere?

matt.fellows
2020-05-15 05:18
I generally do `<package version>.<short git sha>`

matt.fellows
2020-05-15 05:18
e.g. `1.6.34-fc0026d`

tjones
2020-05-15 05:19
I do this: `1.2.0-master+1.e03b40b`

tjones
2020-05-15 05:20
(when not on an exact tag, it tells you branch and the number of commits past the full tag)

matt.fellows
2020-05-15 05:20
interesting


tjones
2020-05-15 05:21
Going to write a blog to accompany this one day

tjones
2020-05-15 05:21
The thing that?s nice about this is that it?s possible to reason about how far past the package version you are

bethskurrie
2020-05-15 05:57
I thought the official semver format was to put a plus symbol for anything after the M.m.p?

bethskurrie
2020-05-15 05:57
Rather than a dash.

matt.fellows
2020-05-15 06:00
Yeah that?s not semver, but is it suppposed to be?

matt.fellows
2020-05-15 06:02
Actually I lie, it is valid semver, but it denotes it as a prerelease: https://semver.org/#spec-item-9

bethskurrie
2020-05-15 06:04
From memory, anything after the plus is just metadata, and not considered part of the ordering.

matt.fellows
2020-05-15 06:06
If the tags need to be semver compatible and represent reality (e.g. master is probably not a prerelease) then I?d swap the hyphen and `+` around in Tim?s example

matt.fellows
2020-05-15 06:06
But I?ve never come across anything IRL that?s needed that when it comes to Pact specific stuff. The commit sha usually gets me to where I need to get

bethskurrie
2020-05-15 06:07
"Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Build metadata MUST be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85."

bethskurrie
2020-05-15 06:07
Basically, anything after the plus is whatever you want.

bethskurrie
2020-05-15 06:08
I like Tim's format, but yes, I'd replace the dash with a plus to make it sem ver compatible.

jacek.okrojek
2020-05-15 07:43
Hi Beth

jacek.okrojek
2020-05-15 07:45
does Pact Foundation/PactFlow support commercialy organizations that would like to introduce CDC Tests

jacek.okrojek
2020-05-15 07:45
?

mike.geeves
2020-05-15 07:51
It's the how this fits e2e in the development flow, e.g. re the can-i-deploy / verifier, I might want to know if the provider and consumer aren't compatible (and so prevent a master merge of a feature branch and deploy to the QA environment), but for the Dev environment it's maybe fine to deploy anyway :thinking_face: Morning again in the UK so I'll start going through the links properly :) Thanks!

matt.fellows
2020-05-15 07:58
Morning!

matt.fellows
2020-05-15 07:58
Well, you can certainly do that using the tools discussed. Definitely worth doing that workshop

bethskurrie
2020-05-15 08:19
If you're using PRs to merge your branches, you can use commit statuses sent via webhooks to make sure your branch is ready to merge.


hans.brouwer
2020-05-15 08:35
Hi, has any one experience with Kafka message CDC testing? I'm trying, though I got stuck. The scalapact library seems only to support HTTP call testing.

wesleythomaswilliams
2020-05-15 08:36
Yes, but using Java.

hans.brouwer
2020-05-15 08:37
If any one has an example while using Scala and Kafka CDC I would be very happy to receive it. @wesleythomaswilliams, if I can have a simple example of your setup it might help me as well.

hans.brouwer
2020-05-15 08:37
In the end, Scala is running java too.

wesleythomaswilliams
2020-05-15 08:38
Sure, let me see if I can whip up a dummy version of what I have with all the business related junk stripped out.

matt.fellows
2020-05-15 08:38
Yep, don't think scalapact supports in. Pact JVM definitely does and kafaka was one of the first use cases I'd u recalls

wesleythomaswilliams
2020-05-15 08:39
Btw, I assume you've seen the example in the pact-jvm repo?

matt.fellows
2020-05-15 08:39
And as always, the community beats me here! :laughing:

hans.brouwer
2020-05-15 08:39
Yeah, I found that one. But didn't get it working

hans.brouwer
2020-05-15 08:40
(yet)

mike.geeves
2020-05-15 08:40
I have a feeling you may have already dealt with a lot in the upcoming WIP functions :thinking_face:

bethskurrie
2020-05-15 08:40
Yes. These are available to pact-python.

bethskurrie
2020-05-15 08:41
Are you using the OSS broker or Pactflow?

mike.geeves
2020-05-15 08:41
OSS


bethskurrie
2020-05-15 08:41
You'll need to turn the feature on in the Broker.

hans.brouwer
2020-05-15 08:41
Especially as the example is using an older version and some of the calls (including their parameter list) are changed. (eg. PactMessageBuilder vs MessagePactBuilder) I was trying to use the 4.0.10 library in combination with Scala 2.13

mike.geeves
2020-05-15 08:41
:+1:

bethskurrie
2020-05-15 08:42
This will also enabled "pending pacts"

mike.geeves
2020-05-15 08:42
Awesome, thanks :)

bethskurrie
2020-05-15 08:43
Something to note is that can-i-deploy is also "can i merge". eg. if you ran `can-i-deploy --to test` from a branch of your consumer, the results would tell you whether or not you were safe to merge, because it would mean that the API was supported in the test environment already.

mike.geeves
2020-05-15 08:43
Also, big thanks, you're very reactive :) I was expecting much quieter!

bethskurrie
2020-05-15 08:44
I just happen to be on my laptop right now!

bethskurrie
2020-05-15 08:44
Usually I'm asleep when anybody needs me (being in Australia!)

matt.fellows
2020-05-15 08:45
If you wanted to spike quickly, just sign up to a dev acct a http://Pactflow.io

mike.geeves
2020-05-15 08:45
Yeah, we've been looking at that. There's a lot to take in :)

mike.geeves
2020-05-15 08:50
I'm picking up from a colleague who started looking at it, she has the broker/consumer/provider all setup, I'm just looking at the what next and stealing the glory! (not really)

bethskurrie
2020-05-15 08:58
Btw, I don't think you mean to have "also send to general" turned on.

bethskurrie
2020-05-15 08:59
All your chats are turning up in the main thread.

mike.geeves
2020-05-15 09:01
Information share? We try to tick it on threads in our slack so other people can find and you don't have to repeat. I spend a lot of time repeating :p happy to not tick, wasn't sure preferred practices on here

bethskurrie
2020-05-15 09:01
We try to keep conversations in threads, so as not to spam people in general.

mike.geeves
2020-05-15 09:02
:+1:

bethskurrie
2020-05-15 09:02
If it's a generally useful comment, we might tick it, but if it's discussing stuff that's only relevant to the people in the conversation, we keep it unchecked.

mike.geeves
2020-05-15 09:03
Apologies for the noise :p

mike.geeves
2020-05-15 09:06
(no offence taken to deleting the noise!) Meanwhile, I'll get back to reading

hans.brouwer
2020-05-15 09:28
@wesleythomaswilliams, thanks! I will have a look!

tjones
2020-05-15 16:04
Off the topic of the main question, but the intention of my script was to match semver correctly - as in, anything that isn?t a release is a pre-release. `master` is printed because it?s not a released version.

tjones
2020-05-15 16:07
Only from the perspective of version preference. It?s defined as dot separated

tjones
2020-05-15 16:07
Yep :slightly_smiling_face:

arindam.datta
2020-05-15 16:37
is there any library in .net for message contract testing for event driven communication between services?

matt.fellows
2020-05-15 22:40
There is a branch that's I think close to merging

matt.fellows
2020-05-15 22:40
I know some people here use it

matt.fellows
2020-05-15 22:41
But not merged in to master yet

raghu.alapati1
2020-05-16 00:07
has joined #general

bethskurrie
2020-05-16 01:33
I'm just going through the "pact nirvana" pages, and updating them. During the initial set up, we don't reference tags at all - the initial pact gets published with no tags, and the initial verification set up just verifies the latest pact. Then in the next step, we add the tags to both sides. Would it make more sense to just set the tags from the beginning? I had done it in two parts so as to introduce as few concepts at the same time as possible, but I wonder if it's just easier to start with the tags already there. I'd love to hear from anyone who has gone through this for the first time recently.

mike.geeves
2020-05-16 07:50
Could you include both and explain the consequences? I mean show the simplest example as well as with tags, then in the later can-i-deploy section you could refer back to the two and what having the -to or not means I agree fewer concepts / flags can be simpler, but generally find it's ok as long as there's at least and explanation of the difference if the optional ones weren't there

bethskurrie
2020-05-16 08:03
I would never set up a pipeline without the tags.

bethskurrie
2020-05-16 08:03
It's not so much that it's optional - it's whether to do it in one hit, or two steps.

mike.geeves
2020-05-16 08:53
What about branch vs env tags?

mike.geeves
2020-05-16 09:18
Imo, if it's completely non-optional, it's confusing to suggest it as an example isn't it?

bethskurrie
2020-05-16 09:32
Yes, that's my quandary.

mike.geeves
2020-05-16 09:46
I find often (general tutorials rather than pact specifically) that it's a bit like science at school, you have the intro to "this is what an atom is like". Then two years later "actually that wasn't quite true we simplified it because it's complicated, it's like this..". Repeat. :joy: "tags aren't strictly needed here, but are useful because x and will be explained in more detail later, for the impatient, <here> ?

matt.fellows
2020-05-16 10:05
I'd say in that Nirvana case, just state how it should be in the end game

matt.fellows
2020-05-16 10:06
Tutorials and other workshops can teach the concepts. I think the Nirvana guide should simply be "this is where you're aiming"

luis.con-garza
2020-05-16 17:44
has joined #general

kameda.sbng
2020-05-17 02:33
has joined #general

mramos
2020-05-17 12:28
Hi, when trying to publish pacts in PactFlow, I got this error: Could not publish pact: Error making request - OpenSSL::SSL::SSLError SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed Can anyone advise please? Thanks.

mike.geeves
2020-05-17 18:47
Just to confirm, that's the hosted PactFlow rather than your own broker with a self signed cert? (I haven't used PactFlow, but for self hosted it looks like there are a couple of steps to use your own cert)

matt.fellows
2020-05-17 23:08
It?s pretty clear that you?re communicating to a server with a self-signed certificate, as Mike says

matt.fellows
2020-05-17 23:42
> To connect to a Pact Broker that uses custom SSL cerificates, set the environment variable `$SSL_CERT_FILE` or `$SSL_CERT_DIR` to a path that contains the appropriate certificate.

upgundecha
2020-05-18 03:57
Hi, I am currently implementing Pact-JVM for a Spring Boot application. I?m new to Spring boot architecture. We have an interaction which requires an auth token. How do we setup a provider verification API which requires an auth?

bethskurrie
2020-05-18 03:58
Read the docs under Verifying Pacts on http://docs.pact.io

bethskurrie
2020-05-18 03:58
There's a page on auth


upgundecha
2020-05-18 04:00
Thanks, I can see reference to Request filter but the link is broken


bethskurrie
2020-05-18 04:01
Have you tried googling it?

upgundecha
2020-05-18 04:01
I did but there is no clear doc or examples that I can refer

upgundecha
2020-05-18 04:01
There are many vanilla examples

upgundecha
2020-05-18 04:02
None talk about handling auth

bethskurrie
2020-05-18 04:02
I mean, the broken page

bethskurrie
2020-05-18 04:02
Did you read the page I just sent?

upgundecha
2020-05-18 04:02
yeah, I did search for broken link on google

bethskurrie
2020-05-18 04:03
Ask on the #pact-jvm-help channel

bethskurrie
2020-05-18 04:03
But also, read the docs page on auth


bethskurrie
2020-05-18 04:03
That link looks identical

upgundecha
2020-05-18 04:04
Anyway thanks

upgundecha
2020-05-18 04:04
Thanks @uglyog

bethskurrie
2020-05-18 04:04
I can't see what's different!

upgundecha
2020-05-18 04:04
@uglyog can we set the request filter for specific endpoints only?

uglyog
2020-05-18 04:05
```tree/master/pact-jvm-provider-gradle tree/master/provider/pact-jvm-provider-gradle```

uglyog
2020-05-18 04:06
The urls will change again when 4.1.0 is released

upgundecha
2020-05-18 04:07
ok

uglyog
2020-05-18 04:07
@upgundecha Pact doesn't deal with endpoints, it deals with providers and consumers. You can either setup different endpoints as different providers, or have your callback filter on the path of the request

abubics
2020-05-18 04:14
@bethskurrie The broken one is missing `provider/` after `master/` :innocent:

bethskurrie
2020-05-18 04:15
Ah, right.

bethskurrie
2020-05-18 04:15
I've put a reminder for me to update it

upgundecha
2020-05-18 04:23
@uglyog can you help me with an example of callback filter on path of the request?

uglyog
2020-05-18 04:28
I don't have any examples like that, but it will be a simple if statement ```if (request.getRequestLine().getMethod() == "/path/needing/auth") {```

upgundecha
2020-05-18 10:10
Thanks so much @uglyog that was super easy. Got the verification running smooth. Really appreciate your help

mike.geeves
2020-05-18 11:44
I'd add, there's not really a "good" reason anymore to not just use something like let's encrypt, which: handles the certificate creation for you, can be setup to auto renew, and doesn't cost anything I've found a lot less headaches with software and so a lot less work overall not having to "work round" self signed certs: https://letsencrypt.org/ Out of scope for pact but worth a look if you haven't tried already

kumarkrish85
2020-05-18 12:14
has joined #general

matt.fellows
2020-05-18 12:24
Let's encrypt is awesome Mike - happy for you to respond to the next ticket raised by someone who works in an enterprise with their own CA :laughing:

preethighalke
2020-05-18 13:11
Hi, I was trying to run the pact-mock-server on Mac V 10.15 which does not have ruby installed. when I execute the command ./pact-mock-service --help start its shows the error : /pact/lib/ruby/bin/ruby: line 6: /pact/lib/ruby/bin.real/ruby: No such file or directory I do not see the ruby folder under "bin.real" $ ls bundle irb puma rake thin bundler nokogiri pumactl redcarpet unicorn gem posix-spawn-benchmark rackup redcloth unicorn_rails am I missing something, I was following the instructions mentioned at https://github.com/pact-foundation/pact-ruby-standalone/releases/tag/v1.84.0. Any inputs will be helpful. Many Thanks.

matt.fellows
2020-05-18 13:33
You don't need Ruby installed, so that should be fine

matt.fellows
2020-05-18 13:34
How have you installed it? Have you just extracted the contents into something like /opt/pact ?

matt.fellows
2020-05-18 13:35
Can you also confirm you've downloaded the Mac specific version?

preethighalke
2020-05-18 13:37
Hi Matt, installed pact-1.84.0-osx.tar.gz version thats the only version provided at the link.

preethighalke
2020-05-18 13:38
I just extracted the contents into a folder and tried executing the command

chris.dopler
2020-05-18 14:11
has joined #general

robert.strauch_slack
2020-05-18 21:24
has joined #general

adam.strickland
2020-05-18 21:25
@bethskurrie I?m interested in using `pact-message-ruby` for a ruby messaging consumer. if i can help in any way, please lmk

bethskurrie
2020-05-18 22:53
We often see this error when people are running it within a docker container that doesn't have certain libraries available @preethighalke

bethskurrie
2020-05-18 22:55
@preethighalke can you raise an issue in the pact-ruby-standalone repo with exactly the commands you used?

bethskurrie
2020-05-18 22:57
@preethighalke are you running it in a bash shell? https://github.com/pact-foundation/pact-js/issues/305

preethighalke
2020-05-19 01:03
Thanks @bethskurrie I'm using the default Mac Os shell provided by its terminal which looks to be bash. will raise an issue. Regards. $ echo $SHELL /bin/bash $ ${SHELL} -version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19) Copyright (C) 2007 Free Software Foundation, Inc.

preethighalke
2020-05-19 01:27

ashish_garg5
2020-05-19 11:52
Hi, I am able to publish the provider version in pact broker using -Dpact.provider.version=0.0.1.

ashish_garg5
2020-05-19 11:53
wanted to know if there is any way so it can automatically read from the pom.xml

wesleythomaswilliams
2020-05-19 12:01
@ashish_garg5 ```<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <systemPropertyVariables> <pact.provider.version>${pact.provider.version}</pact.provider.version> </systemPropertyVariables> </configuration> </plugin>``` We use the surefire plugin to set SystemPropertyVariables for our provider tests to use.

ashish_garg5
2020-05-19 12:02
@wesleythomaswilliams - thanks Wesley, let me add this and try

ashish_garg5
2020-05-19 12:12
Its publishing now thanks @wesleythomaswilliams :slightly_smiling_face:

jacek.okrojek
2020-05-19 13:26
Hi @bethskurrie @matt.fellows

jacek.okrojek
2020-05-19 13:27
do you have any recommendations when it comes to hardware for PactBroker ?

rafael.negron
2020-05-19 15:30
Hello Pact! In order for me to call my provider server, I need to be able to provide authorization headers. Is this possible to do via the provider states server? For example: 1. Provider reads Pact file. 2. Provider makes call to `provider-states` server to setup state. 3. `provider-states` server proxies call (with headers) to real server. 4. Results returned to Provider to `Verify` Please let me know if you all have any questions I can help clarify. Thanks!

wesleythomaswilliams
2020-05-19 15:35

sairsule
2020-05-19 15:35
has joined #general

sairsule
2020-05-19 15:44
In what language shall I try Pact? Considering I am comfortable with Java and JavaScript. and I know Python and Go.

elliottmurray
2020-05-19 15:44
If you are just trying to get the concepts stick with what you are comfortable with

elliottmurray
2020-05-19 15:44
But Java and Javascript are 2 of the most popular and best supported

elliottmurray
2020-05-19 15:44
So you won?t go wrong with either of those.

sairsule
2020-05-19 15:44
I am asking in terms of ease of use and community support.

sairsule
2020-05-19 15:45
thanks @elliottmurray

wesleythomaswilliams
2020-05-19 15:45
I would write it in whatever language your consumer/provider are written in.

elliottmurray
2020-05-19 15:45
You could do a consumer in one and a provider in another if you want to really :muscle:

sairsule
2020-05-19 15:45
:slightly_smiling_face:.

sairsule
2020-05-19 15:46
@wesleythomaswilliams, Is it necessary to write in the language that consumer/provider are written in?

sairsule
2020-05-19 15:48
Is it necessary to write in the language that consumer/provider are written in?

sairsule
2020-05-19 15:48
or is it possible to write Pact tests in other languages. (other than what consumer and providers are written into)

sairsule
2020-05-19 15:49
or is it possible to write Pact tests in other languages. (other than what consumer and providers are written into)

wesleythomaswilliams
2020-05-19 15:49
Not sure, but my contract tests live in the same repositories as the consumer/provider service code and this also allows me to take advantage of using actual product code for contract verification and lean on development engineering expertise if I need it.

mike.geeves
2020-05-19 15:49
The language shouldn't matter, the idea is thouse are decoupled so you shouldn't have problems

elliottmurray
2020-05-19 15:49
It is possible for the Provider but not sure I would

elliottmurray
2020-05-19 15:50
Especially in those first 2 you get a lot of support

wesleythomaswilliams
2020-05-19 15:50
It also means I can get development engineers involved in writing and maintaining contract tests easier.

mike.geeves
2020-05-19 15:50
So a consumer in one language can create the pact definition, push up to a broker, and then a provider in another language perform the verification

sairsule
2020-05-19 16:26
Thanks @mike.geeves. Thanks @wesleythomaswilliams. this is really helpful

koen.roevens
2020-05-19 16:38
has joined #general

bethskurrie
2020-05-19 20:52
@rafael.negron no, but you can write your own proxy server


matt.fellows
2020-05-19 22:55
> Is it necessary to write in the language that consumer/provider are written in? In case it?s not clear from above, yes, you should write the tests in the language of the consumer or the provider you?re testing. There are exceptions to this rule, but until you have a full grasp of Pact it?s not worth discussing

matt.fellows
2020-05-19 22:58
:point_up:

rkhemlani1
2020-05-20 03:59
has joined #general

rkhemlani1
2020-05-20 05:01
Hello, Has anyone had any luck with verifying the pact file on the Provider side when provider is an Azure Function App application ? Since Azure Functions don't really have a "startup.cs" associated with them, I am not able to verify the interactions without having to run two instances of the provider app - the actual server instance (in debug mode) and the unit test instance, which is not the right way. Many thanks

tjones
2020-05-20 05:02
I haven?t had any experience with Azure, but with AWS Lambdas you can either use aws localstack (there may be an equivalent), or test against a test deployment

tjones
2020-05-20 05:03
If there are provider states, you?ll usually want to start the provider in a way that exposes the state change endpoints

bethskurrie
2020-05-20 06:05
A neat little trick that @tjones showed me was to make the lambda functions agnostic about how they were being hosted, so the function could be called via a little express api.

bethskurrie
2020-05-20 06:05
I like this technique a lot, as testing the invocation of cloud functions without the cloud can sometimes be tricky, and is, I think, a step backwards for testability.

dattasai.chunduru
2020-05-20 07:24
has joined #general

antonello
2020-05-20 08:06
Is pending pacts still considered in beta?

melgaer
2020-05-20 09:38
has joined #general

melgaer
2020-05-20 09:39
Hey guys. Im stuck with https://github.com/pact-foundation/pact-go/issues/128 Matt mentioned that there could be some workaround. What it could be?

mike.geeves
2020-05-20 10:18
Happy dance! Just demo'd where I'm up to with pact: broker / 2x consumer / 2x provider / CI pipelines -> adding to consumer -> failing verification -> adding to provider -> pass and deploy. And the live demo didn't fail horribly :smile: Positive feedback and understanding even from non-tech upper management and qa. Thanks, you are awesome (@ pact people) :smile: But now I need a nap

thinh.tranquoc
2020-05-20 10:40
has joined #general

dattasai.chunduru
2020-05-20 10:54
Hi All

dattasai.chunduru
2020-05-20 10:55
I am very new to Contract testing and want to know how to start it and undrstand the PACT with Java usage , I am having a bit knowledge in Java as I am a Selenium Automation engineer

wesleythomaswilliams
2020-05-20 10:56
Hi Datta, first thing to know... Junit 4 or 5 (or something else) Are you using Spring? Maven or Gradle (or something else)

wesleythomaswilliams
2020-05-20 10:57
And there's a dedicated channel for the java side of things #pact-jvm-help

matt.fellows
2020-05-20 11:04
FWIW the use of ports+adapters or clean architecture is one way of enabling this. See slide 40 and beyond for a discussion on how I tend to do this: https://www.slideshare.net/DiUSComputing/aws-workshop-trends-and-development-practices-in-serverless-architectures

matt.fellows
2020-05-20 11:05
Awesome to hear!

ashish_garg5
2020-05-20 11:06
Hi All, I want to combine my GET and POST request. return builder .given("create inventory").uponReceiving("a request to save inventory").path("/api/inventory") .body(requestBody).method(RequestMethod.POST.name()).willRespondWith().headers(headers).status(200) .body(responseBody) .toPact(); return builder .given("get inventory").uponReceiving("a request to get inventory").path("/api/inventory").method("GET") .willRespondWith().headers(headers).status(200).body(responseBody) .toPact(); right now i have these 2 in different files if i am combining i am getting error.

matt.fellows
2020-05-20 11:06
Please ask in -> #pact-jvm-help Ashish

ashish_garg5
2020-05-20 11:08
ok sure

matt.fellows
2020-05-20 11:08
Hi Tomasz, apologies, I?ve been sidetracked with other things the past couple of weeks - it is the top of my OSS list

matt.fellows
2020-05-20 11:08
I think I know where the problem is, but it needs refactoring

matt.fellows
2020-05-20 11:08
If I can prove it?s the issue, I will then have a concrete next step

matt.fellows
2020-05-20 11:09
a) refactor current implementation (if it?s not a huge effort) b) implement the rust interface (strategic direction)

melgaer
2020-05-20 11:10
Hi Matt. Good to hear it got in "top of your backlog" now :slightly_smiling_face:.

matt.fellows
2020-05-20 11:11
To be honest, it was already there from an OSS perspective. Unfortunately there are other priorities for day job stuff. I?d say early next week I?ll be able to re-visit

melgaer
2020-05-20 11:12
Its not easy now, when its harder to separate day-work stuff from off-work stuff being whole time in the same place :slightly_smiling_face:.

melgaer
2020-05-20 11:12
Great.

melgaer
2020-05-20 11:13
ETA is what I need for now.

matt.fellows
2020-05-20 11:14
If I don?t get back to you by Tuesday next week, please @ me as a reminder. you have my blessing! I know it must be frustrating

melgaer
2020-05-20 11:16
Its more concerning than frustrating as it disables core banking pact tests.

melgaer
2020-05-20 11:16
I will.

dattasai.chunduru
2020-05-20 12:07
I am using TestNG and Maven

dattasai.chunduru
2020-05-20 12:08
In our Project we have to do Automation by using Junit 5

dattasai.chunduru
2020-05-20 12:08
and Maven for adding dependencies

wesleythomaswilliams
2020-05-20 12:08
Ok cool, any use of Spring?

dattasai.chunduru
2020-05-20 12:08
I think Developers are using SPRING

dattasai.chunduru
2020-05-20 12:10
now as TESTERS we have to do contract Testing by using PACT

wesleythomaswilliams
2020-05-20 12:10
Ok, then it sounds like you're living in the same world as I am with my contract testing. Are you wanting to test REST API or Messaging contracts?

dattasai.chunduru
2020-05-20 12:11
REST API's

dattasai.chunduru
2020-05-20 12:12
I don't know what is Messaging Contracts

dattasai.chunduru
2020-05-20 12:12
:disappointed:

wesleythomaswilliams
2020-05-20 12:13
If you had a consumer and a provider and rather than the consumer hitting a provider REST API with a GET request etc. There's something like Kafka in the middle of the two that the provider posts messages to and the consumer retrieves messages from. Just a different way for microservices to communicate.


wesleythomaswilliams
2020-05-20 12:17
One of the trickiest parts for me was configuring my POM for both my consumer and provider and you'll also want a good understanding of your build pipeline, to work out how to best integrate the contract tests once you've written them.

dattasai.chunduru
2020-05-20 12:20
This GITHUB Project is having any example to get some understanding coz what ever I am trying to google everything is about PACT Tehory :disappointed: and now the client is expecting us start TESTING and none of us have an IDEA on this :disappointed:

wesleythomaswilliams
2020-05-20 12:21
Main thing, don't stress out about it. Pact can be a little complicated to understand initially, but you'll get there. The github projects have examples and there's a workshop which is probably linked from the docs.

dattasai.chunduru
2020-05-20 12:26
Thank you for your Help and immediate responses. I have small query PACT is also like API Testing Like we will send request and will get response . I understood that there will be a MOCK Consumer and it will take the response

wesleythomaswilliams
2020-05-20 12:49
Yeah, the goal with Pact is to allow you to test both your consumer and your provider in isolation. Hopefully the docs will make that clear.

lankala321
2020-05-20 13:57
has joined #general

matt.fellows
2020-05-20 23:09
:raised_hands: Just wanted to get a shout out to @wesleythomaswilliams who has been answering questions like a mad man. Thanks for being so helpful!!

bethskurrie
2020-05-20 23:09
Thanks @wesleythomaswilliams!

wesleythomaswilliams
2020-05-20 23:23
That's very kind! Glad to be able to help.

matt.fellows
2020-05-20 23:39
Data, I also wanted to make sure that as a Tester if you?re writing Pact tests you will need full access to the code you?re testing (whether on the consumer or provider side)

matt.fellows
2020-05-20 23:39
e.g. tools like Postman will work from ?the outside? perspective, but Pact doesn?t work like this

matt.fellows
2020-05-21 00:16
(Also, sorry for calling you Data! I?m going to blame auto-correct, but I think it was just my fingers)

ravi.mijar
2020-05-21 05:01
has joined #general

ashish_garg5
2020-05-21 10:37
Hi All, Wanted to know where are the PACT/Contract files get stored when published to pact broker ? Thanks.

arindam.datta
2020-05-21 10:47
@bethskurrie any plan to merge the message-pact branch of the https://github.com/pact-foundation/pact-net repo in near future? asking you as you are one of the contributors.

bethskurrie
2020-05-21 10:51
Sorry, I don't actually know any .net!

bethskurrie
2020-05-21 10:52
I maintain the underlying Ruby implementation.

bethskurrie
2020-05-21 10:52
You'll need to ask whoever was working on that branch.

arindam.datta
2020-05-21 10:53
ah ok.. thanks!

bethskurrie
2020-05-21 10:53
@ashish_garg5 they get stored in a relational database. Generally postgres, though it does support mysql too.

arindam.datta
2020-05-21 10:54
Hi @neil , hope you can answer this question :arrow_up:

ashish_garg5
2020-05-21 11:01
@bethskurrie Thanks :+1:

matt.fellows
2020-05-21 12:50
Might be worth checking in the actual issue/PR. We could really do with some help getting the PR into the main project

mike.geeves
2020-05-21 15:08
Probably one of those "you shouldn't really need to look", but for info they're in the pact_versions table, for example:

neil
2020-05-21 23:59
The issue is not in merging, that?s the easy part, the branch was never fully finished

neil
2020-05-22 00:00
@arindam.datta Are you interested in helping finish off the branch? https://github.com/pact-foundation/pact-net/blob/message-pact/TODO.txt

hello
2020-05-22 04:40
has joined #general

bethskurrie
2020-05-22 06:00
Is it hexagonal @matt.fellows? :P

preethighalke
2020-05-22 06:00
Hi, how can one verify an interaction which takes query parameters using the pact-mock-service? I have an interaction defined which is GET request with query parameters. I could POST the interaction, but when i try to verify it using curl -H "X-Pact-Mock-Service: true" localhost:1234/interactions/verification it says the interactions do not match, need inputs. Also a reference example with query params would help. Regards

matt.fellows
2020-05-22 06:01
I prefer dodecahedrons

bethskurrie
2020-05-22 06:01
You probably need to set the query parameters separately in the expectation.

bethskurrie
2020-05-22 06:01
don't put them on the end of the path, set {query: '...'}

matt.fellows
2020-05-22 06:01
6 sides is just not enough

matt.fellows
2020-05-22 06:02
Also, may I ask why you are directly interacting with the mock service? What?s your use case?

bethskurrie
2020-05-22 06:02
It looks like you're doing something unusual though - the documentation should explain that.

preethighalke
2020-05-22 06:09
@bethskurrie Thanks for the response, its working fine at my end now.

matt.fellows
2020-05-22 06:10
Preethi - can we ask why you?re using the mock service directly?

preethighalke
2020-05-22 06:11
@matt.fellows Right now we are just exploring on how to use the mock service and if it can be used to mimic instead of using of our actual provider instance.

matt.fellows
2020-05-22 06:15
interesting.

preethighalke
2020-05-22 06:15
we want to see if we can use the Mock service as part of the consumer Functional verification tests which mimics the actual provider interactions instead of actually pointing to the provider instance

matt.fellows
2020-05-22 06:15
Is this for front end end-to-end type testing with tools like Selenium, Cypress?

matt.fellows
2020-05-22 06:16
gotcha

preethighalke
2020-05-22 06:16
its pure backend microservice to microserice for now

matt.fellows
2020-05-22 06:16
Is there a reason why you wouldn?t still write the contract tests first? This way you?re ensuring your client/consumer code works correctly, and then you can use the contracts with the pact stub server (it will take a pact file, and produce a mock server with the interactions from it)


preethighalke
2020-05-22 06:18
right i was planning to explore the stub service next, just wanted to see how the mock service works and the tradeoff's

matt.fellows
2020-05-22 06:23
the mock server is unlikely to be the right tool for the job you?re talking about, because it?s stateful and has other behaviour associated with it you don?t need. The stub service seems much more useful

matt.fellows
2020-05-22 06:24
I?d still suggest writing the Pact tests. This way, any functional tests you use with those contracts (that are then used as the stub source) will be guaranteed to be correct, because you will get the provider to verify it. You could then look to remove any end-to-end tests you have, because Pact has verified the contract

preethighalke
2020-05-22 06:26
I see, sure . Thank you for the valuable suggestions will get back.

rajeesudh
2020-05-22 07:44
HI @matt.fellows, @krishnam.misc ... I am not able to set { "Content-Type", "application/json;charset=utf-8" } in response header ... any idea how this can be set in ConsumerTest, for .WillRespondWith()

ashish_garg5
2020-05-22 07:44
Hi All, Is there any convention for the package where contract test files will reside ?

tjones
2020-05-22 07:45
Do you mean the pact file, or the tests?

bethskurrie
2020-05-22 07:45
They're generally unit tests for the client class.

ashish_garg5
2020-05-22 07:45
i mean tests

ashish_garg5
2020-05-22 07:46
ok thanks @bethskurrie

matt.fellows
2020-05-22 07:48
what have you tried? What language? The examples above definitely show setting headers

rajeesudh
2020-05-22 07:48
HI All, I am using .net core to do Contract testing, I am stuck in an issue where I need to set the Header with Content-Type . WillRespondWith() in the Consumer test, { Status = 200, //con.setRequestProperty("Content-Type", "application/json; charset=utf8") Headers = new Dictionary<string, object> { { "Content-Type", "application/json;charset=utf-8" } },

rajeesudh
2020-05-22 07:48
Errror that I get is

matt.fellows
2020-05-22 07:52
That?s a provider test result, and the provider seems to be sending the header you?re talking about

matt.fellows
2020-05-22 07:52
it?s complaining because the states code is not 200 and the body isn?t matching

rajeesudh
2020-05-22 08:00
Oh ok, let me sort the body and check again , Thanks @matt.fellows

arindam.datta
2020-05-22 08:38
Hi @neil, thanks for your reply. I have some other pressing priorities, so I wouldn't make any false commitment about contribution.

dom.udall
2020-05-22 09:57
has joined #general

rajeesudh
2020-05-22 09:58
Aah, still cant figure out whats going wrong

bethskurrie
2020-05-22 09:59
Can you see the actual response in there?

rajeesudh
2020-05-22 09:59
I am not sure why I am getting different status code, because when I see it in postman, it looks fine

bethskurrie
2020-05-22 10:00
There's been an error. I'd look in your application log

rajeesudh
2020-05-22 10:00
just trying to do a simple test against this api


bethskurrie
2020-05-22 10:02
You can see the exact request being sent in the pact log.

matt.fellows
2020-05-22 10:11
Also please share your pact file

matt.fellows
2020-05-22 10:12
I can hit that endpoint in a browser so I'm guessing you've got the wrong ot fix it something

matt.fellows
2020-05-22 10:12
I also easily produced that same error

rajeesudh
2020-05-22 10:47
Thats the constract

rajeesudh
2020-05-22 10:49
Cant see anything in logs

matt.fellows
2020-05-22 10:52
The path is missing the v2 prefix is my guess. What's your provider setup code look like?

rajeesudh
2020-05-22 10:53
new PactVerifier(config) .ServiceProvider("EmployeeList", "http://dummy.restapiexample.com/api/v1") .HonoursPactWith("Consumer_1") .PactUri(@"C:\POC - Contract testing - Pact\COntractTesting_DummyRestApi\pacts\consumer_1-employeelist.json") .Verify();

rajeesudh
2020-05-22 11:14
@matt.fellows @bethskurrie any idea?

matt.fellows
2020-05-22 11:25
yes. I just tried hittinsg that rest api using curl. It doesn?t work, I would find another solution (e.g. postman echo)

matt.fellows
2020-05-22 11:26
The site is basically spam

matt.fellows
2020-05-22 11:26
http://dummy.restapiexample.com/api/v1/employee/2 but in a browser it works. I think you need an active session. I?m not going to waste my time debugging that, and neither should you :slightly_smiling_face:

rajeesudh
2020-05-22 11:27
Oh ok.... gotcha

rajeesudh
2020-05-22 11:27
Cool, Thanks @matt.fellows

matt.fellows
2020-05-22 12:51
Hi Jacek - just saw your email

matt.fellows
2020-05-22 12:51
Happy to chat, I just replied now

zeldigas
2020-05-22 17:38
has joined #general

nickj21
2020-05-22 18:33
has joined #general


mike.geeves
2020-05-23 12:37
:thinking_face: slightly fluffy question, I'm wondering about the general pact usage. Does anyone know if "most people" use it mostly for positive tests, i.e. the expect some data coming back, or also to verify expected error handling behaviour? We are working on creating a new set of services for a new product and I'm wanting to try and get pact usage in there from the start. Part of it around making sure different services adhere to conventions (vs everything errors slightly differently) I would expect the FE consumers probably wouldn't care about handling all edge cases and so on, and wouldn't want to lose "test coverage" if the consumer "stopped caring"and removed them later I'm thinking maybe the providers need some pseudo consumer that the BE team would own to cover it, ideally with some sort of discovery and scraping endpoints to fill in gaps automatically Just wondering if there are better suggestions / that would be considered an anti pattern / nobody really tries to do that

zeldigas
2020-05-24 09:42
Hello, could anyone comment on the plans regarding this missing matching rule for array element presence - https://github.com/pact-foundation/pact-specification/issues/38 I feel that I there are use cases that that make PACT almost unusable in terms of contract - some hypermedia formats actively use lists (e.g. Siren), so I have no idea how to do assertion on links presence

matt.fellows
2020-05-24 23:22
> I?m thinking maybe the providers need some pseudo consumer that the BE team would own to cover it, ideally with some sort of discovery and scraping endpoints to fill in gaps automatically I?ve seen people do this. It can be useful for a bunch of reasons, but personally you could still write provider-side functional tests that cover all of the consistent behaviour you expect - e.g. error codes, metadata, standards etc.

matt.fellows
2020-05-24 23:24
I think the general sentiment is that we want to support it, but to get it into all languages will take some time

matt.fellows
2020-05-24 23:24
what language do you need it in first?

matt.fellows
2020-05-24 23:24
Perhaps raise it https://pact.canny.io/ and see if others need it too? we?ve found Canny is a great place to help us prioritise features

abubics
2020-05-25 01:14
The usual approach I see is basically as you describe: ? mostly positive tests (because they're the most interesting and varied), ? plus specific unique negative interactions, and then ? a sprinkling of generic negative tests (they should be consistent across all endpoints).

zeldigas
2020-05-25 06:23
I need for Java as the first priority, then C++, python and JS (with no specific order)

zeldigas
2020-05-25 06:24
In general if design question is closed, I'm ready to contribute to JVM part

matt.fellows
2020-05-25 06:26
@uglyog thoughts?

zeldigas
2020-05-25 06:27
Also, maybe strange and somewhat destructive desire, but still - is there any options for custom extensions? Say finalizing naming and semantics of new assertion would take 3 months, but I'd be happy to have it now, maybe in "limited" version. What if I'd put non-standard matching rule to my pact - what are the places that are likely to blow up?

zeldigas
2020-05-25 06:28
e.g. will pact broker be affected and reject my contract or it does not care and I can just make my quick and dirty patches for consumer/provider in langs I'm interested in?

matt.fellows
2020-05-25 06:29
I?d really like to see us have that capability, not just at the matchers level but at the transports and protocols - but that is a bit harder

matt.fellows
2020-05-25 06:29
no, the broker will not be bothered at all by additional stuff in the contract

matt.fellows
2020-05-25 06:29
I?d say it?s worth a spike if you need it!

zeldigas
2020-05-25 06:30
Thanks!

uglyog
2020-05-25 06:30
I don't see why the matchers couldn't be extended, but how do you get them to work in a language neutral way

matt.fellows
2020-05-25 06:32
there are consequences to something like this, but perhaps the `x-` type extension - where anything with a given prefix is denoted as ?external? or ?non-official? type thing. Then there is the whole question of implementation.

matt.fellows
2020-05-25 06:33
The current Ruby process does actually have a way to monkey patch, so in theory it could be done. Ideally, natural hooks are provided to enable that though

matt.fellows
2020-05-25 06:33
(we also expose that monkeypatch option through to JS currently but wouldn?t be hard to add for the others)

zeldigas
2020-05-25 06:35
I'm not sure that it's possible. In fact I have not dig into implementation details of pact consumer/providers libs, but assume that every language have to reimplement all the checks described in standard. there is no some "universal representation" that is traspiled to java, c, js and so on, right?

zeldigas
2020-05-25 06:35
@matt.fellows Thanks for `x-` idea. I'll take a look into it.

matt.fellows
2020-05-25 06:40
> I?m not sure that it?s possible. In fact I have not dig into implementation details of pact consumer/providers libs, but assume that every language have to reimplement all the checks described in standard. there is no some ?universal representation? that is traspiled to java, c, js and so on, right? Funny you should ask that. Ruby was the original, and powers JS/Go/Python/.NET/PHP. So that is one place C++ and new JS use the Rust engine: https://github.com/pact-foundation/pact-reference JVM is its own beast

matt.fellows
2020-05-25 06:40
But yes, there is still work in all of the client libraries

2020-05-25 06:49
A new post has been created in *Feature Requests*


zeldigas
2020-05-25 06:49
done

dattasai.chunduru
2020-05-25 07:53
Oh we need the API Code what they have developed ?

dattasai.chunduru
2020-05-25 07:57
Actually Contract Testing word is completely new for me I don't have any Idea on this. I used POSTMAN Previously where we used to get end point and the Spec Documentation based on that we used to validate. I understood some Basics from PACT that we will test a MICROSERVICE FROM both Client and Consumer Prospective and it need a MOCK Server. I have cloned a GIT HUB Project and tried to replicate it with a dummy API from my LOCALLY Installed J-SON Server

ravbaker
2020-05-25 08:13
I?ve successfully managed handling and tracking async (fire&forget) events between two services written in Ruby in my project. I had to write some extra code to handle it but it works for me quite well. Maybe I could extract some code to a GitHubGist to showcase it. @bethskurrie

matt.fellows
2020-05-25 10:20
Yes, think of it like a unit test. You're going to need to know the code base well and be able to code

francislainy.campos
2020-05-25 11:40
Hi, could I get some help with this error I'm getting here please? https://stackoverflow.com/questions/62001663/exception-in-thread-thread-2-java-lang-nosuchmethoderror-kotlin-io-bytestream. Thank you very much.

zeldigas
2020-05-25 11:47
would be great to see your dependencies to make sure kotlin is in the classpath. what does `mvn dependency:tree` prints?

francislainy.campos
2020-05-25 11:57
Hi, here is the list of plugins and dependencies and the minimum pom where I can reproduce the issue in pasted on the SO question.

mike.geeves
2020-05-25 12:04
Yes, should still have backend tests, seems like a nice way to avoid copy pasted boilerplate code for the same tests, I'm a big fan of writing as little code as possible. I think the "most interesting and varied" is the key part, focus effort on what's likely to be different Thanks for input / confirming :+1: Would that be something useful as a feature I wonder? :thinking_face: Maybe something with tags whereby a set of tests get performed against providers tagged as a certain class? :thinking_face:

francislainy.campos
2020-05-25 16:01
Why would I be getting a Kotlin error on a Java project?

francislainy.campos
2020-05-25 16:27
I've updated the SO question with some further details in case that may be helpful.

uglyog
2020-05-26 00:54
Answered on SO

abubics
2020-05-26 00:57
> Would that be something useful as a feature Which one of the things? :sweat_smile:

ashish_garg5
2020-05-26 05:43
Hi All, How can i pass a json body in my PactDslJsonBody response ? I have created a json file which my consumer is expecting as a response now i want to pass that in my PactDslJsonBody response. // Want to do something like this PactDslJsonBody responseBody = new PactDslJsonBody().object("test.json");

bethskurrie
2020-05-26 05:44
Please ask in #pact-jvm-help

ashish_garg5
2020-05-26 05:44
sure

romuald.quantin
2020-05-26 08:08
Hi, How do I test 2 differents type of structure with an eachLike? ```{ "list": Pact.Matchers.eachLike({ type: 'A', fieldForA: {} }) }``` And: ```{ "list": Pact.Matchers.eachLike({ type: 'B', fieldForB: {} }) }``` I tried to create 2 different interactions, which works, but I'm also verifying mocks, and these mock contains both it is failing on: ```{ list: [ { type: 'A', fieldForA: {} }, { type: 'B', fieldForB: {} } ] }```

francislainy.campos
2020-05-26 08:15
Thank you. I've updated the dependencies and that's what I have now but still same error I'm afraid.

uglyog
2020-05-26 08:19
You still have the older version of the Maven plugin (pact-jvm-provider-maven). The 4.0.10 version does not have the _2.12 in the name.

uglyog
2020-05-26 08:20
```<groupId>http://au.com.dius</groupId> <artifactId>pact-jvm-provider-maven</artifactId> <version>4.0.10</version>```

francislainy.campos
2020-05-26 08:30
Thank you. Yeah, I hadn't changed that because didn't find a _2.12 compatible with 4.0.10 but changed it now and got the same error still.

francislainy.campos
2020-05-26 08:30
This is what I get when run the dependency tree. All the appearances for Kotlin.

romuald.quantin
2020-05-26 08:40
For one or the other interaction I would get some like: ```Could not find key "fieldForB" (keys present are: fieldForA) at...```

bethskurrie
2020-05-26 08:41
Are they in separate tests?

richard.nunes
2020-05-26 08:43
has joined #general

romuald.quantin
2020-05-26 08:44
That's how I started, I created 2 test that doesn't represent the reality, but I can make 2 tests for for each type of object I can receive

romuald.quantin
2020-05-26 08:44
it is when I verify mock that's I'm failing, because our mocks contains both (as the real response can be)

bethskurrie
2020-05-26 08:45
You need to be able to totally control the data on the provider side for pact to work.

bethskurrie
2020-05-26 08:45
Can you make an array with one of each object?

bethskurrie
2020-05-26 08:46
Unfortunately we don't have a matcher yet that allows you to do unordered contains.

bethskurrie
2020-05-26 08:46
But it's only the list.

bethskurrie
2020-05-26 08:46
BTW, you mean pact verification, not mock verification.

romuald.quantin
2020-05-26 08:47
I do mean mock verification

bethskurrie
2020-05-26 08:47
The mock verification happens on the consumer side, after each consumer test.

bethskurrie
2020-05-26 08:47
The pact verification happens on the provider side.

romuald.quantin
2020-05-26 08:47
yeah

romuald.quantin
2020-05-26 08:48
basically I'd like to do something like: ```{ "list": Pact.Matchers.eachLike({ type: 'A', fieldForA: {} }).or({ type: 'B', fieldForB: {} }) }```

tjones
2020-05-26 08:48
You can?t have a matcher that looks for arrays containing mixed objects

bethskurrie
2020-05-26 08:48
I'm confused as to what the issue is if you really mean mock verification.

tjones
2020-05-26 08:49
Usually this happens if you?re trying to test more than one contract test case with a single test

tjones
2020-05-26 08:49
it?s better to write two tests


romuald.quantin
2020-05-26 08:50
so I can receive a response with 2 type of objects, I can create tests to separate them on the client side, and pact verify them separately, on the backend side but then we have integration tests with mocked response, that contains both the type of object in one response We are verifying these mocks by serving then (all this is client side), and replaying the interaction against it

tjones
2020-05-26 08:50
as Beth says, what mock are you verifying? There are a few cases where you might want to do Pact tests of a mock (eg asserting that mocks for front end devs work correctly), but usually trying to verify concrete mocks with Pact suggests there?s a misunderstanding somewhere

romuald.quantin
2020-05-26 08:51
@bethskurrie we did have some long conversation about optionals a few years ago :wink:

tjones
2020-05-26 08:52
So, your contract test should read: In <this server state>, <this request> will result in <this response>

romuald.quantin
2020-05-26 08:53
I'm not sure what the misunderstanding can be, having 2 tests is already a "way around" not representing the reality

romuald.quantin
2020-05-26 08:53
what I'm missing is capabilities with the matchers

bethskurrie
2020-05-26 08:53
OK, you are doing something that is very interesting, but isn't what pact is written to support. I don't know if we can help until we have the more sophisticated array matching.

tjones
2020-05-26 08:53
I would solve this with a server state where the list is: ``` list: [ { type: 'A', fieldForA: like({ /* whatever fieldForA looks like */}) }, { type: 'B', fieldForB: like({ /* whatever fieldForA looks like */}) } ]```

bethskurrie
2020-05-26 08:54
It's not the pact verify that is failing, Tim.

bethskurrie
2020-05-26 08:54
It's a custom verification, I think.

romuald.quantin
2020-05-26 08:54
yes that's correct

tjones
2020-05-26 08:54
Oh, I thought it was trouble writing the contract?

bethskurrie
2020-05-26 08:54
To validate a separate, custom mock.

romuald.quantin
2020-05-26 08:54
we are serving our mocks, re-using the pact interactions to verify they are valid

tjones
2020-05-26 08:54
I?ve had this case, where you want to verify a response that is an array that contains mixed types

romuald.quantin
2020-05-26 08:55
yes exactly

bethskurrie
2020-05-26 08:55
Short story, can't be done yet, sorry.

tjones
2020-05-26 08:55
Right, but your interaction should say that your server is in a particular state.

bethskurrie
2020-05-26 08:55
But it's been requested.

bethskurrie
2020-05-26 08:55
The "server" is a mock.

romuald.quantin
2020-05-26 08:56
that's fine @bethskurrie that's all I wanted to hear I'll try to find other solutions to verify our mocks

tjones
2020-05-26 08:56
If you say this is an array of type A or B, then you can?t be sure that your test is covering both types

bethskurrie
2020-05-26 08:56
Sorry. It's on the to do list.

romuald.quantin
2020-05-26 08:56
is that feature request deep in a backlog or? :slightly_smiling_face:

tjones
2020-05-26 08:56
I think the answer is the same regardless of whether there?s a mock or not

romuald.quantin
2020-05-26 08:56
or not many people are asking for that

romuald.quantin
2020-05-26 08:57
that's true @tjones

bethskurrie
2020-05-26 08:57
There are requests for it, but we have to make a new spec version to add it, and we haven't caught up all the languages to the most recent spec yet.

bethskurrie
2020-05-26 08:57
We need to do that first.

romuald.quantin
2020-05-26 08:57
I see

tjones
2020-05-26 08:57
If the request is: ?I want to match an array that contains A and B?, then I think it?s on the backlog if the request is ?I want to match an array that contains A or B?, then I think it?s explicitly not planned

romuald.quantin
2020-05-26 08:58
yeah that's the first case

tjones
2020-05-26 08:58
Cool :+1:

tjones
2020-05-26 08:58
For now, you have to do this with provider states

romuald.quantin
2020-05-26 08:58
yep, that's what we will do

tjones
2020-05-26 08:59
I?ve had provider states like ?the list contains A then B?

romuald.quantin
2020-05-26 08:59
provider states are fine, we can cover anything, what is missing is more on the matcher side of it

tjones
2020-05-26 09:00
You just have to match in a more concrete way, since the spec doesn?t support mixed types in an array response yet


tjones
2020-05-26 09:02
I think this is the issue if you want to comment, and there?s a feature request you can vote for too, hold on.


tjones
2020-05-26 09:03
^ I think this would serve your needs

tjones
2020-05-26 09:03
We should have a FAQ page for matchers

tjones
2020-05-26 09:03
I?ll make a note

romuald.quantin
2020-05-26 09:06
yes, it seems to be the same problem

romuald.quantin
2020-05-26 09:06
is there a public pact roadmap I can keep my eyes on?

romuald.quantin
2020-05-26 09:08
thanks both for your time and fast answer about that!

bethskurrie
2020-05-26 09:08
canny has a roadmap at the homepage


romuald.quantin
2020-05-26 09:09
thanks @bethskurrie

francislainy.campos
2020-05-26 09:25

zeldigas
2020-05-26 13:44
@romuald.quantin thanks for voting. In case there will be some progress regarding such assertion, I'll post it to #general

dattasai.chunduru
2020-05-26 14:02
Hi

dattasai.chunduru
2020-05-26 14:03
Can I test this dummy API http://dummy.restapiexample.com/api/v1/ by using PACT ?

romuald.quantin
2020-05-26 14:35
no problem, I feel that would be a good addition :wink:

danhitchcock
2020-05-26 15:37
has joined #general

danhitchcock
2020-05-26 15:42
Hi All, I am trying to pass an hard coded (:grimacing:) auth token into my provider tests, I can't currently set my provider state, is there any other way i can pass this value in for those tests?

francislainy.campos
2020-05-26 15:49
How do I check for longs as in `"timestamp": 1589451234126` in PACT with Java, since integer or number type is not available for large numbers please?

tjones
2020-05-26 15:57
You might get a better answer in Pact JVM - but in general you need to be careful with large numbers in JSON -- because javascript only supports 64 bit floating point numbers, treating it as a big integer is risky

tjones
2020-05-26 15:57
Also, that is an unusually high timestamp

tjones
2020-05-26 15:58
Which tests? For the provider tests, you can set arbitrary tokens in the consumer, or are you asking about re-setting the token during verification?

wesleythomaswilliams
2020-05-26 15:59
I assume you can't match with ```.numberType("timestamp", 1589451234126)```

danhitchcock
2020-05-26 15:59
Yes in the provider test, thanks for getting back to me.

tjones
2020-05-26 15:59
If you need to change the provider test, you can use custom middleware implementing `Pact::ProviderVerifier::CustomMiddleware`

tjones
2020-05-26 16:00
(in Ruby)

danhitchcock
2020-05-26 16:00
is there a JS implementation?


tjones
2020-05-26 16:01
kind of. `pact-node` exposes the standalone ruby binaries as binstubs

tjones
2020-05-26 16:03
You can also use the `customProviderHeaders` option to the verifier if you?re calling it from JS

francislainy.campos
2020-05-26 16:03
@tjones. The timestamp length seems fine to me as it's today's date.

tjones
2020-05-26 16:04
That timestamp is unusual, since it?s in milliseconds

francislainy.campos
2020-05-26 16:04
Yes, it's the time a notification is triggered on our system.

danhitchcock
2020-05-26 16:05
Ok, one more thing, is there any way to console.log the req the provider test makes?

francislainy.campos
2020-05-26 16:07
I'll post it on the jvm channel as you suggested.

tjones
2020-05-26 16:09
I?m afraid I?m not familiar with the java implementation, but I guess the maths checks out for millisecond timestamps in json for more years than you or I will need to worry about

tjones
2020-05-26 16:11
in js we defer most of that to the Ruby implementation (at the moment). Try setting verbose mode - `-v` if you?re calling the binary, or `verbose: true` if you?re invoking from JS

tjones
2020-05-26 16:12
I?m about to make a (large!) list of improvements we can make to the logging and error messages in JS - so please let me know how you get on, and what areas you?d like to see improved.

danhitchcock
2020-05-26 16:17
Awesome, thanks for your help Tim

francislainy.campos
2020-05-26 16:18
Removed the sample for the input altogether such as in `.integerType("timestamp")` rather than `.integerType("timestamp", 1589451234126)` and it worked now. Thanks.

tjones
2020-05-26 16:18
You?re very welcome! I?m heading to bed here, but I?ll check back in the morning in case you have further questions.

tjones
2020-05-26 16:22
Awesome! That?s also good practice - in general, it?s best to get Pact to match the shape of the data rather then the value

mike.geeves
2020-05-26 18:40
The "Maybe something with tags whereby a set of tests get performed against providers tagged as a certain class" :slightly_smiling_face:

uglyog
2020-05-26 23:33
Ok, I can see kotlin-stdlib-jdk8:1.2.71 in your dependencies, which is the wrong version. I'll clone your repo and see if I can reproduce it.

uglyog
2020-05-27 00:07
I was able to reproduce it, but I don't understand why it is happening. I can see in the dependency tree: ```au.com.dius:pact-jvm-consumer-junit5:jar:4.0.10 -> au.com.dius:pact-jvm-consumer:jar:4.0.10 -> io.ktor:ktor-server-netty:jar:1.2.6 -> org.jetbrains.kotlin:kotlin-stdlib:jar:1.2.71``` which is the wrong version of the Kotlin standard lib. Checking Maven Central, https://search.maven.org/artifact/io.ktor/ktor-server-netty/1.2.6/jar has the following in it's POM: ``` <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> <version>1.3.60</version> <scope>compile</scope> </dependency>```

uglyog
2020-05-27 00:11
Also, https://search.maven.org/artifact/au.com.dius/pact-jvm-core-support/4.0.10/jar has ```<dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib-jdk8</artifactId> <version>1.3.71</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-reflect</artifactId> <version>1.3.71</version> <scope>runtime</scope> </dependency>``` Looks like there is the same issue with Gson. I was able to fix your project by adding the following to the dependencies: ``` <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> <version>1.3.72</version> <scope>test</scope> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.8.6</version> </dependency>```

abubics
2020-05-27 00:59
I think the most useful starting point is to treat a provider as a cohesive interface of a single bounded context.

abubics
2020-05-27 00:59
If you find a test set getting big, and duplicated between providers, I'd reconsider the scopes of your bounded contexts and modules.

abubics
2020-05-27 01:00
You could probably come up with some custom verification tagging schemes that do what you're suggesting, but it feels more like the domain concerns could be remodelled instead :slightly_smiling_face:

abhinav.sharma
2020-05-27 06:04
has joined #general

francislainy.campos
2020-05-27 08:38
Thanks a lot! Yeah, that worked. Accepted the SO answer now. Appreciate your help. Have a great day. :)

danhitchcock
2020-05-27 09:58
``` Types of property 'logLevel' are incompatible. Type 'string' is not assignable to type '"trace" | "debug" | "info" | "warn" | "error" | "fatal" | undefined'. ``` Upgraded to the latest version and i am getting this error

danhitchcock
2020-05-27 10:49
also i am a bit confused as to why the service i am pointing it at is printing this out to console, as i haven't setup a pactSetup url ``` I, [2020-05-27T11:38:19.680907 #14248] INFO -- request: POST http://localhost:52641/_pactSetup```

tjones
2020-05-27 10:50
For the first try `'info' as logLevel`

danhitchcock
2020-05-27 10:51
ah no same error

tjones
2020-05-27 10:51
The second is looking for the default provider state URL, I believe. You can safely ignore it.

tjones
2020-05-27 10:51
can you share your code?

danhitchcock
2020-05-27 10:52
```import { Verifier } from "@pact-foundation/pact" import path from "path" const port = 5000 const opts = { provider: "Backend", providerBaseUrl: `http://localhost:${port}`, pactUrls: [path.resolve(__dirname, "../pacts/frontend-backend.json")], providerVersion: "1.0.", followRedirects: true, verbose: true, logLevel: "info", customProviderHeaders: ["Authorization: Bearer XXXXXredactedXXXX"], } jest.setTimeout(30000); // Verify that the provider meets all consumer expectations describe('Pact Verification', () => { it("validates the expectations of Matching Service",async() => { console.log("opts " + opts.providerBaseUrl) return await new Verifier(opts).verifyProvider().then((output:any) => { console.log("done "+output) }); }) })```

tjones
2020-05-27 10:58
Apologies, it?s in caps: ```import { LogLevel } from '@pact-foundation/pact/dsl/options'; .... logLevel: "info" as LogLevel,```

tjones
2020-05-27 11:00
I?m not a big typescript user, so if I?ve done something unhelpful with the type system recently, please let me know (also I apologise)

danhitchcock
2020-05-27 11:03
ok debug works :slightly_smiling_face: i am hardly a TS evangelist so you're safe :slightly_smiling_face: . It looks like the tests are failing because i am not authorised, despite passing a valid bearer token, which i tested on postman. Below is the logging for when i replace the token . redacted because :slightly_smiling_face: ``` INFO: Replacing header 'Authorization: Bearer' with 'Authorization: Bearer eyXXXREDACTEDXXX'```

danhitchcock
2020-05-27 11:04
I tried escaping quotes around it but that didn't seem to help

tjones
2020-05-27 11:37
Hm. That looks like the right log output. Are you 100% sure that your postman test used the same token?

danhitchcock
2020-05-27 11:38
checking the logging it seems to be setting the url to not point at localhost:5000 ? ```Starting pact binary 'standalone\win32-1.84.0\pact\bin\pact-provider-verifier.bat', with arguments [/workspace/frontend/pact/pacts/frontend-backend.json --provider-states-setup-url http://localhost:53102/_pactSetup --provider Backend --provider-base-url http://localhost:53102 --provider-app-version 1.0. --verbose true],```

tjones
2020-05-27 11:48
Ah- so, Pact-JS runs its own proxy between the verifier and your provider.

tjones
2020-05-27 11:48
@matt.fellows - can you think of a reason that the proxy would not respect headers that are replaced by the verifier?

matt.fellows
2020-05-27 11:51
Not at all, it should definitely pass them thru

tjones
2020-05-27 11:51
(you should be able to see the request go through the proxy if you set log level to debug)

matt.fellows
2020-05-27 11:51
We could definitely add some trace logging in that part of the code tho

tjones
2020-05-27 11:51
Yeah, I?ve looked through the Ruby and the JS here and I can?t see why the header wouldn?t be correct

tjones
2020-05-27 11:55
@danhitchcock Sometimes middleware rewrites header key case - is your provider particular about the case of `Authorization`?

tjones
2020-05-27 11:56
Thought it would be easier to check the provider before I go through all the layers of middleware here and see if they?re misbehaving

tjones
2020-05-27 12:00
@danhitchcock, can you try using the following option instead? ``` requestFilter: (req, res, next) => { console.log( "Middleware invoked before provider API - injecting Authorization token" ) // e.g. ADD Bearer token req.headers["authorization"] = `Bearer ${token}` next() },```

tjones
2020-05-27 12:01
That will get Pact-JS?s proxy to do the auth header instead of the pact binary

tjones
2020-05-27 12:01
it?s riskier, because the ruby binary will complain if you?re trying to replace a header that doesn?t exist in the Pact file.

tjones
2020-05-27 12:01
(and this approach won?t do that)

tjones
2020-05-27 12:02
even if it doesn?t work, it eliminates the Ruby -> Proxy connection as the source of the problem

tjones
2020-05-27 12:05
Also, it?s weird that the provider verifier doesn?t seem to have the header replacement listed as an argument in your log quote.

dikili
2020-05-27 12:39
Hello, i have a general question, is pactflow the recommended tool as a pact broker or setting this up within the company is a better choice ? Also by uploading pact files somewhere we might be exposing some auth tokens, internal important credentials in the contract thus would it pose a security risk if pactflow is used and pact files published outside ?

danhitchcock
2020-05-27 13:26
Ok tried the code snippet in my options, i can see the log output text, ```[2020-05-27T13:21:58.297Z] DEBUG: pact-node@10.9.4/17356 on beast: Verifying a pact between Frontend and Backend Given 201 is seen a request for a price with the given values with POST /api/v1/campaign returns a response which [2020-05-27T13:21:58.298Z] DEBUG: pact-node@10.9.4/17356 on beast: DEBUG: Setting up provider state '201 is seen' for consumer 'Frontend' using provider state set up URL http://localhost:53688/_pactSetup [2020-05-27T13:21:58.307Z] DEBUG: pact-node@10.9.4/17356 on beast: I, [2020-05-27T14:21:58.306388 #13072] INFO -- request: POST http://localhost:53688/_pactSetup [2020-05-27T13:21:58.307Z] DEBUG: pact-node@10.9.4/17356 on beast: D, [2020-05-27T14:21:58.306388 #13072] DEBUG -- request: User-Agent: "Faraday v0.17.3" Content-Type: "application/json" console.log pact/test/provider.spec.ts:16 Middleware invoked before provider API - injecting Authorization token [2020-05-27T13:21:58.338Z] WARN: pact@9.11.0/17356 on beast: No state handler found for "201 is seen", ignoring [2020-05-27T13:21:58.349Z] DEBUG: pact-node@10.9.4/17356 on beast: I, [2020-05-27T14:21:58.349388 #13072] INFO -- response: Status 200 [2020-05-27T13:21:58.349Z] DEBUG: pact-node@10.9.4/17356 on beast: D, [2020-05-27T14:21:58.349388 #13072] DEBUG -- response: x-powered-by: "Express" content-type: "text/plain; charset=utf-8" content-length: "2" etag: "W/\"2-nOO9QiTIwXgNtWtBJezz8kv3SLc\"" date: "Wed, 27 May 2020 13:21:58 GMT" connection: "close" console.log pact/test/provider.spec.ts:16 Middleware invoked before provider API - injecting Authorization token [2020-05-27T13:21:58.370Z] DEBUG: pact@9.11.0/17356 on beast: Proxing /api/v1/campaign [2020-05-27T13:21:58.396Z] DEBUG: pact-node@10.9.4/17356 on beast: has status code 201 (FAILED - 1)```

bernardoguerr
2020-05-27 14:05
I would say it depends on your bandwith. If you do not have the expertise in-house and need the extra features, go with Pactflow. I think Pactflow right now has an interesting offering, and as a paid customer you are more likely to get support as you need it. As for your second question, you should not need to be passing real authentication tokens in contracts. At most, the contract might represent the shape of the authentication method, but not the actual content. The provider should be responsible for dealing with the authentication when necessary . I wrote an article about it a while ago (https://medium.com/dazn-tech/pact-contract-testing-dealing-with-authentication-on-the-provider-51fd46fdaa78) , and there is useful material on the pact website too (https://docs.pact.io/provider/handling_auth)

tjones
2020-05-27 14:09
Is it definitely failing with an auth failure?

dikili
2020-05-27 14:09
Thank you for the response, but Provider will make the actual call to the API , thus it will need the token and its only source for the token is the pact file itself though no? I thought about encrypting the token via some algorithm and the decrypting for the provider to make the actual call but this would add an overhead i suppose or i am thinking i might be reinventing the wheel somehow ? Not sure if that is the case though

danhitchcock
2020-05-27 14:10
``` Failures: 1) Verifying a pact between Frontend and Backend Given 201 is seen a request for a price with the given values with POST /api/v1/campaign returns a response which has status code 201 Failure/Error: expect(response_status).to eql expected_response_status expected: 201 got: 401 (compared using eql?) 2) Verifying a pact between Frontend and Backend Given 201 is seen a request for a price with the given values with POST /api/v1/campaign returns a response which has a matching body Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example Actual: {"code":"401","message":"Unauthorized"}``` according to the output

tjones
2020-05-27 14:10
(also your auth token is in that snippet)

tjones
2020-05-27 14:11
wait, no it isn?t. Sorry, tired brain

danhitchcock
2020-05-27 14:12
No worries :slightly_smiling_face: i thought my tired brain couldnt see it

tjones
2020-05-27 14:12
I?m not sure what is happening. I suspect there?s something that?s different between the Pact test and the postman test that you ran to confirm the token is correct.

tjones
2020-05-27 14:12
You could try printing out the whole request in that middleware function

tjones
2020-05-27 14:12
to confirm

tjones
2020-05-27 14:14
(as an aside, it looks like you might not be using provider state correctly - it?s meant to describe the state that the provider is in _before_ the test, but it looks like you might be describing the result of the test. If the provider doesn?t need any config, you don?t need to provide a value in the provider state)

tjones
2020-05-27 14:16
@dikili I think you might be misunderstanding something, although I am not sure what

tjones
2020-05-27 14:18
The usual pattern is to either: 1) use a provider state that sets up an arbitrary token (a state like `"SOME_TOKEN is a valid auth token"`) or 2) Inject a header with a real token during provider verification. The implementation of this depends on the pact framework you are using, and the blog that @bernardoguerr linked illustrates the approach for JS

dikili
2020-05-27 14:21
@tjones my misunderstanding comes under the second question i asked, so what I am trying to get to is, 1. consumer test generated a pact file but end point needs authentication so for the sake of security i can write a consumer test that will just Not require a token in the contract BUT when the provider will verify it will fetch the contract and as it wont see any token in the contract will make a anonymous call to the endpoint thus it will fail, at one point or how provider will substitute different tokens to different endpoints is where I am confused about,if it makes sense ?

tjones
2020-05-27 14:21
(Nice post @bernardoguerr ! One small correction - it?s Pact, not PACT :sunglasses:)


tjones
2020-05-27 14:23
or you can use an approach like the one linked in the blog to rewrite the token during verification

dikili
2020-05-27 14:23
Ok , thank you i will read about this as I am kind of beginning this journey recently

tjones
2020-05-27 14:25
@bernardoguerr how to handle authorisation is a question we get asked a lot, and the end of your blog post is a nice write up. Would you be interested in contributing it to the documentation?

litty.john
2020-05-27 14:29
has joined #general

bernardoguerr
2020-05-27 14:29
Hey @tjones. I've fixed it to say Pact now :slightly_smiling_face: , I think at the time I highlighted it to PACT when I was referring to the team/company. And yes, sure!

litty.john
2020-05-27 14:31
Can someone help in ruby how to add hmac auth in the provider side test

tjones
2020-05-27 14:34
Awesome! The repository is here - https://github.com/pact-foundation/docs.pact.io We?re in the middle of migrating the docs to a better look + feel, but the structure is the same (I?m afraid we haven?t written any instructions for running the new documentation locally yet - but let me know if you need any assistance). Perhaps start with a markdown file under `/docs/faq` (ultimately we?ll probably have a best-practices section and it can go in there)

danhitchcock
2020-05-27 14:40
Not too sure how to see the request thats being sent in the middleware section, tried Json stringifying the req variable. The provider can't be configured so i guess i can remove this, it was there so i could change the auth token for the 401 test.

mike.geeves
2020-05-27 15:37
Totally agree about looking at the overlap, if we have the same tests for the same endpoints it's definitely doing something wrong (I type that as I think of where we have getFarmer, getFarmer2 and getFarmerNew controllers *table flip*) I was thinking more for use cases like "all services with a GET {id} should return a 403 if not found or no permission", vs some return 403 and some return 404, or "all services with GET [all] should also implement GET {id}". Patterns Coding standards rather than domain. I'm having that conversation currently though :slightly_smiling_face: "what is a service", it's very philosophical :joy:

ross.kaffenberger
2020-05-28 01:10
has joined #general

tjones
2020-05-28 01:22
A good guideline that @abubics gave me once is ?test every response that the consumer needs to be able to understand?

tjones
2020-05-28 01:23
this helps you see whether you need to write individual error interactions, or whether you can cover them all with one

tjones
2020-05-28 01:23
does your API client behave differently when it gets 401 vs 403 vs 500 ? (etc)

ross.kaffenberger
2020-05-28 01:29
Hi, new member here. I work at Stitch Fix and we use pact-ruby! I just found this channel via the project README for https://github.com/pact-foundation/pact-message-ruby. We also use messaging quite a bit so I'm interested in possibly introducing this project at work. I'm here to ask about Consumer contract support in pact-message-ruby /cc @bethskurrie

tjones
2020-05-28 01:30
It?s very weird. If you have time, it would be great to get an example repository somewhere that reproduces the problem. The quickest path is usually to fork pact-js and modify one of the examples - either way if you can get an example up on github somewhere, I?ll take a look.

matt.fellows
2020-05-28 01:34
Hey Ross! Welcome

matt.fellows
2020-05-28 01:35
You might be interested in voting for https://pact.canny.io/feature-requests/p/implement-consumer-message-dsl-for-pact-ruby. It?s really not that much work to get it complete, I believe.

ross.kaffenberger
2020-05-28 01:40
Thanks, Matt. Voted!

matt.fellows
2020-05-28 02:04
So I just updated the e2e example in the project as follows (the request filter was already there where an Authorization token was added). I?ve also added a custom provider header `x-header-foo`

matt.fellows
2020-05-28 02:05
I put logging in the providerr service - you can see both headers are being set

preethighalke
2020-05-28 02:14
@matt.fellows tried the stub service it works to suit the needs have few queries though: 1. Does the stub /mock server do an exact maching of the query param values for a given interaction? for eg: My API takes a parameter key=queryvalue now when i test the interaction curl localhost:1234/xyzcontext?key=queryvalue it works but if i give curl localhost:1234/xyzcontext?key=somevalue it fails saying expectation does not match, I was wondering if pact provides a way where i do not want to have hardcoded values for query parameters , request headers etc in the pact and the curl works against the stub/mock server. Also do we have a mechanism to mock authorization header against mock/stub server. any inputs would help.

venkata.poranki
2020-05-28 08:06
has joined #general

godfrey
2020-05-28 09:05
has joined #general

oscarg798
2020-05-28 12:47
has joined #general

oscarg798
2020-05-28 12:48
Hello guys hope you are doing okay, new member arriving with some questions :slightly_smiling_face: Can we specify the provider version for publish task in gradle plugin ?

matt.fellows
2020-05-28 12:56
> _NOTE:_ The pact broker requires a version for all published pacts. The `pactPublish` task will use the version of the gradle project by default. You can override this with the `providerVersion` property. Make sure you have set one otherwise the broker will reject the pact files. from https://github.com/DiUS/pact-jvm/tree/master/provider/gradle#publishing-pact-files-to-a-pact-broker

matt.fellows
2020-05-28 12:56
that answer it?

oscarg798
2020-05-28 13:02
So we have a provider version, but I saw that this can be override but not sure if its just on the provider side, so what I?,m trying to achieve is be able to publish new version of a contract with for example `develop` tag, but avoid this one to be verified by the provider until they are ready

andreas
2020-05-28 20:25
Hi All, We are starting a Pact implementation for a Java/Kotlin client that consumes a (Legacty - No Async Messages) PHP based API. And as I see it, the Java Pact Consumer writes Pact V3 and the Pact for PHP support V2? as I understand it? Should we/Can we - save our pacts in V2 format? Or is there a converter?

uglyog
2020-05-28 23:07
You can save the pacts in V2 format. Also, don't use any of the V3 matchers (numbers, date/times)

uglyog
2020-05-28 23:10
The DSL support libraries have a PactSpecificationVersion parameter. For instance, with JUnit it is supplied on the constructor for PactProviderRule

bethskurrie
2020-05-28 23:35
@andreas the underlying pact engine for php should just ignore the parts of the v3 spec it doesn't understand.

bethskurrie
2020-05-28 23:36
If you find it doesn't, then let me know.

uglyog
2020-05-29 01:42
We have started an RFC process to begin work on a Pact V4 version. The RFC is being tracked on the Github issue https://github.com/pact-foundation/pact-specification/issues/71. We are looking for community feedback on what changes should be made to the Pact file format as well as the behaviour of the matching and verification. Comments are welcome.

jacek.okrojek
2020-05-29 07:05
Hi All, we are planning to introduce Pact Broker to our organization. We are not sure what hardware (CPU, memory) we should use. Can anyone desribe the hardware configuration that he use or give some guidelines?

danhitchcock
2020-05-29 08:02
Cheers @matt.fellows and @tjones that did help resolve my issues with passing a token and using the state tags, tests are now working. Also learnt a few things about the matching and managed to get a full e2e going. It wasn't without some pain so when the dust settles on this project i'll see what i can do about sharing the love on setup :slightly_smiling_face: :wave:

bethskurrie
2020-05-29 08:05
Funnily enough, I was just writing some docs for this for our On Premises offering.

bethskurrie
2020-05-29 08:08
I've just been working on these today, so they're not finished.

bethskurrie
2020-05-29 08:08
https://doc.pact-dev.dius.com.au/docs/on-premises/system-requirements/ This is our staging instance btw, so don't bookmark any of those links. They'll be out at http://docs.pactflow.io next week.

matt.fellows
2020-05-29 08:09
Thanks Daniel - we would _really_ appreciate the surprises / confusing things. Tim and I (core JS maintainers) are planning on catching up soon to talk ergonomics and the new API

matt.fellows
2020-05-29 08:09
I?m thinking we do an open session (e.g. hangouts/twitch/something live) that anybody can join in. Stay tuned in the #pact-js channel

bethskurrie
2020-05-29 08:11
Ron had some estimate for the database so where in slack

bethskurrie
2020-05-29 08:14
Found it. He said one that had been running for quite a while had 650Mb of data.

bethskurrie
2020-05-29 08:15
Give it a couple of GB and I think you'd be more than fine. Not sure you can even provision an AWS instance with that little storage. I think from memory it's 15GB or something?!

mike.geeves
2020-05-29 09:09
We don't have them yet, that's part of the fun :slightly_smiling_face: (we have about 15 years of services of varying quality, varying levels of consistency) It's a chance to try and do things nicely. Agree with the Boris quote, that's absolutely something done badly in the past :smile: I was thinking around the "Principle of least astonishment", they might not need something now, but if they decide they need it later, and then add in the test later, it would be nice if it worked how they expected it because it was the same as everywhere else :slightly_smiling_face: I'm trying to get more QA involvement at the start to work with devs rather than just testing at the end, it's a terrible waste of time when QA picks up edge cases that behave badly/fall over which could have been handled with only a tiny amount of effort at the start vs fix time later Getting a bit deeper than the original thought now :smile:

andreas
2020-05-29 09:59
Thanks! Will just dive into it. Trying to implement Pact and Contract Testing at YouSee (nuuday) - a large danish TV & Films app (distributor).

bethskurrie
2020-05-29 10:02
Let us know how you go. We've just put this out - it might be helpful, if this is your first time. https://docs.pactflow.io/docs/workshops/ci-cd/

jacek.okrojek
2020-05-29 11:55
Thanks Beth, do you have any ideas on HA configuration, is it popular or people have some workarounds for cases then PacktBroker is temporary down?

chandanakurumeti27
2020-05-29 14:01
Hi, Could some one please clarify the below thing! I have consumer test written for specific method (lets say `createuser()`) in my consumer service (`user`) code base, This method `createuser()` is retrieving the data from two different services (`authentication` and `account` services). so as we can see that authentication and account services are two different providers to consumer user service. Now, I want to have two different contracts `1. user<->authentication services` and `2. user <-> account services` . But i have written only one testcase using `@pactverification` against the createuser() method. Is there any possiblility to have two different contracts from only one testcase with `@pactverification` annotation. Please get back to me if anything is unclear here. Looking forward to any reply. Thank you in advance :slightly_smiling_face:

dale.bennett
2020-05-29 14:08
has joined #general

chandanakurumeti27
2020-05-29 14:18
As in figure here https://docs.pact.io/consumer#scope-of-a-consumer-test Collaborators in the my consumer service is communicating with two external services

chandanakurumeti27
2020-05-29 14:18
and i want to have two different contracts when i run test against collaborators unit

bethskurrie
2020-05-29 21:23
Usually you just deploy the image to a docker container management service like fargate, Kubernetes, ecs, and that is sufficient to keep it up 99.99% of the time. That's how we run Pactflow, and we've found it very reliable.

bethskurrie
2020-05-29 21:25
It's not a highly complicated service, so there's not much to go wrong.

bethskurrie
2020-05-29 21:27
We also use a multi az database.

bethskurrie
2020-05-29 21:30
Best to ask in #pact-jvm-help. You definitely can in Ruby, JS etc, by running two mock services at the same time, but I don't know how it works in JVM land.

chandanakurumeti27
2020-05-30 15:31
sure thank you Beth!

wesleythomaswilliams
2020-05-30 16:07
@chandanakurumeti27 I would put tests for each service in separate classes.

chandanakurumeti27
2020-05-30 16:13
Yeah, i tried my best to have it that way, but as i can see it is very difficult to have seperate tests for those two services in my case. so it is not possible to have two contracts from one test case in java?

chandanakurumeti27
2020-05-30 16:23
I found the same kind of issue  https://github.com/DiUS/pact-jvm/issues/117, but couldnt really understand the solution provided here.

chandanakurumeti27
2020-05-30 16:37
I think i found the solution, I have added two provider names in this annoattion @PactVerification({?auth_For_Player?,?account_For_Player?}), started two mock providers at diff ports using @Rule and its working now :slightly_smiling_face:

sairsule
2020-06-01 09:17
Hi, I am testing kafka contracts using Pact. I have a query, there is a section Metadata MessagePact, what is the use of it? I do not use metadata in producer code, still I see "has matching metadata (OK)" message in logs. How can I make sure metadata is also compared?


matt.fellows
2020-06-01 10:16
Might want to check pact JVM GitHub repo and look for any tests that use metadata

dattasai.chunduru
2020-06-01 12:43
Hi All

sjuli.chen
2020-06-01 15:55
has joined #general

uladzimir.sadouski
2020-06-01 20:53
has joined #general

weyert.deboer
2020-06-01 21:55
has joined #general

weyert.deboer
2020-06-01 22:17
Hello

weyert.deboer
2020-06-01 22:18
I am considering use Pact for solving an issue were we keep having a broken API from a third party supplier, thinking of writing both the consumer and provider as it's working now so we can easily track when things break. Only it's not full clear how Pact could assist me with detecting this. As I assume you can't really run it against a test environment?

mike.geeves
2020-06-01 22:25
I'm not sure if this would be a good use case for pact as there then wouldn't be anything you could do about it anyway, aside from then updating your software and creating a new pact Disclaimer: fairly new to pact myself so may not be the best answer From my experience elsewhere, I've covered this with tools such as runscope, where we have tests against 3rd party APIs to check some of our common usage and how long those requests etc take, to then get a slack notification of there is a problem

weyert.deboer
2020-06-01 22:27
Yeah, I have been looking for a nice lecture or tutorial/book about Pact to get a better understanding of it :slightly_smiling_face:

dgaglani
2020-06-02 00:07
has joined #general

dgaglani
2020-06-02 00:10
Hi.. I am using PACT test framework (on Java) .. I am stuck in creating array of interactions in pact programatically.. I know one way is: ```return builder .uponReceiving("a request for something") .path("/hello") .method("GET") .willRespondWith() .status(200) .body("{\"hello\": \"Ada\"}") .uponReceiving("another request for something") .matchPath("/hello/[0-9]+") .method("GET") .willRespondWith() .status(200) .body("{\"hello\": \"Ada\"}") .toPact();```

bethskurrie
2020-06-02 00:10
Best to ask in #pact-jvm-help

dgaglani
2020-06-02 00:11
Thanks!


matt.fellows
2020-06-02 00:20
@bernardoguerr :point_up: another vote for your video series :slightly_smiling_face:

ramfjordm
2020-06-02 07:55
has joined #general

vitor.campos
2020-06-02 12:41
has joined #general

sairsule
2020-06-02 14:15
I created a sample contract test for a messaging service consumer and producer in using spring boot. following pact file is created ```{ "consumer": { "name": "KafkaReceiver" }, "provider": { "name": "MessageProvider" }, "messages": [ { "description": "a test user is created", "metaData": { "topic": "first_topic", "key": "update", "contentType": "application/json" }, "contents": { "name": "Foo", "id": 42 }, "providerStates": [ { "name": "SomeProviderState" } ], "matchingRules": { "body": { "$.id": { "matchers": [ { "match": "number" } ], "combine": "AND" }, "$.name": { "matchers": [ { "match": "type" } ], "combine": "AND" } } } } ], "metadata": { "pactSpecification": { "version": "3.0.0" }, "pact-jvm": { "version": "4.0.10" } } }```

sairsule
2020-06-02 14:17
when run java-producer it allows different numeric values for 'id'. Which is fine. But when I wrote producer pact test in GO, it fails when 'id' is not exact match of 42. are matchers different in GO and JVM?

matt.fellows
2020-06-02 14:21
Go doesn't support the v3 matchers yet. You need to serialise the Java pacts with V2

sairsule
2020-06-02 14:27
OK.

sairsule
2020-06-02 14:28
where can I see what languages support what specification?


dominicdemierre
2020-06-02 16:35
has joined #general

sairsule
2020-06-02 16:53
Thank you @mike.geeves

dominicdemierre
2020-06-02 16:56
Hi, sorry if this has been answered already, I couldn't find it. I have tests using the PactNet messaging branch, which is V2. I'm now writing tests w PactJS, and https://github.com/pact-foundation/pact-node/issues/100#issuecomment-635641156 I'm looking at using V3 PactJS. But, I'm concerned about compatibility. I'll need PactNet to consume contracts generated by PactJS, and vice versa. Is this remotely possible (assuming I avoid V3 features?) Thanks very much :^)

sairsule
2020-06-02 17:22
link for "Best practices for pacticipant version numbers " is broken on https://docs.pact.io/pact_nirvana/step_8

shawn.edge
2020-06-02 17:35
has joined #general

shawn.edge
2020-06-02 17:39
Hello! I had a question about Pact and graphql... We're got a debate internally here and I'm hoping you guys might be able to shed some light. graphql is a bit new to me vs. REST api so I apologize if this is obvious. My question is Why would anyone want to use Pact for Graphql?

dom.udall
2020-06-02 17:50
I had the same question a few weeks ago! At the end of the day it's not the technology your using as much as the request you're making and the response you're expecting. Changes to a qraphql API can still break clients that are written with specific queries. http://blog.pact.io/2018/07/24/contract-testing-a-graphql-api/ was one of the posts I found useful

pravera
2020-06-02 17:58
Hi everyone! We have many services in Ruby, Python, JS that have pact tests and are thinking of a way to know which of our endpoints are covered by pacts. Have you thought of a `pact coverage tool`? Will be doing research on how to solve this? Thanks!

shawn.edge
2020-06-02 18:28
One of the arguments was that if the schema doesn't change the API shouldn't break. I thought this was. bit odd.

sairsule
2020-06-02 22:49
I tried this following, It gives error ```Message pacts only support version 3+, cannot write pact specification version V2``` `@Pact(consumer = "KafkaReceiver")`     MessagePact reciveMessagePact(MessagePactBuilder builder) {         PactDslJsonBody body = new PactDslJsonBody();         body.numberType("id", 42L).         stringType("name", "Bar")         .closeObject();         Map<String, Object> metadata = new HashMap();         metadata.put("key1", "value1");         metadata.put("key2", "value2");         MessagePact pact =  builder.given("SomeProviderState")                 .expectsToReceive("a simple test")                 .withMetadata(metadata)                 .withContent(body)                                  .toPact();         pact.write("../pact", PactSpecVersion.V2);                 return pact;     }

matt.fellows
2020-06-02 23:26
Hi Dominic, yes I can see how this would be confusing. If you don?t use the v3 specific matchers (so stick with regex/type matchers) then the matchers generated should still be usable by the v2 .NET implementation

matt.fellows
2020-06-02 23:26
You?ll still suffer the path length issue in .NET though, albeit I think it?s less likely because of the way npm vs nuget will package things


matt.fellows
2020-06-02 23:28
hmmm I thought that might be the case

matt.fellows
2020-06-02 23:28
I think as long as you don?t use v3 matchers it should be OK

matt.fellows
2020-06-02 23:28
but it sounds like that?s not the case

matt.fellows
2020-06-02 23:33
ok so back to your problem. I think if you don?t use the `numberType` matcher it should work

matt.fellows
2020-06-02 23:34
```"matchingRules": { "body": { "$.id": { "matchers": [ { "match": "number" } ], "combine": "AND" }, "$.name": { "matchers": [ { "match": "type" } ], "combine": "AND" } } }``` So with those matching rules, the `type` matcher will be :ok_hand: but not the `number` matcher

matt.fellows
2020-06-02 23:35
Hey! So, we?d love to be able to do it but the only way to know that is to know all of the services in advance - thoughts on how to achieve it?

matt.fellows
2020-06-02 23:35
I?ve thought about creating a proxy that can be installed as middleware into common HTTP frameworks, that could sample requests and send to the pact broker. There, we could build a map of the ecosystem and start to show the coverage

matt.fellows
2020-06-02 23:36
Perhaps as a starting point, an API to register the services and known interactions could suffice and then a UI (or manual API call) to load them in

tjones
2020-06-03 00:01
Would love to hear how you get on with an approach to this! I?ve thought about taking an openapi spec and seeing if all response and request types are covered, but it?s hard to do this in the general case

matt.fellows
2020-06-03 00:03
That?s also a good idea for companies that use them. But doesn?t cover other protocols - protobufs, GraphQL, MQ etc.

matt.fellows
2020-06-03 01:06
fixed

bheemreddy181
2020-06-03 01:34
we did this using codecov https://docs.codecov.io/docs/flags by running them separately in CI along with other unit/functional tests and codecov has great features where they show flag level percentage on github and coverage on their UI

sairsule
2020-06-03 02:35
are you suggesting contract json file manually?

matt.fellows
2020-06-03 02:42
Not at all. Just avoid the v3 matchers like numbertype in your test code


tjones
2020-06-03 04:33
I don?t personally use GraphQL, but I have heard people who do use it say they don?t need contract tests because they have a schema. I don?t think this claim is true. My understanding is that GraphQL doesn?t provide any mechanism for verifying whether a schema change has affected any clients.

tjones
2020-06-03 04:37
Generally, you would want to use Pact if you want to be certain that your client implementations can speak to your provider implementation. I don?t believe the GraphQL tooling provides this capability out of the box- at least, not in an easy to drop in way.

tjones
2020-06-03 04:44
@shawn.edge: I agree that?s an odd argument. How often do you have a schema that will never change? I?ve only seen it where people are afraid to change the schema because they don?t know what will break. With regular HTTP+json, I?ve heard both ?We don?t change our API, so we don?t need contract tests? and ?the same team writes the consumer and the provider, so we don?t need contract tests?. I disagree with both statements - Pact gives you the advantage that you *know* the consumer can speak to the provider. And you *know* whether you?ve made breaking changes to your API (not all schema changes are breaking). Pact gives you confidence that the integration points won?t be a source of failure. Like all testing tools, it?s not necessary, but it is a great way to reduce risk.

ale.paciello
2020-06-03 08:13
has joined #general

shawn.edge
2020-06-03 13:15
@tjones: Thanks! This is exactly what we are discussing and I appreciate your comments!

dominicdemierre
2020-06-03 14:02
Yeah, nuget makes it way easier to get around that issue, since you can just store packages somewhere else. If v2 .NET can still read the Node tests' contracts then that eliminates a major hurdle. Thank you!

irldev
2020-06-03 17:47
has joined #general

hoagiex
2020-06-03 22:09
Philosophical question: How to handle external additions to your contract (e.g. required/remapped headers in an API gateway) which affect what a consumers needs to supply/what a provider secretly requires? My current problem: *layout:* Consumer(s) -> AWS API gateway -> Provider *flow:* ? the consumer is required to provide an X-api-key header, with a value that is specific to that consumer ? the AWS API gateway strips the X-api-key header and adds a new header with human readable identification (in this case: X-client-name), which as mandatory in the provider application *Problems:* 1. The consumer generated pact may only be aware of the requirement for the X-api-key header, not the X-client-name header 2. The provider will test for the presence of the X-client-name header, which will not be in the consumer pact 3. The consumer cannot use an actual/real API key in the pacts ; fixing this with provider states and generators would mean that the API key format used in the example value of the pact, could be invalid resulting is a false positive for the consumer end of the pact (a common problem with provider states & generators) Even if I would ignore problem 3 above, I cannot figure out how I would implement the following: ? provider state: ?api key XXXXXXXXX? will be resolved to the consumer name ?whatever?, which sets up some form of client request interceptor (can this be done?) for the HttpTestTarget class, that does the header remapping Any thoughts?

bethskurrie
2020-06-03 22:12
Tricky. Can you test via a proxy function/service that acts like the gateway?

bethskurrie
2020-06-03 22:12
This comes up a lot.

hoagiex
2020-06-03 22:13
you are a genius? I can just spin up a wiremock in proxy mode

hoagiex
2020-06-03 22:13
It?s so simple and clean? I?m ashamed I didn?t figure it out?

bethskurrie
2020-06-03 22:14
It's not our first time at the rodeo ;-)

phil.endsley
2020-06-04 03:51
has joined #general

thomas.koerner
2020-06-04 06:12
has joined #general

anatoli.sorochinskiy
2020-06-04 08:29
has joined #general

dattasai.chunduru
2020-06-04 10:15
Hi , I have a basic query for doing pact consumer testing we have to stub the API in our machine and then start testing it ?

tjones
2020-06-04 10:46
No. Pact will handle the stubs for you.

tjones
2020-06-04 10:47
A Pact consumer test runs a mock server. The mock server asserts that your consumer sends the request that you promised.


dattasai.chunduru
2020-06-04 12:05
so we have to just pass the JSON data what we need and test it directly that's all ?

philipp.mueller-leven
2020-06-04 12:27
has joined #general

philipp.mueller-leven
2020-06-04 12:31
Hi is there any Problem according with the pact-documentation? Currently https://docs.pact.io/ is not reachable.

matt.fellows
2020-06-04 12:40
Shit!

matt.fellows
2020-06-04 12:40
I'm wondering if Gitbook (where our docs are hosted) is down

dom.udall
2020-06-04 12:42
Yeah it looks like it is, getting a CloudFlare 502


matt.fellows
2020-06-04 12:43
When the status page is hosted on the same system that it's monitoring :laughing:

matt.fellows
2020-06-04 12:44
(either that, or they've lost control of DNS which is worse)

elliottmurray
2020-06-04 12:44
cert error seems to be looking for *.http://gitbooks.io

elliottmurray
2020-06-04 12:44
not gitbook

dom.udall
2020-06-04 12:45
Yeah, also seems to be down.

dom.udall
2020-06-04 12:45
Is https://github.com/pact-foundation/pact.io the content repo for the docs site?

elliottmurray
2020-06-04 12:48
lol


dom.udall
2020-06-04 12:49
@philipp.mueller-leven this may help if you're looking for something while the main site is down

matt.fellows
2020-06-04 12:50
Domain registered, but nobody is home

matt.fellows
2020-06-04 12:51
There are NS records (cloudflare) but no DNS records. So, they could be migrating and just haven?t told anybody

matt.fellows
2020-06-04 12:51
but then.. you would have setup your zone in advance.

dom.udall
2020-06-04 12:52
Sounds about right. NS typos can be quite killer. I'm getting the CloudFlare error page every so often still though..

philipp.mueller-leven
2020-06-04 12:53
@dom.udall Thank You :slightly_smiling_face: maybe this is enough for me :-)

matt.fellows
2020-06-04 12:55
looks like they?ve been with cloudflare at least 2 years, so it would be a hell of a mistake at this point

bernardoguerr
2020-06-04 12:56
There's an update on this on @GitBookStatus on Twitter


dom.udall
2020-06-04 12:58
Status site is back up too

matt.fellows
2020-06-04 12:58
lol was looking at the same thing

matt.fellows
2020-06-04 13:00
I?m reluctant to try their fallback method

matt.fellows
2020-06-04 13:01
> Clients using a custom domain to serve their public content can update their CNAME record to the following host in order to re-establish access to their documentation: > http://hosting-fallback.gitbook-staging.com Decision validated:

dom.udall
2020-06-04 13:02
Do the docs setup allow for something like github pages too? Guessing it'd be quite a bit of custom stuff

matt.fellows
2020-06-04 13:03
We were in the process of moving to docusaurus. Beth did some great work a week or so ago

matt.fellows
2020-06-04 13:03
It?s not that we don?t like Gitbook (their authoring is quite nice actually and has matured a lot) but it?s not the ?open a PR? like environment it used to be. And that doesn?t gel with us. It also has some restrictions on what can go in it, obviously


matt.fellows
2020-06-04 13:05
Ah, the domain is on client hold (https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en#clientHold). So this could take a bit

matt.fellows
2020-06-04 13:06
I need to run, a bit shit for anyone visiting our site, but hopefully it won?t be for too long

matt.fellows
2020-06-04 13:06
thanks for raising!

matt.fellows
2020-06-04 13:07
If anybody is keen to be a community hero and help migrate our docs to docusaurus, I?m positive Beth would happily share the spike!

dom.udall
2020-06-04 13:09
I can probably spare some time if it's not too challenging :smiley:

antonello
2020-06-04 13:38
guys, you probably have noticed already but it seems that the SSL certificate for http://docs.pact.io has expired

bernardoguerr
2020-06-04 13:40
the problem is on gitbook's side (which pact use to host their docs) .

eduardo.bellis-ext
2020-06-04 14:25
has joined #general

eduardo.bellis-ext
2020-06-04 15:29
Hey everyone! i couldn't find the link to log in to the web portal

eduardo.bellis-ext
2020-06-04 15:29
Could someone please send me? I received the credentials but I can't find it

sawan
2020-06-04 16:27
has joined #general

sadeed.bari
2020-06-04 18:15
has joined #general

sadeed.bari
2020-06-04 20:43
Hi all! Was looking into http://PACT.io vs BDD (behavior driven dev)/Cucumber for an API integration project and just looking to get a general opinion if one is better than the other, or advantages of using both of them together. Is there a lot of overlap in doing both? Seems that way from my initial research. Would really appreciate your thoughts. Thanks!

matt.fellows
2020-06-04 22:29
Hi Eduardo, please dm your email address and we'll resend it

matt.fellows
2020-06-04 22:31
Gitbook suffered an outage last night which messed with their DNS (registrar put them into domain lock)

abubics
2020-06-04 23:54
This is a bit more of a philosophical question & answer, but . . . Pact is really about unit testing the interface over the network boundary, so it is probably not super valuable to go all the way with Cucumber-style "natural language" specs. I still phrase all of my unit tests (including Pact tests) as "given, when, then", so I'm in favour of the BDD concept. I just don't push it all the way up to Gherkin syntax for non-devs.

tjones
2020-06-05 00:25
A pact consumer test has a few parts: 1) Defining the expected request and response 2) Asserting that the expected request was sent (the Pact mock service does this. and if successful it returns the expected response) 3) Asserting that the expected response is marshalled into the right object by your code (you do this in the unit test where you trigger pact)

tjones
2020-06-05 00:25
does that help?

matt.fellows
2020-06-05 07:06
New docs are live: https://docs.pact.io/

matt.fellows
2020-06-05 07:07
Thanks to @bethskurrie for the spike that is now the real docs. We have work todo, but that is the first step to getting back to a more open environment


matt.fellows
2020-06-05 07:07
So it turns out Beth did some good work, so much that it was basically done

matt.fellows
2020-06-05 07:07
BUT

matt.fellows
2020-06-05 07:07
It?s ugly and needs work


alex810
2020-06-05 08:01
has joined #general

thomas.fisher
2020-06-05 08:23
has joined #general

slack.pact.io
2020-06-05 11:39
has joined #general

antonello
2020-06-05 13:17
I am missing the search functionality :slightly_smiling_face:

sawan
2020-06-05 13:43
Hi team, super stoked about using Pact. Looking forward to working with the community

mike.geeves
2020-06-05 15:00
:open_mouth: I had not heard of docusaurus. I feel I may be about to make some possibly not the best informed choices over tooling :thinking_face:

dattasai.chunduru
2020-06-05 15:44
Defining the expected request and response- Hi Tim this is where I need help , let us assume there is a API end point like this http://dummy.restapiexample.com/api/v1/employees and I want to write a PACT Consumer driven test for this

dattasai.chunduru
2020-06-05 15:45
Actually I did POC with an API stubbed in my local machine

dattasai.chunduru
2020-06-05 15:45

dattasai.chunduru
2020-06-05 15:45
I am able to generate PACT file for this end point sucessfully

dattasai.chunduru
2020-06-05 15:46
Can you help me how can I proceed with API end point like this http://dummy.restapiexample.com/api/v1/employees

dattasai.chunduru
2020-06-05 16:36
If it is possible can you connect with me for 5 to 10 minutes I can show what I am trying to do Pleasee

dattasai.chunduru
2020-06-05 17:00
Like in POSTMAN if I hit the endpoint https://jsonplaceholder.typicode.com/posts/1 it will give the response. In pact if I have to get the response for same end point(https://jsonplaceholder.typicode.com/posts/1) how can we do. I understood that a Mock PROVIDER will be created . I am not able to understand how this MOCK provider will be created? coz if we have to get the response first we have to hit the API end point how we can do I am having this query in my mind from past few days and not able to proceed further

dattasai.chunduru
2020-06-05 17:01
I have gone through the PACT docs but not able to get it

steven.knopf
2020-06-05 17:34
has joined #general

antonello
2020-06-05 21:36
I?ve had an interesting debate today on whether to include or not specific values for ids and other properties in provider states.

tjones
2020-06-06 03:34
What was the conclusion?

arindam.datta
2020-06-06 05:15
Conclusion please.

arindam.datta
2020-06-06 05:17
Hi, can anyone please help me with a proven workflow of CI-CD for both Provider and Consumer? Just block diagram would do. I am finding this part pretty complex and hard to decide the flow. I know that probably I am asking for too much. But I found members of pact slack channel so helpful which gave me confidence to ask for such a help. This is the last puzzle I need to solve.

felipe
2020-06-06 06:34
We start a docker compose with our application and run the pacts from the gradle plugin

bethskurrie
2020-06-06 06:34
Answered in the #pact-broker channel.

bethskurrie
2020-06-06 06:35
Welcome @sawan. It's a great bunch of people we've got here.

bethskurrie
2020-06-06 06:36
@antonello it'll be back asap. I had it indexed for the netlify domain, and now it needs to be switched to the http://docs.pact.io domain.

bethskurrie
2020-06-06 06:42
If anyone has some free time in these crazy days, and is good with CSS, I'd love some help making the new Pact docs site look a bit better. IMO, it doesn't look anywhere as good as the old gitbook one (even though it is much better suited to us in other ways). PRs happily accepted! Ping me here if you're interested. Here's the repo: https://github.com/pact-foundation/docs.pact.io

antonello
2020-06-06 06:42
We didn?t get to a conclusion... still trying to get to one. We might reach out for opinions.

bethskurrie
2020-06-06 06:43
@antonello search is back now

antonello
2020-06-06 06:43
:clap::skin-tone-2:

bethskurrie
2020-06-06 06:43
Dude - what are you doing awake?

bethskurrie
2020-06-06 06:43
Oh - it's quarter to 8. That's not so bad.

bethskurrie
2020-06-06 06:44
I thought it was the middle of the night.

antonello
2020-06-06 06:44
:sweat_smile:

bethskurrie
2020-06-06 06:44
Oh crap, I need to get dinner on asap!

bethskurrie
2020-06-06 06:47
My feel is, if you can use matchers to avoid it, do. The more specific, the more brittle.

bethskurrie
2020-06-06 06:48
If you can't think of another way to do it without specific IDs, then do it with specific IDs. It's still better than an integration test. The Beth Pragmatic Approach.

tjones
2020-06-06 08:56
I agree with Beth. Sometimes you have to use specific values (eg, for `/users/someId`, you might have to have the state ?A user with id ?someId? exists?), but most of the time you don?t need to be overly specific, since matchers will let you generalise your test data. Pact is more about verifying the shape of the response in particular server states, rather than the specific response.

antonello
2020-06-06 09:05
This is in line with my thinking. The debate stems from a new use case for us. We have a new provider that has decided to run provider tests against a real data store, albeit a test one, and therefore the ids of the entities need to match, similarly to what @tjones has mentioned.

antonello
2020-06-06 09:11
A different use case is when it comes to our java providers that mock everything under the controller. Whilst ids that are part of the uris don?t need to match as otherwise requests would fail, the situation is different when it comes to query string parameters. If the mocks are set up loosely and you don?t set up them up strictly using the actual values of the query parameters, effectively you?re not testing that part of the contract.

antonello
2020-06-06 09:12
This is unless the query parameters are required by the controller, but in most cases they?re not.

tjones
2020-06-06 09:12
Philosophically, Pact is a consumer-driven contract testing tool. So, if a provider wanted to use a real data store, it?s probably up to them to ensure that the data in the store matches the expectations of the contract. Using matchers appropriately might mean that approach doesn?t hurt you, but I don?t really know.

tjones
2020-06-06 09:14
On your second point, I usually mock the boundaries, since you get a bit of functional testing for free. Just because contract tests are not functional tests doesn?t mean they can?t have functional converage.

antonello
2020-06-06 09:14
Even in the case of query parameters values having to match, I?m not sure if having them or not in the state will make much of a difference, except for making them explicit. You will still end up with some brittleness due to using hardcoded values.

antonello
2020-06-06 09:15
When you say boundaries, are you referring to over the network boundaries or data stores?

tjones
2020-06-06 09:17
I mean mocking at the repository later, which would be whatever contacts the network or the store. Hard to explain without a diagram or shared language. I?m afraid I have to head out - but I can share some examples later

antonello
2020-06-06 09:17
No I get it!

tjones
2020-06-06 09:18
Mocking the module(s) of your service responsible for the boundary, not mocking the other side of the boundary

antonello
2020-06-06 09:19
Thank you! I am thinking that even when mocking repos, mocking them loosely might still lead to non-testing of query parameters.

tjones
2020-06-06 09:20
I think it depends, but yes, you have to be careful.

antonello
2020-06-06 09:21
And if you need/want to be careful, you might end up having to use the values that hardcoded are in the pact

bethskurrie
2020-06-06 09:49
Stubbing business logic seems like it could easily result in false positives. I personally don't do it - how have you found it @antonello? I remember @tjones had a bad experience with it a year or so ago.

antonello
2020-06-06 09:57
Some of our providers are so massive and have so many dependencies that not mocking the business logic would make it very hard to write provider tests. For newer, smaller, leaner services it might make sense to mock deeper.

bethskurrie
2020-06-06 09:57
Yeah, fair enough.

antonello
2020-06-06 09:59
What?s happening though is that the first provider tests were written for the larger, less testable services and since then everyone has been following the same approach even on the newer ones. This conversation has helped me realised that, perhaps, we should push harder to pursue a different approach in each case.

bethskurrie
2020-06-06 10:01
Sounds logical.

antonello
2020-06-06 10:05
Now that means... a lot of tests to re-write....

antonello
2020-06-06 10:06
But at some point you?ll have to mock something, even if it?s clients or repositories. In which case how you set up those mocks will matter in the context of query parameters, unless I?m missing something obvious.

antonello
2020-06-06 10:07
Even just reusing the example scenario here https://docs.pact.io/provider/using_provider_states_effectively

bethskurrie
2020-06-06 10:08
Yup - every time you mock something, you then have to write another test to make sure you've mocked it correctly.

bethskurrie
2020-06-06 10:08
Maybe another Pact test, maybe a manual "contract" test.

antonello
2020-06-06 10:08
If you don?t mock the relevant repo method(s) using the value ?Mary? - you?re not testing the filter

bethskurrie
2020-06-06 10:09
I've got a slide somewhere in one of my decks that has an image of a chain made of links, where each link is a contract. Miss one, and you've lost all your confidence in the strength of the chain.

tjones
2020-06-06 10:09
@bethskurrie We should put something like that chain in the docs

tjones
2020-06-06 10:10
I also think there?s something in the ?not functional tests, but functional coverage?

bethskurrie
2020-06-06 10:10
Which is why by default I tend not to mock stuff inside the service unless there's a good reason for it - because then you really should write another test to validate that mock... and I'm lazy :wink:

bethskurrie
2020-06-06 10:11
Yes, we definitely need to expand the section on "where and how and what to mock"

tjones
2020-06-06 10:11
@antonello I ended up with the current view on mocking because of a case where the contract tests passed, but the provider was incapable of generating one or two of the responses when the real domain layer was called by the controller

bethskurrie
2020-06-06 10:11
There was more in the original ruby docs I think, that got lost in the migration.

bethskurrie
2020-06-06 10:11
I've got material in the Advanced Pact workshop I've been giving recently that needs to go into the guides section.

antonello
2020-06-06 10:19
Does what I?m saying make sense though? Pact interaction is for `GET /appointments?type=massage` Provider test mocks `when(repo).find(filterCriteria).thenReturn(anAppointmentList)` (repo could even be a BLL service) If `filterCriteria` is `any()` , the `type` parameter is ignored. Whilst if `filterCriteria` is set up to specify `type=massage` , then you are truly testing the query parameter side of the contract.

matt.fellows
2020-06-06 11:29
What did you choose?

mike.geeves
2020-06-06 11:36
No choices made, we are just starting to look around. Currently we have a dokuwiki which is..messy and a collection of sphinx docs which I quite like. I'm just wondering if there's something called docusaurus, if there's any point looking elsewhere :thinking_face: :joy:

jaycloudtechie
2020-06-06 18:05
has joined #general

bethskurrie
2020-06-06 21:07
Yes. I'd make it match exactly otherwise you're not actually checking the request is right.

antonello
2020-06-06 22:06
So that involves a bit of hard coding, whether you include the values in the provider state or not.

bethskurrie
2020-06-06 22:07
Yup.

bethskurrie
2020-06-06 22:08
I think it's the lesser of the two evils in this situation.

bethskurrie
2020-06-06 22:10
One day I'll get around to writing that blog post, "every decision you make in IT is about trade-offs" :joy:

antonello
2020-06-06 22:19
:joy:

antonello
2020-06-06 22:21
If only all trade-offs were understood and not just left to chance!! :zany_face:

bethskurrie
2020-06-06 22:30
:100:

tjones
2020-06-07 12:50
@antonello I think tests (in general, not just contract tests) should fail if and only if the interface or the behaviour change. If filterCriteria is `any`, then that statement is not true. I think the best-practice mock would have the expected filter criteria there.

antonello
2020-06-07 13:46
@tjones We?re all on the same page! :-)

antonello
2020-06-07 13:48
Unfortunately a lot of tests have been already written using `any`

raghulraj
2020-06-07 20:32
has joined #general

kalyan.chakri24
2020-06-08 05:01
has joined #general

r.iglesias
2020-06-08 09:33
has joined #general

2020-06-08 10:06
A new post has been created in *Feature Requests*

jinrui01
2020-06-08 12:14
has joined #general

sonney.patel
2020-06-08 12:23
has joined #general

sonney.patel
2020-06-08 12:30
Hi there, I'm getting desperate so i joined this slack channel. Essentially I'm trying to implement pact. I have successfully created a java consumer test and published it to the pact broker. However when i attempt to verify the pact, I seem to be getting statuses of 401 and not 200. I am struggling to workout the source of this discrepancy I created test endpoints from the controller and had no problems making calls to them through a default WebTestClient that i configured in unit test. Has anyone else had an experience like this before? We are using Spring Boot framework

matt.fellows
2020-06-08 12:31
Might want to ask in #pact-jvm-help

sonney.patel
2020-06-08 12:31
cheers man

matt.fellows
2020-06-08 12:32
But, 401 indicates no or invalid authorization / credentials are being passed in verification

sonney.patel
2020-06-08 12:32
I'm trying to work out what authentication it is I am missing and where

matt.fellows
2020-06-08 12:32
how are you authenticating? Bearer token? If the contract has a token in it, it?s probably old

matt.fellows
2020-06-08 12:32
does the provider API need auth?

sonney.patel
2020-06-08 12:32
our consumer talks to the provider through basic authentication

sonney.patel
2020-06-08 12:33
yeah the provider does need basic auth

sonney.patel
2020-06-08 12:34
but im not sure where that is meant to be configured

rafael.espillaque
2020-06-08 12:50
has joined #general

rafael.espillaque
2020-06-08 12:59
Hi, I?m struggling to find an equivalent table to this one https://docs.pact.io/consumer/contract_tests_not_functional_tests#which-test-is-responsible-for-what but focused on asynchronous messages instead of Request/Response. Can anyone help me with that?

christopher.kies
2020-06-08 14:11
has joined #general

v.scherr
2020-06-08 15:12
has joined #general

karol.szymanowski
2020-06-08 15:24
has joined #general

robert.zimmermann
2020-06-08 16:13
has joined #general

arindam.datta
2020-06-08 17:17
Question: Can't a provider be deployed until consumer pact is published? The provider has a verification test, but the consumer CI pipeline hasn't yet published the pact. The provider should get deployed right?

mike.geeves
2020-06-08 17:45
No free time really :) and no CSS skills, but if you need another proof read etc, happy to help

uglyog
2020-06-08 23:01
You have a few options, but a request filter is probably the best option.

matt.fellows
2020-06-08 23:30
Are you asking if it?s safe to deploy a provider if it has no consumers? And further, does Pact allow this case? The answer is ?yes? and ?yes?

bethskurrie
2020-06-08 23:31
How can the provider do a verification of a pact that doesn't exist @arindam.datta?

bethskurrie
2020-06-08 23:38
It's the same principle @rafael.espillaque. Test enough of the code that makes the message to give you confidence that the message that is expected can be created.

bethskurrie
2020-06-08 23:41
On the consumer side, test enough to make sure that you're handling the message correctly. Focus on the idea, "if this message wasn't as expected, would my test expose that?"

tjones
2020-06-09 00:48
That has been my experience too. I think it?s more common to inappropriately use `any` where the boundaries are mocked at a layer where you?d have to have several `when(thing).... when(otherThing)` statements, and people get lazy.

arindam.datta
2020-06-09 05:45
Exactly that's my point. There is no pact yet there (on broker). The provider team has verified a locally communicated pact. So, the provider has the pact verification test in place. CI pipeline tries to get the pact from broker, but doesn't find any and the verification job fails. While there is no pact on broker, hence no verification. Then why fail? P.S: Library "pact-net".

rafael.espillaque
2020-06-09 08:31
thanks that was useful

bethskurrie
2020-06-09 08:32
Good. I was in the process of adding a message section to that page, but didn't get back to finish it.

jeanlucc
2020-06-09 09:35
has joined #general

xuanzhaopeng
2020-06-09 10:31
has joined #general

cristian.schez
2020-06-09 11:17
has joined #general

slack1274
2020-06-09 11:49
has joined #general

wvdbraak
2020-06-09 13:11
has joined #general

tjones
2020-06-10 00:59
This is a good discussion, though - I think the outcomes from it would make a great best-practices page in the docs

tjones
2020-06-10 02:10
How are you specifying the pact from the broker? If there are no pacts for that provider, I don?t think it should be failing

shero86
2020-06-10 09:22
hi all, is there any chance to load all pacts from pact broker to stub server? :slightly_smiling_face: I want to run `pact-stub-server` and load all interactions from pact-broker. Is that possible? thanks

bethskurrie
2020-06-10 09:29
Which implentation @shero86?

shero86
2020-06-10 09:32
any will be glad :slightly_smiling_face: I?m using now command line pact-stub-server , and passing URI to local folder with pacts, and also tried to do the same to interaction from pact broker. It worked, but only for one pair of `ConmsumerA ? ProviderA` . But I want to load the rest pairs of services, if it?s possible @bethskurrie

bethskurrie
2020-06-10 09:33
You can't load all of the pacts into one service at the same time.

shero86
2020-06-10 09:33
got it, so I need to use local folder with pacts, right?

bethskurrie
2020-06-10 09:33
You could write a script to pull them all downs and merge them into one file if you really wanted.

bethskurrie
2020-06-10 09:34
No... It's the same locally. It only allows you to load one pact. You can do it from a local file, or a remote URL.

shero86
2020-06-10 09:35
ah, I see. Thanks for this info, will try to play around to merge all pacts into one file :slightly_smiling_face: thanks!

bethskurrie
2020-06-10 09:36
Though, I could be talking shit. If you're using the rust one, ignore what I'm saying.

bethskurrie
2020-06-10 09:36
I only know about the Ruby one.

shero86
2020-06-10 09:38
:smile: I?m using ruby one, I think. that one from standalone pact.

wesleythomaswilliams
2020-06-10 10:10
@arindam.datta so you've been given a pact file (that has yet to be hosted on a broker) and built a provider test to verify it, which is running in your pipeline and failing because of the missing pact. Did I understand that correctly? If that's the case, disable the provider test until the consumer is publishing the pact to the broker.

arindam.datta
2020-06-10 10:21
Hi @wesleythomaswilliams, yes that's exactly the scenario at my end. From the reply of @tjones , the verification shouldn't have failed when pact is not available. I wanted to verify from experts what is expected fundamentally: Should the provider test be disabled until pact is published to the broker? OR Should the provider test *NOT fail,* since there is no pact and hence nothing to verify and the .Net library 'pact-net' has a bug which is causing it to fail?

bethskurrie
2020-06-10 10:28
Well, it's not normal to hook up a verification until there is actually a pact to verify. So, the first one.

bethskurrie
2020-06-10 10:28
Cool. Do listen to me then.

slack1274
2020-06-10 11:37
hello i am a beginner with pact and am getting the below error. can someone tell me what's going on and what to do next. "java.lang.IllegalStateException: transformedJson [" provider "] must not be null" thank you in advance

matt.fellows
2020-06-10 11:41
Can you please ask in #pact-jvm-help. Also, we may need to see the test code to help diagnose

slack1274
2020-06-10 11:41
tx you, i will that

sjuli.chen
2020-06-10 11:53
Kijk aan, ik zie een aantal testcollegas :joy:

sjuli.chen
2020-06-10 11:54
Dit is Sjuli

sreeharimohan11
2020-06-10 12:29
has joined #general

sreeharimohan11
2020-06-10 12:42
Hey everyone, I understand pacts must be generated from integration tests within the codebase but are there any tools which provide a user interface to essentially create integration tests, which when run, generate the pact file. All integration tests should be centrally available and tagged to specific commit versions of the service themselves. The only difference from traditional integration tests is that they have the actual code abstracted out on a rich UI. This would help teams which have huge codebases and tons of integration tests which have to be altered in order to incorporate Pact.

wesleythomaswilliams
2020-06-10 13:09
Hi @sreeharimohan11, Pacts aren't generated from running integration tests. The tests that generate Pacts are unit tests. In order to write those, you're going to need to write them in code and usually in the same language as the actual service your testing is written in.

sreeharimohan11
2020-06-10 13:19
@wesleythomaswilliams Ideally, unit tests evaluate the internal functions of a service while integration tests evaluate external dependencies and how the service reacts when the external dependency reacts differently. Both tests can be written in the same language as the actual service code. This is why I mentioned pacts being generated using integration tests but yes, they are executed using the unit testing framework

jacek.okrojek
2020-06-10 13:25
Hi, I am looking for someone from Poland who has experience in Pact-Java to help us introduce Pact to our organization, anyone who can share experience will be very helpful

pavel.kirpichyov
2020-06-10 13:30
has joined #general

tjones
2020-06-10 13:39
@sreeharimohan11 I?m not sure I understand what you?re asking for. If you?re asking for a user interface to construct Pact consumer tests, then I don?t think one exists. Most tests follow a fairly straightforward formula: * Describe expected request * Describe expected response * Trigger request within your code <This is where Pact mocks your provider, and returns the expected response if your request was correct> * Assert that response from your code was the unmarshalled object that you expected

tjones
2020-06-10 13:40
^ The DSLs in the different Pact frameworks generally follow this pattern. It would be possible to make a UI that generates test code in different DSLs, but I think most developers would prefer to use the DSL directly.

sreeharimohan11
2020-06-10 14:03
Thanks for the quick response @tjones If the DSLs in the different frameworks follow a similar pattern, will a test code generating UI improve adoption within an organization. Once some code has been generated for say, a module, developer could then invest time in understanding the DSL and modifying the code. Some really 'busy' developers could even continue using the UI to add/edit/remove tests. Another advantage is also the ease with which you could possibly switch from one language to another if all frameworks followed a standard pattern. Does it make sense to create something like this?

matt.fellows
2020-06-10 14:43
https://blog.gitbook.com/tech/post-mortems/06-20-gitbook-domains-blocked-by-registrar for those interested in why our docs went down last week. A good read and a sad indightment on the hypocrisy of Google domains

pact.io971
2020-06-11 01:11
has joined #general

nanil4568
2020-06-11 03:19
has joined #general

tjones
2020-06-11 04:42
My gut is that most developers would prefer to edit the code directly than through a UI- however, if you think it?s useful then you may not be alone. You could put the feature request on https://pact.canny.io/ to see if others would find it useful. Note that Pact isn?t about specifying the entire API, it?s about specifying only the parts the consumer uses. So, switching an existing pact between different languages isn?t a common use case (how often do you replace a consumer with an identical implementation in a different language?).

bradley.smith
2020-06-11 05:14
has joined #general

sreeharimohan11
2020-06-11 07:31
Yes, I agree that advantage was far fetched. To give you some more context on the problem at hand, I manage the productivity team at my workplace and am trying to evaluate the ROI if we move to using consumer driven contract testing. The said ROI now depends on how fast developers can get onto this platform and configuring integration tests via a UI seems a much faster approach than writing those integration tests. What do you think?

tillmannheigel
2020-06-11 13:41
has joined #general

satya.quote_pact
2020-06-11 13:43
has joined #general

satya_srinivas_volla
2020-06-11 17:30
has joined #general

bruce.laird
2020-06-11 17:50
has joined #general

bruce.laird
2020-06-11 17:55
Hi I am trying to get provider tests working in .NET that use auth tokens, I have been trying to follow the example provided here without any luck. https://github.com/pact-foundation/pact-net/blob/master/Samples/EventApi/Provider.Api.Web.Tests/AuthorizationTokenReplacementMiddleware.cs anyone have experience sorting this kind of thing out?

maxurbanija.globant
2020-06-11 19:57
has joined #general

maxurbanija.globant
2020-06-11 20:10
@here Hello! I need some help let's assume I have 3 artifacts. ArtA -> Artb -> ArtC When ArtB downloads the pact that ArtA uploaded to the broker, I need to mock ArtC. Should I pact mock server for that?

max.forasteiro
2020-06-11 20:48
has joined #general

zbintliff
2020-06-11 21:02
has joined #general

tjones
2020-06-11 23:57
As a developer, writing tests using a UI sounds much slower to me. We already have productivity tooling around writing code, and it?s the environment we?re most used to working in. But, I don?t speak for all developers, perhaps your team have a different view.

tjones
2020-06-12 00:01
We?ve put a fair bit of work into making the various pact DSLs easy to use, so writing tests shouldn?t be a burden. If this isn?t the experience of your developers, I?d love to hear about it. Perhaps there are things that can be improved.

matt.fellows
2020-06-12 01:15
Might want to ask in #pact-net

matt.fellows
2020-06-12 01:15
I?d read https://docs.pact.io/provider/readme#stub-calls-to-downstream-systems and the gist associated with it. I think it answers your question

arindam.datta
2020-06-12 06:28
Well, in my opinion (I might be wrong as I am very new to this area), Provider verification test (libraries should implement this) should not fail if there is no pact available yet. This will even more promote the independence of deployment of both Provider and Consumer. And only when the pact is available, the deployment should be driven by the pact agreement between both Provider and Consumer (as already happening as per workflow).

bethskurrie
2020-06-12 07:31
Why hook it up unless there is a pact though? Am I missing something here? Are you building a generic pipeline that's used for all services?

sandhyareddy019
2020-06-12 07:34
has joined #general

rafael.espillaque
2020-06-12 08:40
I can read this in that gist: > A pact is best created using unit tests for the client class. Ideally, you could have a CClient in your B codebase, and you would write your Pact tests using that CClient class. I don?t fully understand it, could anyone expand on that please?

matt.fellows
2020-06-12 10:52
In that Gist, it is assumed that in an `A` -> `B` -> `C` set of interactions that you should stub out `C` when doing a provider verification of `B`. BUT, you should create a pact between `B` and `C`.

matt.fellows
2020-06-12 10:53
so when testing `B`. You either a) mock out of the piece of code (CClient) that talks to C or b) let CClient make an http call, but send it to a mock server

matt.fellows
2020-06-12 10:54
whichever approach you take, the idea is to avoid having real systems talking to real systems to do these test, because that gets us back into integrated, e2e testing which we want to avoid

rafael.espillaque
2020-06-12 10:54
ah! it?s only that? I got confused

rafael.espillaque
2020-06-12 10:54
I get it know, Thanks Matt

kaio.silveira
2020-06-12 10:55
has joined #general

matt.fellows
2020-06-12 10:58
no probs

sairsule
2020-06-12 13:24
In api tests, if provider api is /users{id} and consumer is calling /user/{id} this gets caught by pact test. Similarly in message-contracts if provider is writing to topic:Test1 and consumer is listening on topic:Test2, is it caught by Pact?

sreeharimohan11
2020-06-12 13:50
I'm really grateful to you guys to have put so much effort into DSLs @tjones . Thanks for that. One of my team's responsibilities include ensuring all developer teams are not spending too much time during the integration tests stage. Consumer driven contracts tests are the way ahead but requiring every developer team to write integration tests for all the services they own (we have a total of 400+ microservices) could become time consuming and there could also be a backlash from developers. Providing them with a UI which automatically writes these integration tests would actually prove more faster and easier to get a buy-in from teams. I'm split as of now as I would love to require everyone to use the DSL for each of their languages (you guys cover 100% of the languages we use) but would also not want this effort to slow down our current development.

wesleythomaswilliams
2020-06-12 14:24
Ah, 400+ micrsoservices, now I get why you were so keen to find a quicker/easier solution :smile:

wesleythomaswilliams
2020-06-12 14:25
I guess the trick is to convince them that alternative integration tests would be far far more time consuming to write, run and maintain.

max.forasteiro
2020-06-12 14:26
Hi all, just open a issue (https://github.com/pact-foundation/pact-ruby/issues/215) regarding the message support to ruby :slightly_smiling_face:

sreeharimohan11
2020-06-12 14:28
They actually already have alternate integration tests which are like all integration tests - flaky, unreliable, outdated and borderline disturbing. My team needs to find a way to convert them into pacts without having to write them out again :thinking_face:

kuzhca
2020-06-12 16:52
has joined #general

krisdinesh
2020-06-13 04:09
has joined #general

krisdinesh
2020-06-13 13:26
@here Is there any video tutorial for pact so that beginners like can learn?


antonello
2020-06-13 14:08
Pact?s website, though, is full of good resources, from documentation to tutorials.

krisdinesh
2020-06-13 15:21
:pray:

evanrosal
2020-06-14 13:59
Is anyone familiar with AWS EventBridge and its Schema Registry? If yes, how did you embed contract tests into this.

matt.fellows
2020-06-14 14:00
I?ve looked at it recently, and hopefully a colleague will also - I?m keen to see how it might work together. More broadly, registries like Kafka schema registry and Uber?s protobuf registry are of interest to me and the ecosystem - would be interesting to see how they should all play together

bethskurrie
2020-06-14 23:46
The ones that nobody ever seems to read :laughing: :cry:

psychopomp3x
2020-06-15 01:18
Does anybody have an example azure-pipelines.yml for an azure devops ci/cd pipeline with pact? Trying to figure out how hard a pact proof of concept for my team in that ci/cd system would be.

srikanth.chikkala
2020-06-15 04:01
has joined #general

josh.mccure
2020-06-15 04:18
will `can-i-deploy` look for an env variable so we don't have to pass the key in CI?

bethskurrie
2020-06-15 04:18
yes

bethskurrie
2020-06-15 04:18
All the CLI commands will.

josh.mccure
2020-06-15 04:18
Okay cool - maybe I just missed what it's called sorry

bethskurrie
2020-06-15 04:19
PACT_BROKER_BASE_URL, PACT_BROKER_TOKEN, PACT_BROKER_USERNAME, PACT_BROKER_PASSWORD, PACT_BROKER_PUBLISH_VERIFICATION_RESULTS can each be set via env vars.

josh.mccure
2020-06-15 04:19
Thanks Beth :slightly_smiling_face:

bethskurrie
2020-06-15 04:19
if you run `pact-broker help can-i-deploy` you should see it in the output

bethskurrie
2020-06-15 04:20
```The environment variables PACT_BROKER_BASE_URL, PACT_BROKER_BASE_URL_USERNAME and PACT_BROKER_BASE_URL_PASSWORD may be used instead of their respective command line options.```

a.smith
2020-06-15 05:33
@psychopomp3x what?s your runtime environment? We?re using Pact with Azure Functions. I?d be happy to share our pipeline structure, but there?s a lot of ?noise? for Functions vs. ?signal? for Pact.

sandhyareddy019
2020-06-15 09:39
Hi,how to insert records in object/tab created in developers account in salesforce?

bethskurrie
2020-06-15 09:40
Hi @sandhyarani.gabbi sounds like a question for a Salesforce channel.

bethskurrie
2020-06-15 09:40
How does it relate to Pact?

sandhyareddy019
2020-06-15 09:41
instead of creating providers i want to use salesforce and if any one can help?

bethskurrie
2020-06-15 09:42
Are you sure Pact is the right tool for this problem?


sandhyareddy019
2020-06-15 09:43
ok thank you

psychopomp3x
2020-06-15 14:24
We're using angular UI with .net core http://asp.net webapi microservices using an NServiceBus Esb. They are deployed to on prem services. Hopefully we will be moving to openshift next year.

linda.anthu
2020-06-15 14:46
has joined #general


rafael.espillaque
2020-06-15 16:08
Hi all, I asked a question in SO. I felt it was a better place than slack to provide some context but I?d like your help. https://stackoverflow.com/questions/62392004/any-problems-when-using-pact-for-async-messages-that-are-commands-or-queries-ins thanks a lot!

linda.anthu
2020-06-15 17:02
Hi all, I can test this response body with Matchers? {data: "123", result: [ {"id":"1", "competition": {"name": "teste1", "place": "en"}}, {"id":"2", "sport":{"name":"football", "type": "international"}} ]}

linda.anthu
2020-06-15 17:04
In this case the attribute "result" is an array of objects and each object can be "competition" or "sport" as attribute, it's possible?

psvieira.ti
2020-06-15 19:00
has joined #general

matt.fellows
2020-06-15 22:39
Thanks Ivan D for answering (if you?re in here!)

matt.fellows
2020-06-15 22:40
Also, thanks for asking there Rafa. Because we use the free slack, old answers disappear. SO Q&A live on forever, and are Googleable

michaelphi
2020-06-16 02:36
has joined #general

nicholas.pleschko
2020-06-16 08:50
has joined #general

garry.jeromson
2020-06-16 08:51
has joined #general

nicholas.pleschko
2020-06-16 09:00
Hi guys. We are using the terraform provider for pactflow (https://github.com/pactflow/terraform) to define webhooks. Is there a way to define the webhook consumers (or providers) to be ?ALL? as it is possible in the pactflow UI? We tried just using the string ?ALL? in the `webhook_consumer` name property but that didn?t work.

matt.fellows
2020-06-16 09:01
Thanks I saw the issue. I'll add it tonight

nicholas.pleschko
2020-06-16 09:03
Oh nice thanks!


nicholas.pleschko
2020-06-16 10:58
thanks a lot!

matt.fellows
2020-06-16 10:58
No probs. Let us know how you get on with it!

nicholas.pleschko
2020-06-16 12:23
Hmm ? we are hitting ?unauthorized? errors when running our CICD pipeline. Is there any kind of rate limit on pactflow?

dalton.silveira
2020-06-16 14:35
has joined #general

dattasai.chunduru
2020-06-16 17:37
Hi I am using this docker-compose.yml file for PACTS publish and verify

dattasai.chunduru
2020-06-16 17:39
I have 2 Projects seperately created for two different GET requests( one GET request is for locally stubbed API ) and another one is for externally available API. When I am trying to do PACT verification from Provider side it is valiadting with same Provider Json file again and again

dattasai.chunduru
2020-06-16 17:40
I have created 4 Maven Projects( 2 each seperately for consumer and provider validations). I am able to publish the PACT files successfully but when verifying it is checking for same PACT file in both the cases can anyone please help me on this

dattasai.chunduru
2020-06-16 17:41
Please let me know if you need the code snippets (or) POM.xml's

dattasai.chunduru
2020-06-16 17:42
I am using JAVA

gstorck
2020-06-16 17:51
has joined #general

gstorck
2020-06-16 17:55
Hey guys! I'm using pactflow and doing a poc for my company, but I can't find a way to use wip pacts. The blog post says I'd find help here. Thaanks!

dattasai.chunduru
2020-06-16 18:31
It is always verifying for this Json file

eric.jones
2020-06-16 18:59
Can someone give me clear guidance on Remote mockservers/Providers in the Pact Rule. Are they possible in the JVM (Java) version of Pact? Or do they have to be localhost? If not localhost, which provider class should I use to set the mockserver? I've been getting NW socket and bind errors. Thanks!

phil.endsley
2020-06-16 19:00
I can give it a shot. The error above is saying it can't find anything in Pact Broker for the provider called 'ProviderJson'. I'm not even sure it's verifying anything When you go to pact broker, do you see the pacts for your consumers there? You should see a table with at least one row that lists your consumer name and ProviderJson as the provider.

matt.fellows
2020-06-16 22:01
No rate limits. We'll check the logs and DM you offline with what we see

matt.fellows
2020-06-16 22:01
There is a WAF so if you're hammering us it may detect some form of foul play

naeem95m
2020-06-17 00:34
has joined #general

matt.fellows
2020-06-17 00:57
:wave:

matt.fellows
2020-06-17 00:58
So WIP/Pending pacts are enabled on your account. What language are you using?

matt.fellows
2020-06-17 00:58
Might be worth asking in #pact-jvm-help

matt.fellows
2020-06-17 00:58
May I ask about the use case - why do you want a ?remote? mock server?

matt.fellows
2020-06-17 00:59
I think Phil is on point here

matt.fellows
2020-06-17 01:00
if you?re using a broker, you need to first publish to the broker

matt.fellows
2020-06-17 01:00
the provider tests then pull down related contracts for the given provider

matt.fellows
2020-06-17 01:00
Did you end up completing the Pact JVM workshop?

bethskurrie
2020-06-17 02:22
Hi all. There's been a lot of confusion about the difference between pending pacts and WIP pacts. I'd like to see if I can find a more helpful name for the configuration option "includeWipPactsSince". If you've read the blog posts and have an idea of what they both mean, could you fill in a vote below?

2020-06-17 02:22
@bethskurrie has a poll for you!

nicholas.pleschko
2020-06-17 07:13
Ok cool thanks.

anddreiu
2020-06-17 12:04
Hi. I would like to open a discussion with you guys, maybe there are some of you who were in the same situation with me. Please let me know if I should ask this in a different channel. Currently we are writing PACT tests and we have the following scenario: there are multiple consumers for a single provider. The special thing on our side is the fact that the provider is an old legacy system, a monolith. But we have managed to use Pact, everything is fine with the tests. The particularity is that we have several test environments on the provider side, so we need to run the Provider tests on 30 functional test environments (each owned by a different team) in order to be sure that each team does not affect the consumers integrated with the big provider. All works fine, we can run the tests on all these test environments, but currently we are not publishing the results on Pact Broker for all those runs, just from a single test environment. I didn't try, but I imagine there will be a chaos on Pact Broker if results are published from 30 different runs each day. I would like to ask you how do you see this scenario? Or if there was anybody in this situation how did you handle it? Or if there is something that we can do. Because it would be nice to have all the results published, so that we can have the full pact flow in place. Thanks.

matt.fellows
2020-06-17 12:33
Sounds like you work at a bank :stuck_out_tongue:. Are you just not publishing with impunity for fear of overloading the broker or is it more of a technical thing where you aren?t sure how to to configure each of those functional test environments with tags/versions appropriately?

matt.fellows
2020-06-17 12:33
If the former, I wouldn?t make that a worry. There are ways to reduce the load/volume if it becomes a problem

anddreiu
2020-06-17 12:49
I imagine that there will be lots of lines in the Broker and the consumer won't understand what happens. It may be hard to follow if the provider tests are green on all those environments or if there were problems on some of them

anddreiu
2020-06-17 12:54
In terms of technical things, I was able to configure the provider tests to publish the version in broker, so that I can clearly see the test environment name and the current build version from that one.

matt.fellows
2020-06-17 13:06
Are each of those environments just so teams can build features in parallel on the same monolith? Or is it more about having lots of places to scale testing activities?

matt.fellows
2020-06-17 13:07
I?d also optimise for CI/CD in this case. The matrix would allow you to filter by tag/version to reduce the noise

anddreiu
2020-06-17 13:07
the first version, teams are developing things in parallel

matt.fellows
2020-06-17 13:07
Not having it controlled by pact sounds like a human error waiting to happen (i.e. false positives of ?safe to go?)

anddreiu
2020-06-17 13:08
so each test environment will have a different version

matt.fellows
2020-06-17 13:08
Another approach, although not ideal ,is to treat each team as a separate ?provider?

matt.fellows
2020-06-17 13:08
I?d say tags are probably also a better way to go, because you can encode human readable things into them more easily

anddreiu
2020-06-17 13:09
yeah, I wouldn't split it in more providers, I think it would add more complexity

anddreiu
2020-06-17 13:10
do you have something specific in mind when you say tags? we are not using the tags very well until now. I mean, we just tag prod and master versions

matt.fellows
2020-06-17 13:22
I?d need to think about your case a bit more, because it is a little unusual. Ordinarily, you would use tags like ?feature-a? or ?feature-b? to denote the features being worked on in those projects and what the consumers are currently expecting of them

matt.fellows
2020-06-17 13:22
_as a side note: https://docs.pactflow.io/docs/workshops/ci-cd/ might be useful reading material_

matt.fellows
2020-06-17 13:25
> The golden rule for tagging is: Tag with the branch when you publish pacts/results, tag with the environment when you deploy. from Beth, the other day

anddreiu
2020-06-17 13:25
yep, I'm sure it's unusual and that's why I wanted to open the discussion here. So if you'll have anything else in mind, please ping me with a message or here in the thread. Thanks Matt, much appreciated

matt.fellows
2020-06-17 13:26
No worries. I?ll have a think tomorrow when I?m properly awake and caffeinated :P

anddreiu
2020-06-17 13:26
cool :smile:

phil.endsley
2020-06-17 14:00
@anddreiu I'm pretty sure we're doing the same thing you are, just on a smaller scale (3 teams instead of 30 :slightly_smiling_face: ) Here's what we're doing 1. Tag every pact with the consumer branch. Tag every verification with the provider branch 2. Providers have Pending Pacts enabled 3. Providers will also be using WIP Pacts once it's available (we use Java for our providers. It may already be available for the language you use). 4. Until they're available, our providers verify against latest main branch, latest prod, and latest consumer feature tag. 5. Use can-i-deploy to act as a "can I merge?". This makes sure you're not breaking something when you merge because you don't have the latest changes from the main branch. (This is talked about in the CI/CD Workshop) This setup makes sure that each provider feature branch is compatible with: ? The latest version of your main branch ? The latest version of prod ? The latest version of the consumer feature tag they are developing against I'll second the CI/CD workshop linked above. Great resource that outlines this process.

anddreiu
2020-06-17 14:05
Thanks Phil! I will do the workshop, I'm sure it will help me. So the key thing is tagging. The consumers are now in the middle of the process to use tagging on the consumer side and to rely on can-i-deploy. So maybe after that, we can use these steps. (we are using also Java on the provider side). Thanks again for your notes!

gstorck
2020-06-17 14:39
js on the consumer, java on the provider

brendan.j.donegan
2020-06-17 17:00
Speaking from experience I doubt it should be an issue

zhukeven86
2020-06-17 21:33
has joined #general

aditi.puri
2020-06-18 05:27
has joined #general

nmsuryavanshi
2020-06-18 06:20
has joined #general

dattasai.chunduru
2020-06-18 10:42
@matt.fellows I have gone through and got one working GITHUB example and I condtructed a basic framework accordingly

dattasai.chunduru
2020-06-18 10:44
Actually I am having a GET Request and created 2 different Maven projects for Consumer side and Provider side . In Provider side Verification there is one Class Annotaiton called @PactFolder. I want to make this path as dynamic once. Can you please help me in this.

dattasai.chunduru
2020-06-18 10:45
Currently I have given a Hard-coded path like this

matt.fellows
2020-06-18 11:17
The workshop has examples of how to do this. You would usually use a pact broker and fetch the contracts that way

matt.fellows
2020-06-18 11:17
But you can put dynamic property values in there in whatever java framework you're using eg spring

alexandre.cuva
2020-06-18 12:58
has joined #general

pavann088
2020-06-18 17:20
has joined #general

pavann088
2020-06-18 17:22
Hi. I am new to pact . can any one tell me where to getstarted .

zhukeven86
2020-06-18 17:56
Hi. I'm planning on adding the JVM implementation of Pact (version 4.x) from the Maven Central repository, but I am unsure of which files to use. The files there seem to be fragmented and there does not seem to be a fully packaged version of JVM Pact on there. Any help would be greatly appreciated.

phil.endsley
2020-06-18 18:03
Read the docs if you haven't already. They're excellent. https://docs.pact.io/getting_started/ https://docs.pactflow.io/docs/workshops/ci-cd/ There's also docs for language specific libraries and how to use them.

bernardoguerr
2020-06-18 18:04
Hello! There's a #pact-jvm-help channel , it's probably a better place to ask that question :slightly_smiling_face:

zhukeven86
2020-06-18 18:07
Thanks!

williamfslima
2020-06-18 20:15
has joined #general

matt.fellows
2020-06-18 23:06
What do you by fragmented Keven?

bethskurrie
2020-06-18 23:24
I hadn't realised that the "how does Pact compare to..." page hadn't been migrated from the old ruby docs to the new ones. I've just added the page here https://docs.pact.io/getting_started/comparisons Are there any notable tools that are missing that we should add? I've already asked in the pact-jvm channel to see if someone can write about spring cloud contracts.

jess.c.ho
2020-06-19 02:19
has joined #general

bethskurrie
2020-06-19 03:08
@gstorck pending pacts is implemented, but WIP pacts is not yet.

bethskurrie
2020-06-19 03:09
The issue for the feature is here: https://github.com/DiUS/pact-jvm/issues/1131

tjones
2020-06-19 07:53
This page is excellent, Beth! I reckon we should do one for each language. In JS land, there?s `nock` (and others probably). In jvm at least Wiremock and RestAssured

bethskurrie
2020-06-19 07:53
Good point.

bethskurrie
2020-06-19 07:54
Maybe make headings for each language

bethskurrie
2020-06-19 07:54
would you like to do the nock one?

tjones
2020-06-19 07:54
Also, possibly worth an item on ?Mocking your favourite request framework?? I?ve seen a lot of JS unit tests where they straight up mock `axios` or `request`

bethskurrie
2020-06-19 07:54
good idea

tjones
2020-06-19 07:54
Happy to do the nock one

bethskurrie
2020-06-19 07:55
please!

yangyu823
2020-06-19 14:21
has joined #general

sklein
2020-06-19 19:23
has joined #general

tyler.collins
2020-06-19 21:07
has joined #general

nouri.tawfik
2020-06-20 08:31
Hello folks! The pact wip (pact working in progress) feature is available for . NET? Have a great day


bethskurrie
2020-06-20 08:52
Can you raise an issue asking for it to be implemented please?

nouri.tawfik
2020-06-20 08:55
Thank you @bethskurrie Oky

nouri.tawfik
2020-06-20 09:00
Done

tausif8709
2020-06-20 13:52
has joined #general

tom.shirley
2020-06-21 00:38
has joined #general

jacek.okrojek
2020-06-22 07:26
Hi All!

jacek.okrojek
2020-06-22 07:29
I wonder if enyone tried to adapt Pact for other protocols than XML/JSON over HTTP(s) and try to store contracts for in PactBroker ?

bethskurrie
2020-06-22 07:29
@jacek.okrojek you can store any type of JSON contract in the Pact Broker

bethskurrie
2020-06-22 07:30
> The Pact Broker is an application for sharing for consumer driven contracts and verification results. It is optimised for use with "pacts" (contracts created by the http://docs.pact.io/ framework), but can be used for any type of contract that can be serialized to JSON.


jacek.okrojek
2020-06-22 07:49
Thanks Beth, I wonder if you heard about someone who also created solution that fetchs cotracts from PactBroker and create from them stubs and also create sort of Pact DSL for custom protocol? Do you think it is worth digging into pact for this purpose or it would be easier to create custom solution?

bethskurrie
2020-06-22 07:49
Totally doable.

bethskurrie
2020-06-22 07:50
We're already considering grpc and peotobufs

jacek.okrojek
2020-06-22 07:51
Can you point me to some source that could give me some hints how to start

jacek.okrojek
2020-06-22 07:51
?

matt.fellows
2020-06-22 07:55
#protobufs

matt.fellows
2020-06-22 07:55
Head there Jacek, somebody recently blogged about doing it in Java.

matt.fellows
2020-06-22 07:56
It might be a great starting point for you

jacek.okrojek
2020-06-22 10:44
Thanks!

dattasai.chunduru
2020-06-22 12:18
Hi All I am trying to do a POST request by using PACT

dattasai.chunduru
2020-06-22 12:20
but it is giving me error as

dattasai.chunduru
2020-06-22 12:20
can anyone please help me on this

dattasai.chunduru
2020-06-22 12:41
I am using Java and Maven

phil.endsley
2020-06-22 12:44
There's a #pact-jvm-help channel you can post this too. Also, I think you'll need to provide more of the stack trace. The test is failing, but there should be more details where it actually failed

dattasai.chunduru
2020-06-22 12:47
My end point is like this

dattasai.chunduru
2020-06-22 12:48
actually it is saying it is not able to do POST action

dattasai.chunduru
2020-06-22 12:54
This is the full error I am getting

dattasai.chunduru
2020-06-22 12:54
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 8.793 sec <<< FAILURE! testPact(pact_post.pact_post.PactBaseConsumerTest) Time elapsed: 2.54 sec <<< FAILURE! java.lang.AssertionError: Pact Test function failed with an exception, possibly due to Mismatches(mismatches=[UnexpectedRequest(request= method: GET path: /comments query: {} headers: {Accept=[application/json, application/*+json], Connection=[keep-alive], Host=[kubernetes.docker.internal:54925], User-agent=[Java/14.0.1]} matchers: MatchingRules(rules={}) generators: Generators(categories={}) body: EMPTY)]) at http://au.com.dius.pact.consumer.junit.ConsumerPactTest.testPact(ConsumerPactTest.java:41) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75) Caused by: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Internal Server Error: [{ "error": "Unexpected request : \tmethod: GET\n\tpath: \/comments\n\tquery: {}\n\theaders: {Accept=[application\/json, application\/*+json], Connection=[keep-alive], Host=[kubernetes.docker.internal:54925], User-agent=[Java\/14.0.1]}\n\tmatchers: MatchingRules(rules={})\n\tgenerators: Generators(categories={})\n\tbody: EMPTY" }] at org.springframework.web.client.HttpServerErrorException.create(HttpServerErrorException.java:100) at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:172) at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:112) at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63) at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:782) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:740) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:674) at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:315) at pact_post.pact_post.ProviderService.getInformation(ProviderService.java:20) at pact_post.pact_post.PactBaseConsumerTest.runTest(PactBaseConsumerTest.java:54) at http://au.com.dius.pact.consumer.junit.ConsumerPactTest.lambda$testPact$0(ConsumerPactTest.java:32) at http://au.com.dius.pact.consumer.BaseMockServer.runAndWritePact(MockHttpServer.kt:110) at http://au.com.dius.pact.consumer.ConsumerPactRunnerKt.runConsumerTest(ConsumerPactRunner.kt:13) at http://au.com.dius.pact.consumer.junit.ConsumerPactTest.testPact(ConsumerPactTest.java:31) ... 38 more 2020-06-22 18:21:40.530 INFO 11840 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' Results : Failed tests: testPact(pact_post.pact_post.PactBaseConsumerTest): Pact Test function failed with an exception, possibly due to Mismatches(mismatches=[UnexpectedRequest(request= method: GET(..) Tests run: 1, Failures: 1, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 49.969 s [INFO] Finished at: 2020-06-22T18:21:40+05:30 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project pact-post: There are test failures. [ERROR] [ERROR] Please refer to C:\Users\dattasai.sukumar\Documents\workspace\pact-post\target\surefire-reports for the individual test results. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

gstorck
2020-06-22 13:02
thaanks~

dattasai.chunduru
2020-06-22 13:20
Actually in POST method also it is reffering for GET method

dattasai.chunduru
2020-06-22 13:20
it is giving me error as it is giving error for me as Failed tests:  testPact(pact_post.pact_post.PactBaseConsumerTest): Pact Test function failed with an exception, possibly due to Mismatches(mismatches=[UnexpectedRequest(request= method: GET(..)

chandanakurumeti27
2020-06-22 13:21
I would like to know how often there would be updates for pactbroker chart? and where can we find the updated versions of the same?

2020-06-22 13:33
A new post has been created in *Feature Requests*

phil.endsley
2020-06-22 13:50
I replied to the thread in the pact-jvm-help channel

nathan.deamer
2020-06-22 15:39
I have a question about webhooks. If I want to use the provider name in the webhook, how can I do that? e.g. https://my_ci_tool.client.com/{provider.name}/build?branch=master

nathan.deamer
2020-06-22 15:39
Maybe its {pactbroker.providerName}

nathan.deamer
2020-06-22 15:42
With the consumer and provider set to all

nathan.deamer
2020-06-22 16:10
This didn't work. I am trying to build a webhook where consumer: ALL provider:ALL Events: Contract published with changes content or tags

wesleythomaswilliams
2020-06-22 16:35
.

uglyog
2020-06-22 23:04
@dattasai.chunduru You have configured the expected interaction to be a POST request, but then your test is not making a POST request, but a GET request. The mock server is doing the correct thing. You told it it must receive a POST, so when it receives any other request it will fail the test.

naeem95m
2020-06-23 06:58
@a.smith I'm also working on a POC for my team to use Pact with NodeJS based Azure Functions. It would be great if you can share a sample pipeline structure. Thanks

2631133172
2020-06-23 07:21
has joined #general

giuseppe.salvatore
2020-06-23 10:57
Hi all! I know this might be a dumb question but potentially there could be use cases for this. So I would need to publish the verification results to pact broker and I know how to do it in the provide CI (using jvm maven junit4 for that) Publishing the results it's just a matter of adding an option to pom or a -Dpact.verifier.publishResults=true on the command line of the maven build

giuseppe.salvatore
2020-06-23 10:57
I am wondering if the results are stored as files and they can be published after the build

bethskurrie
2020-06-23 10:58
No

giuseppe.salvatore
2020-06-23 10:58
more or less like you can publish the pact contract from the consumer side with `mvn pact:publish`

bethskurrie
2020-06-23 10:58
The reason is that most build systems do not proceed to the next step once they hit a failure.

bethskurrie
2020-06-23 10:58
So, we had to do the publishing directly within the proccess.

bethskurrie
2020-06-23 10:58
If you want to get the verification results back again, you'll need to use the API.

giuseppe.salvatore
2020-06-23 10:59
ok thanks Beth, I guess that will do :+1:

bethskurrie
2020-06-23 10:59
what are you trying to do?

giuseppe.salvatore
2020-06-23 11:04
well... it's mainly a workaround that we will need to fix properly. We are running the CI with Jenkins X which provides build packs to run `mvn deploy` To run the verification we had to add a postbuild step and run `mvn deploy --Dpact.verifier.publishResults=true` which is time consuming and not really elegant but works. The proper solution with Jenkins X would be not to use the build pack and write the pipeline ourselves (doable) but I was just wondering if there was another option, like for example publishing the verification in a post build step

giuseppe.salvatore
2020-06-23 11:05
I guess I will have to go the proper way and writing the pipeline, not a big deal, we can do that

bethskurrie
2020-06-23 11:05
No - sorry.

matt.fellows
2020-06-23 11:45
Hmm, that should work Nathan. These are the default variables available

matt.fellows
2020-06-23 11:46
What?s the error you?re getting?

catalin
2020-06-23 15:20
has joined #general

rafael.espillaque
2020-06-23 16:18
Hi, I?m in the process of evaluating Pact for my services which communicate using messages. Some messages are Queries, where a message is the Request and another the Response. Those services will have cycles: Serv.A is the consumer AND the provider of Serv.B (because they read and write request and response messages). I?m a bit concerned that those cycles will complicate the CI pipeline flows. Have you seen this use case in the past? Anyone has something to read in this topic? Thanks a lot again!

chawlapriyanka29
2020-06-23 22:47
has joined #general

tjones
2020-06-23 23:43
@rafael.espillaque I would do something like this:

tjones
2020-06-23 23:56
How you cut the steps into pipelines is up to what makes sense for your CI system and implementation, but generally make sure that you avoid cycles

tjones
2020-06-23 23:57
You also might not want to allow B?s code change to do a deploy of A

bethskurrie
2020-06-23 23:57
The broker supports this usecase. It's been done before.

ravi.mijar
2020-06-24 05:57
Hello Dr. @tjones, is there a way to install pact for nodejs w/o the standalone binary that seems to get installed as a postscript?

tjones
2020-06-24 05:57
Pact-js is backed by the ruby binaries

tjones
2020-06-24 05:58
Why do you need to install them separately?

ravi.mijar
2020-06-24 05:58
restricted windows dev environment where it fails to download the zip file from github

tjones
2020-06-24 05:59
Ok. So you want to install the binaries separately?

tjones
2020-06-24 05:59
I believe this is possible, hold on

ravi.mijar
2020-06-24 05:59
yep


tjones
2020-06-24 06:00
Does this work for you?

ravi.mijar
2020-06-24 06:00
brilliant, let me try..

ravi.mijar
2020-06-24 06:22
yes, that worked. Thanks Dr. Jones.. :slightly_smiling_face:

tjones
2020-06-24 06:31
You?re welcome! Feel free to reach out if you have any further problems.

gerrelatanacio
2020-06-24 07:02
has joined #general

d.duraivelan
2020-06-24 08:57
has joined #general

luca.cervello
2020-06-24 13:11
has joined #general

poffey21
2020-06-24 15:22
has joined #general

poffey21
2020-06-24 15:27
@mike.geeves have you had much luck getting this going? I'd love to learn about your experience thus far - shamelessly I'm with GitLab and looking to see how we can work well with Pact!

hadjaliabir
2020-06-24 15:56
has joined #general

mike.geeves
2020-06-24 16:02
I got the first few bits going quite nicely, but not with the full end to end process, unfortunately distracted with other things. Still more to do around the "can-i-deploy" part for example. It works well having webhooks to do the validation after a new consumer update comes in, to trigger a build on the provider side. I'm happy to share the steps, but I wouldn't say it's following best practices and so on just yet

poffey21
2020-06-24 16:03
For sure! I'm hoping to get an example out on our blog. Any information you have would be great. I'd be happy to send props your way too.

rafael.espillaque
2020-06-24 16:58
@tjones going back to the flow you shared a few messages above, Red?s consumer test would trigger a webhook for Blue build but Blue wasn?t merged into master because Blue consumer tests are still failing. Blue?s master wouldn?t have Red?s provider code. I guess I?d need to manually run Blue?s build using the correct branch, right? I guess webhooks would only trigger builds in master.

rafael.espillaque
2020-06-24 17:15
I guess that?s a question for everybody: Do webhooks always trigger builds on the master branch? I don?t understand how webhooks triggers usually work

phil.endsley
2020-06-24 17:24
I'm going to take a stab at this, because it's only a matter of time before we have the same scenario. As I understand it, you would need to break up feature development in a way that only one part (consumer or provider) is changing at a time for Red or Blue. If you have two applications that are a consumer/provider for each other, you can't make changes to both contracts in parallel and safely merge them. You would have to coordinate the merges. This isn't safe, because now you have to coordinate the releases of Red and Blue. So, I think you would want to: ? Change/update Red's Consumer contract ? Implement provider changes on Blue (without breaking Blue's contract with Red) ? Merge Blue, then merge Red ? Repeat for Blue Doing it that way would let you release Red/Blue individually, because you'll have compatible versions

phil.endsley
2020-06-24 17:26
I would still like to hear from @tjones or someone else

rafael.espillaque
2020-06-24 17:27
I see? it?s like working on the contract of the Request message first and merge everything. And after that, work on the contract of the Response message and merge everything. Is that what you?re saying?

phil.endsley
2020-06-24 17:28
If you make changes to the contract for Blue in a way that makes Red fail verification, And you change the contract for Red in a way that makes Blue fail verification You wouldn't be able to merge those into your main branch, since there wouldn't be any verification against the latest version of main branch against that feature branch (Since they depend on each other)

phil.endsley
2020-06-24 17:29
Yes. So the feature won't be ready to ship until both are done, but this way, you'll have versions that are backwards compatible

rafael.espillaque
2020-06-24 17:31
> since there wouldn?t be any verification against the latest version of main branch against that feature branch (Since they depend on each other) I was thinking that having a verification against a feat-X tag would be enough to be able to merge into master

phil.endsley
2020-06-24 17:34
`provider-red-feat-x` verifies `consumer-blue-feat-x` `provider-blue-feat-x` verifies `consumer-red-feat-x` `provider-red-master` fails verification with `consumer-blue-feat-x` `provider-blue-master` fails verification with `consumer-red-feat-x` If neither `feat-x` tags have verified with master, how would you safely merge one?

phil.endsley
2020-06-24 17:37
I think I had the master one backwards. I edited it

rafael.espillaque
2020-06-24 17:43
I see?

rafael.espillaque
2020-06-24 17:43
I?ll wait for @tjones and @bethskurrie input as well

kristine.jetzke
2020-06-24 20:23
Short answer AFAIK: no

kristine.jetzke
2020-06-24 20:25
I think you can also trigger builds on other branches

kristine.jetzke
2020-06-24 20:32
You can pass https://docs.pact.io/pact_broker/advanced_topics/api_docs/webhooks#dynamic-variable-substitution to the webhook and use them to check out specific branches

kristine.jetzke
2020-06-24 20:42
hm? I realized I misunderstood your question. I was thinking about the consumer not being on master branch. But I guess it is about the provider not being on master branch?

kristine.jetzke
2020-06-24 20:45
If it was about the consumer, it can work like this: ? Consumer develops new feature in branch `feature-a` ? Contract gets tagged with branch name `feature-a` ? Provider CI build is triggered via webhook, webhook payload includes the consumer tag `feature-a` via variable `${pactbroker.consumerVersionTags}` ? Provider build checks that it?s own master fulfills contract from `feature-a` ? Consumer can safely merge to master

kristine.jetzke
2020-06-24 21:01
For the reverse I?m not sure. If the branch names are the same in consumer and provider it could look like this: ? Consumer and provider both create a feature branch `feature-a` ? Consumer published contract from this branch ? Provider CI build gets triggered via webhook, takes value `feature-a` from `${pactbroker.consumerVersionTags}` and checks out own `feature-a` branch ? Verifies that own `feature-a` branch fulfills consumer `feature-a` branch ? Provider merges to master ? Consumer merges to master :thinking_face:

rafael.espillaque
2020-06-24 22:27
that was very helpful. I was interested on both flows

rafael.espillaque
2020-06-24 22:28
thanks a lot

chawlapriyanka29
2020-06-25 00:42
Hey.. I am new to Pact Testing.. I just have a quick question.. So I have 2 swagger files at the provider side against which I can validate my consumer.. So I thought of creating 2 pacts between one consumer and provider.. My question is can I have 2 pact files one can verified against one swagger file and other against the other one

matt.fellows
2020-06-25 00:44
Why do you have 2 swaggers for a single provider? But as far as pact goes, you _could_ create two separate pacts (but you would need to give the provider two names for that to work). But I wouldn?t, it?s logically one provider (assuming it is deployed as a single unit)

matt.fellows
2020-06-25 00:44
Pact also doesn?t verify the swagger, they are orthogonal concerns. So you can keep your swagger files there if that?s something that?s useful to have. But Pact doesn?t care about swagger

chawlapriyanka29
2020-06-25 00:48
So the scenario is I have 2 swagger files one for legacy system and one is the new one.. There are some api calls in my contract tests which are for legacy system and some are for new system.. So in that case I want both my pacts to be verified against those 2 swagger files

matt.fellows
2020-06-25 00:48
Is it one provider or two providers? where a provider is an API that is a single, deployable unit?

chawlapriyanka29
2020-06-25 00:49
There is one provider

matt.fellows
2020-06-25 00:49
> So in that case I want both my pacts to be verified against those 2 swagger files Pact doesn?t care about swagger files, it just cares about the API target itself

matt.fellows
2020-06-25 00:49
ok cool, then I?d create a single pact contract

phil.endsley
2020-06-25 00:50
Two consumers? You mentioned a legacy and new system

chawlapriyanka29
2020-06-25 00:50
2 swagger files at the provider side

matt.fellows
2020-06-25 00:51
Is it just a single consumer application talking to that provider?

chawlapriyanka29
2020-06-25 00:51
For now it is just one.. but there can be many

chawlapriyanka29
2020-06-25 00:52
Is there a way I can have 2 contracts ?

chawlapriyanka29
2020-06-25 00:53
I mean is there a possibility to support multiple pact files for a single consumer

matt.fellows
2020-06-25 00:53
Why would you want to do it, is the question?

matt.fellows
2020-06-25 00:53
A contract is between a single consumer <-> provider pair. Knowing this relationship is what makes all of the CI/CD workflows with the Pact Broker work. For example, answering the question ?is it safe to release consumer A to production?

matt.fellows
2020-06-25 00:54
having multiple contracts complicates this relationship.

chawlapriyanka29
2020-06-25 00:57
Yes I know that..but let's suppose there is API call named getXy() which is for the legacy system and it is in legacy swagger file and there is API call addPY() which is for the newer system and the newer swagger supports it.. what should I do in that case

matt.fellows
2020-06-25 00:57
I?m not understanding how Swagger has anything to do with this. Swagger is just a document that describes how your underlying API works. It isn?t a functional thing you can test.

matt.fellows
2020-06-25 00:58
Pact will test your API, it doesn?t know your swagger document even exists

chawlapriyanka29
2020-06-25 00:59
But what I mean to say is there is legacy system let's suppose v1 for which one swagger file is created and there is another system v2 for which another swagger file is created.. and my contract tests needs to test both

chawlapriyanka29
2020-06-25 00:59
But at provider side.. My code verifies against the swagger file and it's request and response

matt.fellows
2020-06-25 01:00
If indeed the legacy system and new system are _separate providers_ then I would create 2 contracts - `Consumer` -> `Legacy Provider` and `Consumer` -> `New Provider`

chawlapriyanka29
2020-06-25 01:00
I mean the yaml file

chawlapriyanka29
2020-06-25 01:00
What do mean by that ?

abubics
2020-06-25 01:01
It does make conceptual sense to have one pact per pair of bounded contexts, but practically it makes more sense to have one per codebase pair :upside_down_face:

matt.fellows
2020-06-25 01:01
yeah

matt.fellows
2020-06-25 01:02
Priyanka - When your provider team makes a change to the legacy system, will it get deployed with the new api? Or are they deployed separately? i.e. is the Provider an API that supports the legacy and modern API?

matt.fellows
2020-06-25 01:02
Because if it?s all one code base that gets deployed, then i would strongly recommend you have a single contract between the consumer and the provider

matt.fellows
2020-06-25 01:03
I know where you?re coming from, but unless you are actually experiencing issues I think you?re worrying about problems that don?t exist

matt.fellows
2020-06-25 01:03
yes. more specifically, the ?deployable unit?

matt.fellows
2020-06-25 01:06
I realise I never answered this directly. Yes absolutely, a single consumer can have relationships with many providers. But in your case, I think you just have a single provider we?re talking about

bethskurrie
2020-06-25 01:07
This

chawlapriyanka29
2020-06-25 01:11
Matt I can understand your point but it's like 2 pods are running the services each has its own yaml but has the same code base.. So I am bit confused

chawlapriyanka29
2020-06-25 01:16
Does it seem like I should have a 2 providers then..

tjones
2020-06-25 01:17
This is a good discussion! Thanks for the additional input @phil.endsley- here?s some thinking on breaking changes: Generally when making breaking changes between A and B, you?d need a version of one that speaks both versions of the other. Sometimes the design dictates whether that?s the consumer or the provider, and sometimes you get to choose. Ideally, this still holds true for when A and B are both consumers of the other - from a strictly theoretical perspective, it should be possible to view the contracts as independent. This is sort of illustrated in the diagram from yesterday, because a contract change for one service doesn?t affect the other?s contract. With a circular contract between A and B, it?s possible that certain design choices might result in it being impractical to modify both contracts at the same time. I haven?t run in to this, but then I haven?t had much personal experience with circular contracts. My gut feel is that if this is happening, there?s an anti-pattern somewhere

tjones
2020-06-25 01:20
@rafael.espillaque, to your specific question about branches, I?m not sure I fully understand the picture. It sounds like the branching and tagging strategy might not be aligned? Ideally, you wouldn?t need to manually kick off any provider verifications

tjones
2020-06-25 01:22
(but of course, if this works for you, there?s no reason to forbid it. Testing is about risk reduction, and if you?re still getting the risk reduction you need without adding extra risks or overheads, then it?s fine)

abubics
2020-06-25 01:23
It does feel like you might be conflating a few technologies here (e.g. Kubernetes, Swagger, Pact, YAML, etc) that aren't intrinsically related to the problem you're trying to solve. I'd recommend stepping back from the implementation details, and try to talk about it in terms of higher-level concepts and building blocks.

tjones
2020-06-25 01:27
In swagger land, people often talk about the swagger document being a ?contract?. This is a different meaning to the contract as we use it in pact. Here are some of the differences: 1. A swagger document says ?I accept these requests? and ?I can generate these responses?. A Pact contract says ?For this request, I expect this response? 2. A swagger document is only from the provider?s perspective. A Pact contract is between a specific consumer and a specific provider. 3. A swagger document typically describes the whole API. A Pact contract only describes the parts of the API that the specific consumer uses.

tjones
2020-06-25 01:27
There are probably more differences

matt.fellows
2020-06-25 01:32
Indeed

matt.fellows
2020-06-25 01:33
Furthermore, Pact is not just about the contract. The whole purpose of doing this is not to ?generate a contract? but to get confidence that two applications can communicate, and to use that information to release and deploy systems safely.

matt.fellows
2020-06-25 01:33
Generating a contract is really a side-effect of the process - an important one for it to function - but it?s not the _end_ in and of itself

abubics
2020-06-25 01:53
I feel like some of this info must be in the docs :troll: I'm not familiar enough with them to point anyone to the right spots, though :upside_down_face:


bethskurrie
2020-06-25 01:53
> The reason the pact file exists is to ensure the tests in both projects are kept in sync - it is not an end in itself. Manually writing or generating a pact file from something like a Swagger document would be like marking your own exam, and would do nothing to ensure that the code in the consumer and provider are compatibile with each other.

kristine.jetzke
2020-06-25 07:36
:slightly_smiling_face: For the second flow though I?m not sure how ?notification? works e.g. how do you know that you can safely merge.

thomas.rychlik
2020-06-25 07:57
has joined #general

mike.geeves
2020-06-25 10:11
the repos aren't in a sharable state yet - I'm trying to build up a set of a couple of consumers and a couple of providers (and I would need to check what's in there that shouldn't be in terms of did anyone commit in keys etc)

mike.geeves
2020-06-25 10:12
however, gitlab ci

mike.geeves
2020-06-25 10:12
Here's one of the consumers

mike.geeves
2020-06-25 10:13
I'm not sure how much would make Beth, Matt etc angry or sad but .. :smile:

mike.geeves
2020-06-25 10:14
I tried in the consumer part to go through looking for providers to verify against and then make a webhook against the repo after searching to find their name to get the project id via the gitlab API :thinking_face: it's a bit of bash-fu

mike.geeves
2020-06-25 10:15
The provider part is then

mike.geeves
2020-06-25 10:15
with more bash-fu in the pact-verify

mike.geeves
2020-06-25 10:18
we build the docker images as step 1 to then run tests, deployment against that built image rather than just "against the files", so this was partly then going towards what other dependencies need to be spun up - i.e. you have the docker network created for just these containers, the provider will then need (for example) a postgresql container setup and linked in and then provide the state - I didn't get onto progressing that part

mike.geeves
2020-06-25 10:21
Note: this was following something I was playing around with, that definitely isn't best practice - because you can handle the webhooks arguably "better" via the broker itself, BUT: what I was trying to do with this approach is make it more of the gitlab pipeline, I like having the flow of steps going through and it's "valuable" for me to be able to see the consumer build having the waiting patiently for the provider verification step, and then failing or passing that step as part of the consumer build, so you can see within the gitlab pipelines what has happened

mike.geeves
2020-06-25 10:24
For reference, this is using pipeline-trigger from https://gitlab.com/finestructure/pipeline-trigger > Pipeline-trigger allows you to trigger and wait for the results of another GitLab pipeline which worked quite nicely :slightly_smiling_face:

mike.geeves
2020-06-25 10:40
The other way could be useful, if you could get the pact tests into swagger docs We have a lot of very useless swagger (auto generated from spring) files which do technically contain the model etc but since nobody puts in valid request/responses, or at least keeps it up to date it is not helpful (I'm currently playing with FastAPI and pydantic and omg drool)

suma.papanna
2020-06-25 10:52
has joined #general

naeem95m
2020-06-25 11:06
Not able to configure webhook, even though I have followed exact steps in CI/CD workshop. It would be great if anyone can help?

matt.fellows
2020-06-25 11:09
`403` forbidden tells me it?s highly likely you haven?t got the correct API token from Travis configured

naeem95m
2020-06-25 11:12
using this token as secret in pactflow

matt.fellows
2020-06-25 11:13
You could please share the contents of that webhook test dialog?

naeem95m
2020-06-25 11:14
```[2020-06-25T11:14:07Z] DEBUG: Webhook context {"base_url":"https://mnaeem.pact.dius.com.au"} [2020-06-25T11:14:07Z] INFO: HTTP/1.1 POST https://api.travis-ci.com/repo/mnaeem95%2Fexample-provider/requests [2020-06-25T11:14:07Z] INFO: accept-encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3 [2020-06-25T11:14:07Z] INFO: accept: application/json [2020-06-25T11:14:07Z] INFO: user-agent: Ruby [2020-06-25T11:14:07Z] INFO: content-type: application/json [2020-06-25T11:14:07Z] INFO: travis-api-version: 3 [2020-06-25T11:14:07Z] INFO: authorization: [REDACTED] [2020-06-25T11:14:07Z] INFO: host: http://api.travis-ci.com [2020-06-25T11:14:07Z] INFO: content-length: 512 [2020-06-25T11:14:07Z] INFO: {"request":{"message":"Triggered by changed pact for pactflow-example-consumer version cc6b02b+1593080393","branch":"master","merge_mode":"deep_merge_append","config":{"env":{"global":["PACT_URL=https://mnaeem.pact.dius.com.au/pacts/provider/pactflow-example-provider/consumer/pactflow-example-consumer/pact-version/afc6e91b38b47ad457266f7f223b7a2a3c6e0382/metadata/Y29uc3VtZXJfdmVyc2lvbl9udW1iZXI9Y2M2YjAyYiUyQjE1OTMwODAzOTMmY29uc3VtZXJfdmVyc2lvbl90YWdzW109bWFzdGVyJmNvbnN1bWVyX3ZlcnNpb25fdGFnc1tdPXByb2Q="]}}}} [2020-06-25T11:14:07Z] INFO: HTTP/1.1 403 Forbidden [2020-06-25T11:14:07Z] INFO: date: Thu, 25 Jun 2020 11:14:07 GMT [2020-06-25T11:14:07Z] INFO: content-type: text/html;charset=utf-8 [2020-06-25T11:14:07Z] INFO: transfer-encoding: chunked [2020-06-25T11:14:07Z] INFO: connection: keep-alive [2020-06-25T11:14:07Z] INFO: strict-transport-security: max-age=15724800; includeSubDomains [2020-06-25T11:14:07Z] INFO: x-oauth-scopes: [2020-06-25T11:14:07Z] INFO: vary: Accept-Encoding [2020-06-25T11:14:07Z] INFO: x-request-id: 2dafc2cc179f6b7877d6937ada6af10d [2020-06-25T11:14:07Z] INFO: access-control-allow-origin: * [2020-06-25T11:14:07Z] INFO: access-control-allow-credentials: true [2020-06-25T11:14:07Z] INFO: access-control-expose-headers: Content-Type, Cache-Control, Expires, Etag, Last-Modified, X-Request-ID [2020-06-25T11:14:07Z] INFO: access denied [2020-06-25T11:14:07Z] INFO: Webhook execution failed```

matt.fellows
2020-06-25 11:19
looks ok

matt.fellows
2020-06-25 11:20
I just reproduced the issue by mis spelling the token variable in the webhook - so it was blank

matt.fellows
2020-06-25 11:20
can you please show me your webhook configuration screen?

matt.fellows
2020-06-25 11:22
you have basic auth credentials added down the bottom (perhaps your browser auto-filled them?)

matt.fellows
2020-06-25 11:22
please remove them

naeem95m
2020-06-25 11:24
Ohhk, my bad. It's working now.

naeem95m
2020-06-25 11:24
Thanks a lot for the help!

matt.fellows
2020-06-25 11:24
you?re welcome!

matt.fellows
2020-06-25 11:28
I?ve just made a small fix to prevent browsers from doing that. I?ll release that tomorrow

naeem95m
2020-06-25 11:29
Cool

rafael.espillaque
2020-06-25 13:09
I wouldn?t say I?m hitting any anti-patterns. My services are using CQRS and Event Sourcing so for them it?s very common to have a message (no http interactions) that triggers some action (a command message) and then waits for an event message. In that scenario, Service A is the producer of the Command and the consumer of the Event. Service B is the consumer of the Command message and the provider of the Event message. I?m concerned that those circular dependencies will complicate merging and deploying so much that Pact and the Pact broker will stop us to delivery as fast as possible.

matt.fellows
2020-06-25 13:27
I think it's fine, you'll just need to (unfortunately) five different names to the http and message part of that provider (the broker does not yet support a provider being in both roles at once)

rafael.espillaque
2020-06-25 13:29
sorry, I don?t have any http interactions. I just wanted to highlight that we?d use messaging contracts

lmcfadden03
2020-06-25 13:54
has joined #general

tjones
2020-06-25 14:19
I?m keen to better understand the problem you?re facing. Are you asking about a situation where the next version of the service (the version immediately after the merge) is not compatible with both the new and the old versions? You might know this already, but there?s a subtlety in that pact verification works against a contract, not a version. This means you don?t need to over-verify - if the contract that master produces is identical to a previously-verified contract, then verification doesn?t need to be done. See here for more info: https://docs.pact.io/getting_started/versioning_in_the_pact_broker

rafael.espillaque
2020-06-25 14:24
not exactly that, give me a few minutes in order to explain my use case in depth

rafael.espillaque
2020-06-25 14:24
thanks btw!

tjones
2020-06-25 14:31
You?re welcome! Pact should only really block you from deploying software that won?t work in your ecosystem, so if it?s slowing you down in other ways I?m keen to hear about it. We can probably improve something - whether it?s planning new features or just better documentation.

tjones
2020-06-25 14:31
It?s bedtime here in my time zone, but I?ll check back tomorrow.

rafael.espillaque
2020-06-25 14:33
```Service A is interested on some data that Service B exposes. Service B has a QueryHandler method that receives GetDocument messages and returns Document messages. (QueryHandlers are something managed by the framework I use but you can think that there's a Message Broker in the middle of both services.) Service A is the consumer of the Document message and the provider of the GetDocument message. Service B is the consumer of the GetDocument message and the provider of the Document message. Service A and B are in a circular cycle. Service A can't deploy because the contract for Document is not verified. Service B can't deploy because the contract for GetDocument is not verified.```

rafael.espillaque
2020-06-25 14:33
thanks Tim! rest well!

tjones
2020-06-25 14:35
In your scenario, is deploying the same as merging to master?

rafael.espillaque
2020-06-25 14:36
yes, merging would mean deploying to test or stage environment

rafael.espillaque
2020-06-25 14:37
but not really deploying to prod directly

tjones
2020-06-25 14:38
In the feature branch for the producer, are you also verifying against the master pact from the consumer?

rafael.espillaque
2020-06-25 14:40
I haven?t built the pipelines yet, just learning about workflows following the workshop and the pact nirvana. I guess I wouldn?t? isn?t that something related to the new WIP Pact feature?

tjones
2020-06-25 14:43
My gut is that you would want to verify against your consumer?s master and your consumer?s corresponding feature branch, otherwise you?re unlikely to know if it?s safe to merge

rafael.espillaque
2020-06-25 14:44
yeah, makes sense

tjones
2020-06-25 14:46
I might have a different view after sleep, though. It sounds like your CI setup is different to my personal preferences (to be clear, I don?t think it?s a bad setup, it?s just different), so maybe I missed something.

tjones
2020-06-25 14:47
I?ll check in again tomorrow. I think you should be able to design a process that?s fairly painless.

rafael.espillaque
2020-06-25 14:48
I?m open to any CI setup, I?ll let you rest!

rafael.espillaque
2020-06-25 14:49
wtf 12:49 AM and talking with me? go to bed!

tjones
2020-06-25 14:49
I don?t think you need to change it :+1: - in particular, I?d like Pact to not force opinions on CI setup, or at least to be as broadly useful as possible.

ayyamuthutechnical
2020-06-25 16:35
has joined #general

ayyamuthutechnical
2020-06-25 16:38
Hi, My name is Ayyamuthu. Currently working in pact with python for microservices. Happy to be part of this group.


tausif8709
2020-06-25 17:24
Hi Guys, I am doing a POC on pact-python for microservices , could you please advice on the best approach for testing the consumer pacts locally by setting up dummy provider states? Thanks in advance :slightly_smiling_face: Tausif

phil.endsley
2020-06-25 17:26
You may get more targeted help in #pact-python

matt.fellows
2020-06-26 03:08
How?d you go with it?

tjones
2020-06-26 04:01
@rafael.espillaque: I drew this to try to reason about your situation:

tjones
2020-06-26 04:02
This shows the branches for the two codebases, and the theoretical verification status, if you were to run all verifications

tjones
2020-06-26 04:03
I think you could consider it safe to merge anything where all verifications were green

tjones
2020-06-26 04:04
Then, if you rebase Consume GetDocument, you would get:

tjones
2020-06-26 04:05
(repeat until all branches are merged)

tjones
2020-06-26 05:36
Further to Beth?s comments above, there have been many good discussions in here recently- it would be great to capitalise on that momentum along with our documentation drive. If you?d like to contribute, but don?t see any code examples issues for you to pick up in your framework of choice, here are some more ways you can help: 1. Is there anything you?re aware of that you?d like to see covered better in the documentation? 2. Is there anything in the documentation you found hard to find? 3. Is there anything that you?d like to contribute to the documentation? At the moment, the documentation is mostly written by the core team, but we?d love to have more community input - another great place to start could be best practice or cookbook articles, especially from those with more complex or elegant pact use cases

dattasai.chunduru
2020-06-26 06:19
Hi @matt.fellows Thank you :slightly_smiling_face: I have used @PactBroker option and it is working

bethskurrie
2020-06-26 08:26
If you want to embed the verification into your consume pipeline rather than use webhooks, that can work.

bethskurrie
2020-06-26 08:27
You want to run can I deploy before running the verification to make sure you're not doing it unnecessarily.


bethskurrie
2020-06-26 08:28
Scroll down to the section on what to do if you can't use webhooks.

mike.geeves
2020-06-26 08:29
Sad face, I had the brief flurry of activity now about a month ago but haven't had time to progress since :(

mike.geeves
2020-06-26 08:29
I think the can I deploy was the last bit you mentioned to try next :)

rafael.espillaque
2020-06-26 09:23
thanks for that Tim, I think I get it. In summary, carefully splitting code changes into different branches so that interactions can be merged one at a time

naree.song
2020-06-26 10:54
has joined #general

adam.pike.ap
2020-06-26 12:06
has joined #general

adam.pike.ap
2020-06-26 12:14
Hello all, I have a question about how to work with multiple contracts between the same two apps. What's the best practice here? should I name them each after their respective feature / business requirement? If so is there a way that I can still associate them to show that they live in the same 2 apps when viewing the Pact Broker's network diagram?

matt.fellows
2020-06-26 12:20
What do you mean multiple contracts between the same two apps? A contract should be the collection of all interactions between them - i.e. a 1-to-1 mapping

adam.pike.ap
2020-06-26 12:26
Our case is that we have a web app that has multiple http clients, some of those are using axios some are graphql

adam.pike.ap
2020-06-26 12:26
so I thought it best to define a contract per client

adam.pike.ap
2020-06-26 12:28
the site is a very high traffic UK store

adam.pike.ap
2020-06-26 12:38
Perhaps a better questions is - is it possible to have multiple consumer tests contribute to one contract? If so how and how good would this look when viewing the contract in Pact Broker?

naz
2020-06-26 13:05
has joined #general

rafael.espillaque
2020-06-26 13:06
I?d say that?s a very common use case and Pact is designed to handle that. Each client would have its own Contract with its own expectations.

chandanakurumeti27
2020-06-26 13:24
Hi Beth, could you please provide some link in js where there are two different providers for specific consumer and where it generates two diferent pacts from one test.

naz
2020-06-26 14:05
Hi everyone. I'm a tech lead at a fintech in London and currently exploring the idea of using Pact. I've managed to get client tests working but I'm confused as to how providers are tested. How can I set up the db etc in a provider before tests are run? Do I *have* to expose a URL that does the setup when called?

naz
2020-06-26 14:07
I guess a better way to phrase my question is: what's the best practice for setting provider states prior to running tests?

mohammad.hasan
2020-06-26 14:09
has joined #general

antonello
2020-06-26 14:15
It should be a responsibility of the provider to set the state based on the provider state stated in the interaction. Which languages are your providers in?

antonello
2020-06-26 14:16
Also - ideally you wouldn?t use a real database in your provider tests, but mock at a sensible layer, depending on what?s feasible.

zbintliff
2020-06-26 14:17
We use the full DB (postgres) via docker compose an have hooks to where each test runs in a transaction and roles back. It definitely copmlicated things. But to answer your first question. Yes the provider listens to `/setup` . ours is in Go so we take the router and add a new path then have a case statement based on "state" param to setup the DB for the test.

sklein
2020-06-26 14:59
Hello everyone, is there a way to exclude contracts with an unknown success (???) in `can-i-deploy` or prevent them from failing the verification? We'd like to allow consumers the ability to add contracts with providers that have not yet implemented the verification workflow yet. Alternatively, is it just best practice to always have the provider verification pipeline setup before a consumer adds their contracts?

adam.pike.ap
2020-06-26 15:08
That seems logical to me too, but I wanted to keep the contracts from 1 app described as being from 1 app in the Pact Broker network graph too.

adam.pike.ap
2020-06-26 15:10
How can I name those contracts in a way that allows for this?

adam.pike.ap
2020-06-26 15:18
Hi Sean, you can use consumer version and tags to ensure that your provider only runs pipeline against the version that they currently have developed for. Version could be your git hash and tag could be your branch for example. I think there is also an extra 'WIP' feature when you use PactFlow.

sklein
2020-06-26 15:20
Thanks for the reply. We have that working for providers, but right now I have a failed consumer verification because it has a contract against a provider where the contract hasn't been verified (because the provider hasn't implemented the verification workflow yet)

sklein
2020-06-26 15:20
Maybe i'm missing something?

hadjaliabir
2020-06-26 15:27
Hello, i am new to contract testing ! what are the basics i should know to automate my test ?

wesleythomaswilliams
2020-06-26 15:31
It might not be a bad thing for them to appear separate on the network graph as <service>_<type>. I have services that use both REST and Kafka and I wish I could tell which connections on my network graph were which.

naz
2020-06-26 15:34
What's the best way to deal with cookies/auth? We currently pass user cookies in service to service calls so they can perform relevant ACL checks. These can't be mocked because they'd become stale.

naz
2020-06-26 15:36
@antonello Everything is in Python. We'd rather *not* mock the db as we lose confidence our services run as expected

adam.pike.ap
2020-06-26 15:37
I haven't used can-i-deploy yet but the way I read it, is that you will be using the result of a provider verification to ensure you haven't broken the contract. I would guess that in your case, since the contract has not been fulfilled yet but you still want to deploy, there is no need to use can-i-deploy? But this is with the caveat that you are deploying an app that makes requests to a currently non-existent end point. I'm guessing you have it under a feature-toggle?

naz
2020-06-26 15:37
@zbintliff So am I right in understanding that your provider will listen for a `/setup` call and then setup the db? How do you reset it between provider tests?

sklein
2020-06-26 15:38
Well not entirely. I only want any success = false to gate the deploy. I can write some sh to grep for that, but was hoping more for a cli flag.

zbintliff
2020-06-26 15:39
I have hooks to on the db client. So rather than stub and mock we just set it up as transaction and reset before and after. TBH ours is definitely clunky but once it was set up we haven't had to change it in a long time

sklein
2020-06-26 15:39
the endpoint currently exists. we're going through the process of adding contract testing to an existing eco system of many microservices and apis

zbintliff
2020-06-26 15:39
we do tx's so that the we know the exact state and it doesn't impact things

zbintliff
2020-06-26 15:40
we even run queries to reset seq for ids. so that creates give the exact ID we are expecting

adam.pike.ap
2020-06-26 15:40
sounds familiar :slightly_smiling_face:

adam.pike.ap
2020-06-26 15:42
My approach has been to set up the broker and start adding consumer-provider verification pairs before adding to CI with can-i-deploy. Gives the teams a chance to play with it and learn before introducing it to CI.

phil.endsley
2020-06-26 15:57
I haven't done anything with cookies specifically. But the docs have a couple items I've read about https://docs.pact.io/provider/handling_auth https://docs.pact.io/faq/#how-do-i-test-auth-cookies

naz
2020-06-26 16:18
These are fantastic links, thanks. Not sure how I missed them.

phil.endsley
2020-06-26 16:39
If you're just starting out, I would start here: https://docs.pact.io/getting_started/ The ci/cd workshop is also excellent, and walks through setting up a ci/cd pipeline: https://docs.pactflow.io/docs/workshops/ci-cd/

hadjaliabir
2020-06-26 20:08
Thank you for your help :blush:

matt.fellows
2020-06-26 22:14
Provider states and/or request filters usually solve this. What language do you use?

matt.fellows
2020-06-26 22:14
Hmmmm

matt.fellows
2020-06-26 22:16
How would you _always_ know that an unknown success is ok to release? It could be that it's just not had a chance to have a verification (that may well fail) yet

matt.fellows
2020-06-26 22:17
It feels like for those cases you already have prior knowledge they are compatible. I wonder if it's better for us to make it easier to setup pre existing component status than to do this

phil.endsley
2020-06-26 23:08
@matt.fellows I've been thinking about this all day. I think we're going to run into this same issue, since we're going to roll this out by teams, and some some will implement it quicker than others

phil.endsley
2020-06-26 23:11
So here's my half baked idea: add a flag to `can-i-deploy` that acts kind of like pending pacts do for providers. If a consumer has never had any verifications for a provider, it will warn you, but still allow it? It seems like that would cover the teams are migrating. If there has ever been a verification (pass or fail), it would fail

phil.endsley
2020-06-26 23:13
Haven't thought it through all the way...like if it would work for going to multiple stages. It would work fine until the provider goes to dev? But then, that would block the consumer deploying to prod, because the provider is now in dev? Still some things to think about...just wanted to get my thoughts down somewhere before I lost them

phil.endsley
2020-06-26 23:13
Curious how other companies have done this. Aside from not leveraging can-i-deploy until everyone has pacts?

phil.endsley
2020-06-27 00:02
Yeah, I thought about this more. We would just do each pact in a feature branch and let it sit until the provider gets it implemented. Ideally, teams will have some level of communication so they're on the same level with expectations

princiya.marina
2020-06-27 10:08
has joined #general

princiya.marina
2020-06-27 10:13
Hello everyone :wave: I am trying pact-js for the first time. The tests always timeout and never get executed. I also tried running the pact-js-workshop material, same problem, also the same problem when running in a Docker container. Node version: tried both v10 and v12 MacOS Catalina `Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Error` I also tried increasing the jest timeout, but doesn't work. ```console.error node_modules/jest-jasmine2/build/jasmine/Env.js:290 TypeError: Cannot read property 'writePact' of undefined``` Does anyone else have similar problems?

matt.fellows
2020-06-27 11:22
Welcome! Have you tried increasing the timeout?

matt.fellows
2020-06-27 11:23
They definitely work. I might add a Travis build to it just to make sure and make it easy fir people to submit bugs

princiya.marina
2020-06-27 11:31
yes, increased the timeout to even 50000. same problem. so not sure what this problem is :disappointed:

matt.fellows
2020-06-27 11:32
Have you tried the troubleshooting steps shown on the pact is readme?

matt.fellows
2020-06-27 11:33
Are you on a work/corporate network? Are there any errors during installation? What do the debug logs say? Share those results in this thread as attachments/code formatted and we'll see if we can track it down

princiya.marina
2020-06-27 11:40
home wifi. on my local machine, I have a Pact Binary error. ```[2020-06-26T05:52:47.414Z] ERROR: pact-node@10.9.5/48869 on fritz.box: Pact Binary Error: /Users/p.s 1/workspace/admin-web/node_modules/@pact-foundation/pact-node/standalone/darwin-1.85.0/pact/lib/ruby/bin/ruby: line 14: 1/workspace/admin-web/node_modules/@pact-foundation/pact-node/standalone/darwin-1.85.0/pact/lib/ruby/lib/ruby/gems/2.2.0: No such file or directory``` There is a space in my `/Users/p.s 1/` and that's why the error `No such file or directory` . So I tried in a Docker container, the above error isn't there, but the following error: ```[2020-06-26T05:44:25.039Z] ERROR: pact-node@10.9.5/28 on 1693f09a7469: (errno=ENOENT, code=ENOENT) -- syscall: spawn standalone/linux-x64-1.85.0/pact/bin/pact-mock-service -- path: standalone/linux-x64-1.85.0/pact/bin/pact-mock-service -- spawnargs: [ "service", "--consumer", "hero-consumer", "--cors", "true", "--pact_dir", "/usr/app/pacts", "--host", "127.0.0.1", "--log", "/usr/app/logs/pact.log", "--pact-file-write-mode", "update", "--port", "8080", "--provider", "hero-provider", "--pact_specification_version", "2" ]```

elliottmurray
2020-06-27 12:40
Python right? We haven?t implemented that yet. It is actually part of the next frequent in working on

ag.robinson
2020-06-27 15:38
has joined #general

tjones
2020-06-29 02:16
Are you waiting for the setup promises to resolve before trying to run the tests?

matt.fellows
2020-06-29 02:19
it may be a problem with your path

matt.fellows
2020-06-29 02:19
I can see a space and full stop in it - could you please try from a directory without? That may be the bug

matt.fellows
2020-06-29 02:19
Looking at the error above, i?m almost certain that?s the issue

tjones
2020-06-29 02:20
Good pickup.

matt.fellows
2020-06-29 02:23
Sorry I didn?t see your note about that in your prompt there Princiya. Can you please share how you ran that in Docker? My guess is that you?ve synced the mac directory into the Docker container, and os-specific packages are not installed.

matt.fellows
2020-06-29 02:23
so it?s trying to execute Mac binaries that won?t work, or it?s trying to execute the native linux binary (as you can see above) which doesn?t exist

matt.fellows
2020-06-29 02:24
Please ensure if you run in docker, that you exclude `node_modules` and do a fresh `npm ci`

princiya.marina
2020-06-29 05:19
ok, i will try this in a bit @matt.fellows :raised_hands:

chandanakurumeti27
2020-06-29 11:28
Hello , someone please give me example on how to start the two providers at the same time at diff port in `JS`, I have them defined like this, const provider = new Pact({ consumer: ?consumer_authentication?, provider: ?p_ authentication?, host: ?localhost?, port:10002, log: path.resolve(process.cwd(), ?logs?, ?pact.log?), dir: path.resolve(process.cwd(), ?pacts?), logLevel: LOG_LEVEL, specification: 2 }); const provider_savedgames = new Pact({ consumer: ?consumer_savedgames?, provider: ?p_savedgames?, host: ?localhost?, port:10001, log: path.resolve(process.cwd(), ?logs?, ?pact.log?), dir: path.resolve(process.cwd(), ?pacts?), logLevel: LOG_LEVEL, specification: 2 });

chandanakurumeti27
2020-06-29 11:29
If there is only one provider , am starting it like

chandanakurumeti27
2020-06-29 11:30
how can i start/setup both providers running at diff ports inside before hook,please help me on this. Any help would be greatly appreciated !

nicholas.pleschko
2020-06-29 11:38
in your config of the providers it seems like you are missing the ?port? property name: ```new Pact({ // ... other properties port: 10002 })```

chandanakurumeti27
2020-06-29 11:39
yeah sorry, i had them in my code, just missed it here while posting

chandanakurumeti27
2020-06-29 11:40
when i had only one provider, i used to start/setup the provider before running the test as below

chandanakurumeti27
2020-06-29 11:41
Now, how do i make two providers start inside before hook

nicholas.pleschko
2020-06-29 11:41
you could try to run the second provider setup in the `then` of the first setup

nicholas.pleschko
2020-06-29 11:42
provider1.setup().then(() => provider2.setup().then(() => done()) )

chandanakurumeti27
2020-06-29 11:42
I tried this, but not working

nicholas.pleschko
2020-06-29 11:42
how is it not working?

nicholas.pleschko
2020-06-29 11:42
error?

chandanakurumeti27
2020-06-29 11:43
yeah , gimme sec

chandanakurumeti27
2020-06-29 11:43
wil share the error

chandanakurumeti27
2020-06-29 11:45
This is my whole code,

shailesh.wadhwa
2020-06-29 11:45
has joined #general

chandanakurumeti27
2020-06-29 11:46
provider and provider_Savedgames are the ones which i shared before here

chandanakurumeti27
2020-06-29 11:47
In the logs, i can see that

nicholas.pleschko
2020-06-29 11:55
is there really nothing in: ```E, [2020-06-29T13:44:16.518714 #23351] ERROR -- : Interaction diffs for that route:``` or did you remove that from the log?

nicholas.pleschko
2020-06-29 11:57
also are your requests pointing to the right host:port?

matt.fellows
2020-06-29 12:10
Still waiting for the actual error. The problem above is clear to me There are a number of problems here 1. You are setting the same log file for different providers, that is likely to cause issues where one is overriding the other 2. You are using different consumer names from the same project. I would advise against this (it?s the same consumer for two different providers) 3. You are doing what looks like a functional test (expecting an auth, and then doing a request to get games). Where possible, I would test these as separate contract tests. This test is quite high level.



chandanakurumeti27
2020-06-29 12:19
i didnt remove any interaction diffs in the logs , just removed some thing inside req and response bodies and some headers but not anything generated by pact framewokr

chandanakurumeti27
2020-06-29 12:20
@matt.fellows, i will try to see any of your points are what am missing ,Thank you so much

chandanakurumeti27
2020-06-29 12:21
Thank you @nicholas.pleschko for your suggestion

shailesh.wadhwa
2020-06-29 12:42
Hello #here Does anyone have the idea on how to modify a *GraphQL variable* during *Provider Verification*? I have a Pact Interaction for GraphQL Mutation which uses a variable. The variable has to be unique each time Mutation is requested to the Provider. From the way of injecting Authorization header, I tried the *requestFilter* in *Verifier opts* but doesn't know if it can be used for this purpose. Can anybody help, please? Thanks in advance

matt.fellows
2020-06-29 12:56
which language?

matt.fellows
2020-06-29 12:57
In theory you could modify any part of the payload during a request filter - you?d probably need something like https://github.com/apollographql/graphql-tag to do it well, or you could hack the string body that GraphQL creates

martin.hentschel
2020-06-29 14:03
has joined #general

shailesh.wadhwa
2020-06-29 14:27
Hello @matt.fellows, Thanks for your response. The Language is *JavaScript.* Actually, from the following implementation of Provider verification: https://github.com/pact-foundation/pact-js/blob/master/examples/graphql/provider.spec.ts and https://github.com/pact-foundation/pact-js/blob/master/examples/e2e/test/provider.spec.js I got the idea of using *requestFilter in opts.* `requestFilter: (req, res, next) => {}` The example in above link, however, focuses on modifying the request Headers. I'm not sure how we can _extract the Query Payload from the Contract_ and then modify it ? or if there is any other *opts* that can update the GraphQL variable in the contract? Thanks again!!

samycici
2020-06-29 15:28
has joined #general

matt.fellows
2020-06-29 22:09
Req is the full request object. You can mutate it however you like - including the body.

matt.fellows
2020-06-29 22:09
It's a standard express JS middleware

jonathan-pact
2020-06-30 06:57
has joined #general

gauravsingh1095
2020-06-30 07:19
has joined #general

gauravsingh1095
2020-06-30 07:21
Hello team

sairsule
2020-06-30 07:27
I asked this once before, but there were no replies.. so asking again.. In api tests, if provider api is /*users*/{id} and consumer is calling /*user*/{id} this gets caught by pact test. Similarly in message-contracts if provider is writing to topic:Test1 and consumer is listening on topic:Test2, is it caught by Pact?

matt.fellows
2020-06-30 07:57
I responded (https://pact-foundation.slack.com/archives/C5F4KFKR8/p1591006567185000). You can do it, but not all languages currently support this. Java does

sairsule
2020-06-30 08:00
Thanks Matt, I missed that reply

matt.fellows
2020-06-30 08:11
no probs!

amaljayaraj07
2020-06-30 08:27
has joined #general

shailesh.wadhwa
2020-06-30 09:42
Thanks @matt.fellows, So, I tried to log the contents of the `req` and can find the `req.body` as follows: ```body: { consumer: 'UI', state: 'Atleast one item exists', states: [ 'Atleast one item exists' ], params: {} },``` I've attached the Pact file -> ui-graphql_api.json and inside that file, I want to modify `interactions.request.body.variables.itemId` However, as I try to modify the `variables` in body, i get the error ```TypeError: Cannot set property &#39;itemId&#39; of undefined<br> &nbsp; &nbsp;at requestFilter``` Appreciate your response.

matt.fellows
2020-06-30 10:39
That request is the state setup coming in to setup a provider state. You should probably ignore that request (look at the path and don't act if it matches the setup path). The following request will have your actual interaction payload

giuseppe.salvatore
2020-06-30 11:14
The updates to the docs are amazing!! Really great work guys

giuseppe.salvatore
2020-06-30 11:15
:+1:

matt.fellows
2020-06-30 11:41
Thanks so much! You can thanks @bethskurrie for this

giuseppe.salvatore
2020-06-30 16:09
Well... then many thanks to @bethskurrie

giuseppe.salvatore
2020-06-30 16:09
Truly impressive

bethskurrie
2020-06-30 20:49
Thanks for the nice words @giuseppe.salvatore.

yrh.harini
2020-06-30 21:31
has joined #general

shailesh.wadhwa
2020-06-30 23:33
Hi @matt.fellows, In the output of `console.log(req)`, from requestFilter option: ```requestFilter: (req, res, next) => { req.headers['Authorization'] = userToken; console.log(req); next(); },``` I can see two `IncomingMessage` -- one with setup path and other with path apparently for my graphQL query Unfortunately, there is no `body` or *interaction payload* in the request. Infact, I see empty query and params: ```params: {}, query: {},``` Am I missing something here? I'm just trying using `req` object first time. Learning how the middleware works for GraphQL. Thanks again for your responses.

hadjaliabir
2020-07-01 15:37
hello everyone ! how can i create a mockprovider on a specific port ? and how can i verify it was created ? i don't get this code !!

hadjaliabir
2020-07-01 15:38
`public PactProviderRuleMk2 mockProvider = new PactProviderRuleMk2("test_provider", "localhost", 8080, this);`

giuseppe.salvatore
2020-07-01 17:09
Hey guys... somebody was challenging me regarding the use of PACT vs Spring Cloud Contracts. Would it be fair to say that those reasons are still applicable and valid? ? PACT has our of the box ready to deploy broker ? PACT supports contracts for REST API as well as messaging services ? PACT has native support for multiple languages, also Spring Cloud does but it's only java so say I am a FE developer I would need to user yaml files or DSL to document my contracts ? PACT has an active community and outstanding documentation (unfortunately I don't know about Spring Cloud, I mean the documentation is pretty good as well) ? PACT broker can interact with Spring Cloud Anything else that you think is worth mentioning? I thing it's fairly good list

rafael.espillaque
2020-07-01 17:11
Not very sure about how this would work on SCC but I?d say that Pact allows for more complex automation and verifications (thanks to Pact broker and Webhooks) than SCC.

rafael.espillaque
2020-07-01 17:13
actually I don?t know if SCC even supports checking a consumer/provider with older versions of the contract (in Pact we?d use the broker, not sure if SCC supports that using the stub jars that are pushed to artifactory/nexus)

rafael.espillaque
2020-07-01 17:14
(I believe SCC also supports REST and messaging)

giuseppe.salvatore
2020-07-01 19:02
yeah I can confirm this one is correct

kristine.jetzke
2020-07-01 19:29
The port is `8080` - you can use a different value

kristine.jetzke
2020-07-01 19:31
To https://kreuzwerker.de/post/writing-contract-tests-with-pact-in-spring-boot > The rule was quite confusing for us as well. It does many things and has a weird name. Most importantly it starts a mock server that will return the expected response and writes the Pact JSON file at the end. I think the easiest way to verify that it works is to write a very simple pact test.

kristine.jetzke
2020-07-01 19:32
In case you?re unsure about rules in general, https://github.com/junit-team/junit4/wiki/Rules

kristine.jetzke
2020-07-01 19:33
If you?re not forced to use JUnit4 I would recommend to use JUnit5, it has become easier

kristine.jetzke
2020-07-01 19:36
Hey, thanks for the list. I agree with all your points and also @rafael.espillaque?s point is very important - it?s not just only about ?ready to deploy broker? but the whole workflow around it.

chifamba
2020-07-01 19:37
has joined #general

kristine.jetzke
2020-07-01 19:38
Additionally, SCC is conceptually different. It definitely started as a provider-driven framework. Consumers had to add their contract to the provider?s repo and wait for the provider to publish a jar. ~tbh I didn?t look into it for a while so I?m not sure if that changed somehow or not.~ Edit: It now supports a consumer-driven approach. But it seems very limited, all contracts need to live in a separate repository. See https://cloud.spring.io/spring-cloud-static/spring-cloud-contract/2.2.3.RELEASE/reference/html/using.html#flows-cdc-contracts-external

kristine.jetzke
2020-07-01 19:48
? PACT generates the contracts based on code and automatically verfies the consumer whereas in SCC you need to manually write the contracts in a separate step


hadjaliabir
2020-07-01 20:38
Thank you so much :slightly_smiling_face: ! another question plz !! *given* and *uponReceiving* was explained in your blog , what about *path* are we supposed to add a path to the api real file.json ?

kristine.jetzke
2020-07-01 20:58
The path is the endpoint you are writing the test for e.g. `/users`

hadjaliabir
2020-07-01 21:14
Ah ! okey ! thank you again :slightly_smiling_face:

harsh.x.parekh
2020-07-01 21:35
has joined #general


matt.fellows
2020-07-01 23:24
If the concepts are confusing and you need more assistance in getting going, doing this ~1 hour workshop will be time well spent. By the end of it, all of the core concepts should be much much clearier

matt.fellows
2020-07-01 23:25
You can connect SCC to the pact broker. But you may lose out on some fidelity (in either the Spring contract or the Pact one). You?ll be forced to a ?common denominator? type situation

matt.fellows
2020-07-01 23:27
I think it?s fair to say that Pact and SCC are fairly comparable. As @kristine.jetzke said - and this is absolutely crucial - is that SCC _does not mandate_ that your consumer code actually generate the contract. It can be hand-cranked outside of the code base. This creates a potential for drift. The leads to the other key difference, that Pact has language specific bindings. Unlike SCC where you would need to write it in Groovy if it wasn?t a JVM code base.

matt.fellows
2020-07-01 23:27
I?d say SCC is probably a bit friendlier if you?re embedded in the Spring ecosystem.

matt.fellows
2020-07-01 23:28
I think it?s fair to say that Pact and SCC are fairly comparable in their stated aims at a test framework. Where Pact differentiates is the broker experience, which you could classify as the CI/CD part of the tool. SCC doesn?t have this, you?d need to build all of the workflows yourself

matt.fellows
2020-07-01 23:28
But you can publish/verify from a broker, Marcin (SCC maintainer) has done an excellent job of getting the ecosystems to work together

phil.endsley
2020-07-01 23:40
Seems like an appropriate time to bring up @bethskurrie's request for help with comparing pact to other frameworks (SCC was specifically asked about) https://pact-foundation.slack.com/archives/C9UN99H24/p1592522585096300 Seems like this is the kind of stuff being looked for

bethskurrie
2020-07-01 23:53
@sklein it's been on my todo list to add an -`--ignore Foo` flag to explictly ignore particular pacticipants. In the meantime, what you can do is explicitly list the pacticipants you care about.


2020-07-01 23:57
A new post has been created in *Feature Requests*


matt.fellows
2020-07-02 01:19
It?s worth a blog post or article on our docs site.

matt.fellows
2020-07-02 01:19
I?ll add to my TODO but #help-wanted



bethskurrie
2020-07-02 01:39
Unrelated to above conversation

matt.fellows
2020-07-02 01:46
wow!

christmagri
2020-07-02 06:12
has joined #general

greg.tyler
2020-07-02 09:43
has joined #general

tesnim.rabeh
2020-07-02 14:15
has joined #general



hadjaliabir
2020-07-03 11:13
Hello everyone ! do you have An example of running provider verification using java maven ?

matt.fellows
2020-07-03 11:31
What have you found so far?

hadjaliabir
2020-07-03 12:21
i found many examples using springboot, it was complicated for me !


hadjaliabir
2020-07-03 14:19
Yes exactly !

a.catalucci
2020-07-04 10:28
has joined #general

hadjaliabir
2020-07-04 19:28
well i did it :smile: , still is it possible to load my API to the provider code ?

matt.fellows
2020-07-04 22:39
Sorry I don't understand the question Abir?

hadjaliabir
2020-07-05 09:58
i want to compare my pact with my real API to retrieve id etc..

matt.fellows
2020-07-05 10:48
Thanks but I'm still not understanding your question. How are you validating it now if your not testing against your real provider? And when you say real, do you mean running against a local checked out version of the provider (e.g. a ci build) or production?

matt.fellows
2020-07-05 10:48
It will be helpful for you to share Daniel code so we can understand what you're doing as well as what you've done so far

hadjaliabir
2020-07-05 11:25
https://github.com/eugenp/tutorials/tree/master/libraries-5 -------------- https://github.com/eugenp/tutorials/tree/master/spring-resttemplate ------------------ https://www.baeldung.com/pact-junit-consumer-driven-contracts --------------- i used this project to understand the concept then i retrieved the consumer and provider code only so now i have this : https://github.com/abirbha/pactProject

hadjaliabir
2020-07-05 11:30
Yes exactly ! i mean running against a local checked out version of the provider


matt.fellows
2020-07-05 11:35
There are heaps of provider tests examples you can borrow. See the Pactflow GitHub org also

hadjaliabir
2020-07-05 11:46
Thank you so much !!! am so confused as you can see because am an automation tester and found myself dealing with springboot and Pact for the first time ! thank you again for your help :blush:

matt.fellows
2020-07-05 11:58
Ah ok, you're doing great. Most of the hard work is going to he navigating source code in consumer/provider side, and the specifics of the test frameworks, build tools etc. If you have access to a Dev on the team they'll be able to accelerate things. Pact is just a test tool that you'll need to make work in your specific env. Good luck!

suma.surabhi
2020-07-05 12:10
has joined #general

francesco.bartoli
2020-07-05 17:46
has joined #general

dirkbolte79
2020-07-06 06:43
has joined #general

dirkbolte79
2020-07-06 06:52
Hi - I?m currently using pact in a scenario where the server is returning a JWS with JSON as payload. From what I found so far (e.g. https://stackoverflow.com/questions/44087197/encoded-encrypted-body-before-verifying-a-pact ), there is no built-in support for this. I wonder whether this would be a doable extension to pact and whether you would accept a PR which adds it.

uglyog
2020-07-06 07:07
Depends, is the actual payload in the claims and you just need to encode as JWT on the one side, and decode on the other? Or do you need to verify with the signature as well?

dirkbolte79
2020-07-06 07:09
long term, a signature validation would be nice, but that would probably require to pull in another library which might be ideal. So for the time being, For the time being, checking the actual payload would be more than sufficient

uglyog
2020-07-06 07:18
I think that can be a workable extension

dirkbolte79
2020-07-06 07:18
so would it be ok if I give it a try?

vasile.pop971
2020-07-06 07:43
has joined #general

vasile.pop971
2020-07-06 07:49
Hi there. Is there any way of having some rigid contracts? I have one situation where the contract must be strict, if a new field comes from the provider, the provider test must fail.

abubics
2020-07-06 08:28
It's generally possible, but not really in the spirit Pact. If you do that, then most categories of backwards-compatible change are broken. My main question becomes: what is the deploy sequence if you want to make an API change?

philipp.walser
2020-07-06 09:18
has joined #general

matt.fellows
2020-07-06 09:27
Why would you want that out of interest?

matt.fellows
2020-07-06 09:27
Pact follows Poster's Law on this, so it's not possible with pact as I understand

philipp.walser
2020-07-06 09:51
Hi there. I would be interested in using the new Beta-Features wip-contracts/pending contracts. We played around with Pact a bit for some time and now want to make use of the full feature set in one of our new projects. Of course, we would not need the feature 'right now', but thought when we set everything up from scratch now, why not incoorperate the latest features which sound like we want to have them anyways




bethskurrie
2020-07-06 09:55
These will get you going

vasile.pop971
2020-07-06 09:55
service A has new or updated entities, sends those via Kafka, service B is consuming data from topic, but for reasons out of my hand the deserialization is done to some strict models

bethskurrie
2020-07-06 09:55
Nope, not possible with Pact. You'd need another tool.

bethskurrie
2020-07-06 09:56
Bummer

bethskurrie
2020-07-06 09:56
That's an unfortunate architecture.

vasile.pop971
2020-07-06 09:56
I completely agree

bethskurrie
2020-07-06 09:56
Sounds like the old JVM wsdl parsing

vasile.pop971
2020-07-06 09:56
yeah, and it's Python, should NOT be like this

bethskurrie
2020-07-06 09:58
Filter?

vasile.pop971
2020-07-06 09:59
I'm working on understanding why this is architectured like this

bethskurrie
2020-07-06 10:04
The more stupid something seems, the weirder the back story!

michael
2020-07-06 12:20
has joined #general

sklein
2020-07-06 12:57
Awesome! Thanks @bethskurrie

philipp.walser
2020-07-06 13:58
I completely missed the existence of http://docs.pact.io/wip, I only checked https://docs.pact.io/pending ...so all I am missing is `PACT_BROKER_FEATURES=pacts_for_verification` Thanks for the links!

hadjaliabir
2020-07-06 14:02
Hello ! how can i resolve "failed to invoke pact method "

elliottmurray
2020-07-06 14:20
maybe include more information? And what pact language? Have you checked faq?s etc?

hadjaliabir
2020-07-06 14:25
java/junit/eclipse, i added the jars using build path

elliottmurray
2020-07-06 14:41
#pact-jvm-help

elliottmurray
2020-07-06 14:42
Though I think you would be best getting it running from gradle/mvn and working back from there

giuseppe.salvatore
2020-07-06 17:22
Hi guys, is there a way to specify the content-type in the response section generated in the contract from the consumer side?

giuseppe.salvatore
2020-07-06 17:23
I mean I know how to set it in the request

giuseppe.salvatore
2020-07-06 17:23
not sure how to set it in the response returned by the mock

giuseppe.salvatore
2020-07-06 17:52
sorry dumb question... already found the answer

aliaksandr.valadzko
2020-07-06 21:21
has joined #general

bethskurrie
2020-07-06 23:27
@giuseppe.salvatore did you find it via the new search in http://docs.pact.io?

bethskurrie
2020-07-06 23:27
I'll update the pending page too

abubics
2020-07-07 00:05
The thing is . . . while Pact doesn't support rigid contracts, you can still use it for theoretical non-breaking contract tests, and just let the unit tests break on deserialisation. Until you migrate to an architecture that doesn't require paired deploys, it may still be useful?

giuseppe.salvatore
2020-07-07 08:44
na it was just me being so dumb not being able to remember the code I wrote a couple of months ago.

charu.agarwal
2020-07-07 11:39
has joined #general

jlammers
2020-07-07 13:34
has joined #general

camila.pinto-ext
2020-07-07 14:10
has joined #general

fernando.martin
2020-07-07 14:20
has joined #general

bheemreddy181
2020-07-07 15:46
Can we still use pact for provider driven testing where there is no two way feedback loop in place ? like i push a contract manually to pact broker and use that for verifying my provider side implementation in future

bethskurrie
2020-07-07 20:18
You can push any json resource you like into the broker, but the URL structure is designed for the contract to come from the consumer, not the provider.

chawlapriyanka29
2020-07-08 00:09
In consumer driven contract approach as an when the consumer published a contract which breaks the providers build, I am not aware why the failure has occurred.. Is there a utility to that can help me to provide the exact reason. ?

matt.fellows
2020-07-08 00:15
In Pactflow, we have a UI feature that allows you to see the failures and dig into it: https://pactflow.io/blog/verification-results/

matt.fellows
2020-07-08 00:16
It?s backed by an API, so all of the verification results (if you?re publishing to the broker) are there

matt.fellows
2020-07-08 00:16
but having access to the provider?s build output should be enough to diagnose the problem, usually

chawlapriyanka29
2020-07-08 00:28
Is there a way to implement this using pact-pyton ?

matt.fellows
2020-07-08 00:29
implement publishing verification results?

chawlapriyanka29
2020-07-08 00:33
And while publishing I should set publishverificationResult as True. Right ?

bethskurrie
2020-07-08 01:45
Yes, the interaction level results are published in pact python @chawlapriyanka29

bethskurrie
2020-07-08 01:46
There's no UI to look at them, but you can use the API browser

anilbms75
2020-07-08 12:40
has joined #general

sklein
2020-07-08 14:04
@bethskurrie i changed to explicitly specifying dependencies as suggested. I'm finding though that this isn't actually limiting `can-i-deploy` to only verifying the pact between the two explicitly stated pacticipants (i.e. one expected verification result) but rather it is running the verification against all dependencies for both pacticipants (many verification results). In other words if I specified ```can-i-deploy --pacticipant consumer --version some-version --pacticipant provider --version some-version``` I expect... | consumer | some-version | provider | some-version | true | not ... | consumer | some-version | provider | some-version | true | | some-other-consumer | version | provider | some-version | false |

bheemreddy181
2020-07-08 17:09
Our consumers are from different org and are not in a position to write contracts - we were thinking to publish contracts similar to how consumer publishes it

nirupma.rim
2020-07-08 17:28
has joined #general

bheemreddy181
2020-07-09 02:39
Can we call Contract Tests as `Contractual Functional Tests as Provider Implementation is not mocked mostly`

matt.fellows
2020-07-09 02:40
I mean, it?s a bit of a mouthful :stuck_out_tongue:

matt.fellows
2020-07-09 02:40
What?s the intent behind it?

bheemreddy181
2020-07-09 02:44
Just curious if we can call so - it is hard at times to convince people around if it just a contract tests - as we are validating more than schema at times ( like we get a value back in the response )

abubics
2020-07-09 03:51
That really depends how deep into your provider you go. I wouldn't say that most people leave the "provider implementation not mocked mostly". My preference, for example, is to treat is as a unit test for the network interface, and go just barely to the boundary of domain logic to start stubbing.

bethskurrie
2020-07-09 03:53
It is more than schema validation, because it links the requests to the responses, so you can be sure you understand all the different scenarios.

bethskurrie
2020-07-09 03:55
That being said, you can validate a pact against an OAS doc, which is just schema validation. You then have to make sure the oas doc is 100% accurate however, which may well include a step which is basically like the pact verification.

bethskurrie
2020-07-09 03:56
If you stub too much of your business logic, you can easily end up in the situation where your pact passes, but in real life, it fails, because you stubbed out critical things that make it behave differently. The recommendation is to see if you can not stub, and then just add in the stubs that you absolutely need to get the pact verification to pass reliably.

bethskurrie
2020-07-09 03:58
Yes, it's a functional test in that you're executing real functionality, but it's the response you're looking at, not the side effects, and checking for side effects is a critical part of functional testing.

bethskurrie
2020-07-09 04:00
With contract tests, we're not asking "did you save the new resource correctly?" we're asking "do you return the expected response when I send you a request to create a resource?"

bethskurrie
2020-07-09 04:01
Other tests within the provider test suite should be asking the "did you save the new resource correctly?" question.


tjones
2020-07-09 05:01
I think of it as ?contract tests with functional coverage? - my view is that it?s advantageous for your contract tests to cover some of the business logic in the provider, but that they shouldn?t be viewed as a tests *for* that business logic. It does depend on your provider architecture.

matt.fellows
2020-07-09 05:47
Most importantly, it needs to be a deliberate part of an overall test strategy. If it's more work to maintain pact (or whatever other tool) and tests duplicates what other tests suites do, that's a recipe for developer frustration

matt.fellows
2020-07-09 05:48
As Tim says, sometimes it covers functional stuff as a happy coincidence, but not necessarily as its purpose

tjones
2020-07-09 05:50
I like covering the functional stuff where possible because you?re saying ?does the provider respond with the expected response in at least one scenario?, rather than ?is there code in the provider that could produce the expected response?. Both are valuable tests, though - and as Matt and Boris have both said, it?s essentially down to your values and taste.

matt.fellows
2020-07-09 06:20
yep

matt.fellows
2020-07-09 06:20
FWIW I tend to do the opposite of what @abubics says. I tend to mock at the edges as far as possible. I use the ?hermetic server? approach, where I basically mock any external collaborators (the the possible exception of database, or database like things because Docker usually works quite well there)

tjones
2020-07-09 06:25
> I tend to do the opposite of what @abubics says. I want to take this quote out of context and be like ?me too?, but it would just be sass. I like working with Boris. Even when we don?t do things the same way :joy:

matt.fellows
2020-07-09 06:26
It is certainly a mis-quotable quote

matt.fellows
2020-07-09 06:26
but it also talks to the complexity of doing testing well

matt.fellows
2020-07-09 06:26
there are (probably) no absolutes, other than the rule of ?no absolutes?

bethskurrie
2020-07-09 06:27
I realised I totally misread what @abubics does.

matt.fellows
2020-07-09 06:27
_waits for wrath_

sinanargun48
2020-07-09 12:45
has joined #general

bheemreddy181
2020-07-09 15:21
thankyou all for these insights

rodrigocs
2020-07-09 16:27
has joined #general

mfujiki
2020-07-09 18:52
has joined #general

2020-07-09 22:52
A new post has been created in *Feature Requests*

matt.fellows
2020-07-10 07:46
@dattasai.chunduru please see https://docs.pact.io/docker#docsNav

dattasai.chunduru
2020-07-10 07:47
Hi Can anyone please let me know can we directly execute our PACT Scripts in Docker containers directly or it need any specific setup for doing execution. In our current project we are executing our Automation scripts in docker so we want to execute the pact scripts also in docker

matt.fellows
2020-07-10 07:48
the answer is yes, are you just asking to know if its possible or are you having issues?

dattasai.chunduru
2020-07-10 07:52
I have not yet implemented it . I have to implement I am using Java for Pact scripts

matt.fellows
2020-07-10 07:53
ok. If you?re using Java, then there is nothing specific to Pact to worry about (as per the article linked).

matt.fellows
2020-07-10 07:54
Are you familiar with Docker and Java?

dattasai.chunduru
2020-07-10 07:57
I know little bit of docker as we are using it in our selenium scripts. But in that we are running the yaml file and integration the Selenium GRID with scripts.

dattasai.chunduru
2020-07-10 07:59
My query is like I have a consumer and provider poc scripts all ready and working now I want to execute them in docker container. For this do we have any yaml file to pull the image ? and do we need to do any changes in our consumer or provider side scripts ?

matt.fellows
2020-07-10 08:05
what YAML file are you referring to - a docker-compose.yml or something else?

matt.fellows
2020-07-10 08:05
:point_down: let?s move into a thread

matt.fellows
2020-07-10 08:05
do you use Maven/gradle or something else? I?d be googling ?how to run maven/gradle in docker?

dattasai.chunduru
2020-07-10 08:06
I am using Maven Matt

matt.fellows
2020-07-10 08:32
Cool, then if you already have a working PoC using Maven, there is no reason you shouldn?t be able to run your maven project within docker

hadjaliabir
2020-07-10 10:01
Hello everyone ! Can i generate pact form Swagger documentation ?



jacob.raihle
2020-07-10 11:51
has joined #general

christoffer.lindstrom
2020-07-10 12:26
has joined #general

hadjaliabir
2020-07-10 13:51
thank you :)

dattasai.chunduru
2020-07-10 16:18
Hi All I am deleteing a resource in PACT and in response I will not have content-type/json header . I want to make the header validation as optional. I have not given the headers in response validation. But my Scripts are still failing with error Failed tests: runTest(deleteconsumer.PactBaseConsumerTest): Pact Test function failed with an exception, possibly due to Mismatches(mismatches=[PartialMismatch(mismatches=[HeaderMismatch(headerKey=Content-Type, expected=application/json, actual=, mismatch=Expected a header 'Content-Type' but was missing), BodyTypeMismatch(expected=application/json, actual=text/plain)])])

dattasai.chunduru
2020-07-10 16:19
Please find my Code Snippet

dattasai.chunduru
2020-07-10 16:19
can anyone please help me on how to make the headers validation optional

phil.endsley
2020-07-10 16:23
It looks like you're making the header required when you build the pact The second line of `createPact` method `headers.put("Content-Type", "application/json");` Then in the builder, `.headers(headers)`

dattasai.chunduru
2020-07-10 16:44
I am deleting the record by passing request body

dattasai.chunduru
2020-07-10 16:44
and the request body is of Json type so I have to pass it as headers

phil.endsley
2020-07-10 16:46
It doesn't look like you're passing a body in your test

dattasai.chunduru
2020-07-10 16:51
I am passing data

dattasai.chunduru
2020-07-10 16:51
.body() I am sending data

dattasai.chunduru
2020-07-10 16:51
now im getting error only body mismatch

phil.endsley
2020-07-10 16:53
`.body()` is in `createPact()` , which is just defining the contract. When you're making the REST call in `runTest()`, you're not sending a body. It's just making a DELETE call to the url

dattasai.chunduru
2020-07-10 16:55
can you give me syntax for how to do it

dattasai.chunduru
2020-07-10 16:56
in RESTTEMPLATE I can not pass body right

phil.endsley
2020-07-10 17:02
This is a spring boot question. You can use `restTemplate.exchange` and build a `RequestEntity`

dattasai.chunduru
2020-07-10 17:11
sorry to ask but can you please give me syntax for my example please

dattasai.chunduru
2020-07-10 17:11
I am not able to build it

phil.endsley
2020-07-10 17:13
It should be something like ```RequestEntity<YourEntityObject> requestEntity = new RequestEntity<>(body, HttpMethod.DELETE, uri); restTemplate.exchange(requestEntity, YourResponseType.class);```

dattasai.chunduru
2020-07-10 17:24
This will work for HTTPS Methods also @phil.endsley

phil.endsley
2020-07-10 17:26
Yes, HttpMethod is just the verb (GET, PUT, POST, DELETE, etc...) of the request. The uri is what determines the protocol

chriscrawford80
2020-07-10 17:37
has joined #general

dattasai.chunduru
2020-07-10 17:55
@phil.endsley Thanks a lot phil it is working perfectly

krisdinesh
2020-07-12 13:14
Hello @all - is there a pact workshop repo for dotnet as like java, ruby and js? If yes, kindly share the link.


2020-07-13 02:13
A new post has been created in *Feature Requests*

bethskurrie
2020-07-13 03:22
removed an integration from this channel: https://pact-foundation.slack.com/services/BQE9MSRH6

krisdinesh
2020-07-13 03:49
Thanks a lot @uglyog!!

matt.fellows
2020-07-13 08:36
sorry for the spam. But with the GH issues going on today, note that some of the dependencies (e.g. Pact JS) that depend on github artifacts will be failing. :clap: to companies with caching proxies, :hugging_face: ?s to those without (including, ah, Pactflow)

matt.fellows
2020-07-13 08:37
(intermittently - hit that rebuild button!)

ayyamuthutechnical
2020-07-13 11:09
@bethskurrie, we have developed our services using aws and we will not have the services/provider in our local machine. When we asked developer team they said is tough to setup the services code in local. They are giving only the endpoints for provider. In this case, how to test the provider using pact.

matt.fellows
2020-07-13 11:22
Which language are you using? It shouldn't matter in most cases, pass the URL of the running service (i.e. the deployed one) to the verification process as you would if it was a local service

matt.fellows
2020-07-13 11:22
What have you tried?

ayyamuthutechnical
2020-07-13 11:49
@matt.fellows, i am using javascript for testing the consumer side and python for testing the provider side.


danhitchcock
2020-07-13 13:30
@ayyamuthutechnical You should just be able to change the ``` --provider-base-url``` To point to the provider, and if you've setup the command correctly it should just 'work' however, you might need to authenticate i am guessing? unless this script is running against the publicly facing service. I've just finished an e2e with the same technologies as you (but google instead of AWS) so I may be able to help you out.

pact_foundation_greet
2020-07-13 13:54
has joined #general

ayyamuthutechnical
2020-07-13 14:30
@matt.fellows and @danhitchcock, Thanks for the update. Now i got it, i will work and let you know if i face any issues.

jonathan.johnson
2020-07-13 15:36
has joined #general

jonathan.johnson
2020-07-13 15:41
New here, have a container pact/postgres setup question and requesting a reality check,

jonathan.johnson
2020-07-13 15:48
When pact-broker (via a k8s Pod) attempts to start getting error; `Sequel::DatabaseConnectionError: PG::ConnectionBad: FATAL: password authentication failed for user "pactbroker"` Postgres is running as a separate container, however I did not run the setup as described here: https://github.com/pact-foundation/pact-broker-docker/blob/master/POSTGRESQL.md as I was hoping that would auto-magically be done by pact-broker on first connection. Running postgres in K8s and thinking all the steps in the "Running Postgresql via Docker" document need to be done in an initContainer for the postgres Pod.

jonathan.johnson
2020-07-13 16:19
^ No, to answer my own question. It appears the documentation is about steps that are also automatically run at pact-broker startup.

matt.fellows
2020-07-13 23:45
Yes, as long as you setup the correct authentication details/database connection string, it should automatically create all of the things

matt.fellows
2020-07-13 23:45
Everything all sorted now? (also FYI perhaps ask any future q?s in #pact-broker)

chawlapriyanka29
2020-07-14 00:21
So my Pactbroker Webhook for now invokes a Jenkins job. But my requirement is to fetch the Jenkins Job ID so that the consumer can take reference of the Jenkins Job and look at the console output to check the required details. So my question is, is it possible to get the Jenkins Job Id which the Webhook actually triggers ?

matt.fellows
2020-07-14 00:30
Hi Priyanka, you can?t do that at the moment. The webhook is a fire-and-forget type request. Why do you want the consumer to be able to see the results of the webhook? That feels like a recipe for a complicated pipeline

bethskurrie
2020-07-14 00:48
You can look at the webhook logs via the api

bethskurrie
2020-07-14 00:49
But that's a manual process.

bethskurrie
2020-07-14 00:50
@jonathan.johnson typically the permissions required to create the instance of the database are not ones you want to give to your application

bethskurrie
2020-07-14 00:50
The application should have a user that only has permissions to modify tables and views within that particular instance/schema (depending on your terminology)

bethskurrie
2020-07-14 00:51
So, the creation of the database and a user for the app should be done before running the app, by an out of bound person/process.

bethskurrie
2020-07-14 00:52
The table migrations are done automatically by the app on start up however.

mathildecaron94
2020-07-14 02:13
has joined #general

jason
2020-07-14 06:05
has joined #general

aliaksandr.valadzko
2020-07-14 09:48
Hello:slightly_smiling_face: I try to set up Pact Provider tests in java using `@RunWith(PactRunner.class)` To initialize Spring beans I have to use `BeforeClass` section: ``` @BeforeClass public static void contextSetUp() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(PactContext.class); context.refresh(); SomeServiceMockStubs = context.getBean(SomeServiceMockStubs.class); ... }``` Is there a chance to simplify it, and use `Autowired` annotation like it is done in `@RunWith(SpringJUnit4ClassRunner.class)` ? ``` @Autowired protected SomeServiceMockStubs someServiceMockStubs;``` Thanks in advance!

bethskurrie
2020-07-14 09:48
Hi @aliaksandr.valadzko.

bethskurrie
2020-07-14 09:49
Please ask in #pact-jvm

aliaksandr.valadzko
2020-07-14 09:49
Thanks a lot!

matt.fellows
2020-07-14 10:55
June edition of the Pactflow POST is out: https://mailchi.mp/pactflow.io/pactflow-post-july-2020 @tjones and @yousafn - you?re famous(ish)

tjones
2020-07-14 10:57
Is that stats from the blog post?

matt.fellows
2020-07-14 11:00
Early stats from the campaign (i.e. the top clicks for content within the newsletter)

matt.fellows
2020-07-14 11:01
Or put another way, Yousaf?s twitter handle and then jest-pact have the top clicks so far

chris.mitchell
2020-07-14 12:10
has joined #general

jonathan.johnson
2020-07-14 18:40
All set now. It's working fine. I'll have a learning resource in a day or two to share with the community.

jonathan.johnson
2020-07-14 18:47
@bethskurrie Thank you for the helpful feedback. I understand the balance between automating this as much as possible and also the needs for a hardened solution for production. It's working now. Over the last 3 years I have been giving a 90 minute talk on CDC/Pact at NoFluffJust Stuff. We have a conference this week and I'm finishing up the revision for the talk for this Friday. Here is the links to the Katacoda scenario, but it will not be public until late into this evening :slightly_smiling_face: https://katacoda.com/javajon/courses/kubernetes-pipelines/cdc-with-k8s

bnacey
2020-07-14 21:26
has joined #general

uladzislau_danilchyk
2020-07-15 08:11
has joined #general

uladzislau_danilchyk
2020-07-15 08:12
Hi all! Is there any example how to write a contract for a negative scenario with 4xx errors? I faced the issue that HttpClientErrorException is thrown instead.

matt.fellows
2020-07-15 08:31
You probably need to configure your http client not to throw an exception in that case. Pact will send the 4xx if you ask it, so your code needs to be able to handle it

uladzislau_danilchyk
2020-07-15 08:33
Maybe you have an example on how to handle such cases? I didn't found any examples in pact-jvm or workshop repos.


kristine.jetzke
2020-07-15 08:43
it should not be an issue that the exception is thrown

kristine.jetzke
2020-07-15 08:45
for the contract generation - you just need to make sure your test passes

uladzislau_danilchyk
2020-07-15 08:46
@kristine.jetzke I see that ExpectedException is used. But in our case we are not using DSL. We'are using groovy with the following asserts: ```assert pactResult instanceof PactVerificationResult.Ok```

kristine.jetzke
2020-07-15 08:47
The ExpectedException is from Junit - in your testing library there should be something similar to handle the case that you expect an exception to be thrown

uladzislau_danilchyk
2020-07-15 08:49
@kristine.jetzke ok. But I have one more question to your. In our project we need to customize Bad Request response or Unauthorized response. What should we do to match Bad Request response to expected?

uladzislau_danilchyk
2020-07-15 08:50
Did you got my question? We don't need to just get 400 status and that's it. We need to match response schema of Bad Request response to expected.

kristine.jetzke
2020-07-15 08:52
ah you mean the JSON?

uladzislau_danilchyk
2020-07-15 08:53
@kristine.jetzke yep. For the Bad Request response we have custom json response like: `{"code": "2", "message": "Some message about the code."}`

kristine.jetzke
2020-07-15 08:54
do you parse this in your client code?

kristine.jetzke
2020-07-15 08:54
i mean does the method that calls the provider return this kind of error object?

uladzislau_danilchyk
2020-07-15 08:55
@kristine.jetzke I don't know how to validate such case.. No. It just throws an HttpClientException

uladzislau_danilchyk
2020-07-15 08:58
@kristine.jetzke I just thought about such solution: Create custom error handler for Bad Request and convert it into custom exception object instead of using common HttpClientException

kristine.jetzke
2020-07-15 08:59
but does your client really care about the json response? if it does not do anything with it, I would not cover it with a contract

uladzislau_danilchyk
2020-07-15 09:00
@kristine.jetzke I know. But in our case we need to do this and we haven't another options.

kristine.jetzke
2020-07-15 09:01
why do you need to do this?

uladzislau_danilchyk
2020-07-15 09:02
to clarify what was actually wrong: 1. combination of product and category is wrong 2. request params are not valid

kristine.jetzke
2020-07-15 09:17
but in order to do that you do need to parse the provider response, don?t you?

uladzislau_danilchyk
2020-07-15 09:18
@kristine.jetzke Yep. I need to parse. But I thought that there is a solution for such cases or similar to handle negative cases with statuses and responses out-of-the-box in Pact.

kristine.jetzke
2020-07-15 09:20
I still don?t quite get if you need to do the parsing for your application itself or just the contract test. If it is for your application, pact cannot really provide you anything because it is not part of your application. If it is for your application, I would suggest to do the parsing in the client code and transform it into a business object which you can then assert in your unit test.

kristine.jetzke
2020-07-15 09:21
Or a custom exception as you mentioned above using a custom error handler (depends on your general design approach in the application)

uladzislau_danilchyk
2020-07-15 09:22
@kristine.jetzke. Yes. I thought about second choice but still thought that such OOTB functionality exists in Pact to handle negative cases.

uladzislau_danilchyk
2020-07-15 09:22
@kristine.jetzke thanks again!

matt.fellows
2020-07-15 09:57
> @kristine.jetzke. Yes. I thought about second choice but still thought that such OOTB functionality exists in Pact to handle negative cases. Can I ask - what would expect Pact to do in this scenario? I'm wondering if there is a misunderstanding of the tool. Pact's job is to respond as the tests tells it to and then check that your code actually hit the endpoint. All assertions and checks are up totally up to your code. Think of it as a unit test of your client code, that just so happens to produce a contract as a handy side effect

uladzislau_danilchyk
2020-07-15 11:13
@matt.fellows, so I will tell you my case. In our project Bad Request / Unauthorized requests have customized response and are being part of contracts as well. We need to be sure that consumer correctly handles such responses of negative scenarios. It's not being a functional tests, we don't want to do this for every REST endpoint. It uses globally in project and we just need one test per type of such requests (BadRequest/Unauthorized) just to be sure that it handled correctly. Have you got my point?

matt.fellows
2020-07-15 11:26
totally and thanks, that?s quite normal

matt.fellows
2020-07-15 11:27
My question was more what were you expecting Pact to do ?OOTB? for you?

uladzislau_danilchyk
2020-07-15 11:32
@matt.fellows ok. Got it. I'm expecting that it can be approach to write a test case/interaction with negative scenarios where I can put status and expected response and pact will not fail test results with an exception but it will compare expected response and status like in normal/positive interaction. In addition to that I don't need to put custom logic around test to tell junit "You shouldn't fire exception.". I just need to tell junit "Hey. I will use Pact and it can handle bad request, compare responses, and will not fire exception"

uladzislau_danilchyk
2020-07-15 11:47
@matt.fellows what do you think?

yousafn
2020-07-15 17:41
axios and some other clients will throw an error if they encounter a non 2xx/3xx response. If you need to do some matching on the response of the error body, you need to handle that in a catch, and stop your application throwing. Of course if it doesn?t match your conditions, you then throw the caught exception.

yousafn
2020-07-15 17:43
your client code needs updating by the sounds of it, as @matt.fellows has eluded to, you can configure pact to return any kind of response back that you want. Your test runner may also need to be configured differently, for example I have to set out my jest tests for things that will throw exceptions in a test (so its handled) otherwise jest will complain. This then allows me to inspect various things after an error scenario has occurred

yousafn
2020-07-15 17:44
I think understanding how your http client, and your testing framework handles error, so that you orchestrate your tests correctly is your first port of call. If your not a developer and sit on the testing side, look at your existing codebases unit tests, there will be examples of these types of things all over the place

yousafn
2020-07-15 17:45
if there isn?t, you don?t have enough unit test coverage :thumbsup:

bethskurrie
2020-07-15 23:39
Does anyone know how to disable the preview feature for Github links? I find it very annoying to have large slabs of code or markdown appearing in my conversations, especially when they're in a narrow thread. I always remove it when I'm on my desktop, but it can't be removed from a mobile client, and I'm often answering questions and pasting links from my phone. I've looked through all the Slack settings I can find, and can't work out where to disable it.

jonathan.johnson
2020-07-16 03:04
I just completed a free, public Katacoda scenario to help teach Pact. It will soon be in the O'Reilly learning subscription universe as well. I will be teaching with it during a NoFluffJustStuff webinar on Friday. If any expert here can run it and make sure I did not make a misstatement, etc. that would be a huge help. Basically, looking for a reality check. https://katacoda.com/javajon/courses/kubernetes-pipelines/cdc-with-k8s

bethskurrie
2020-07-16 03:05
Awesome stuff @jonathan.johnson!

bethskurrie
2020-07-16 03:05
I'll have a look at it

jonathan.johnson
2020-07-16 03:06
Thanks Beth, Pact is awesome.

bethskurrie
2020-07-16 03:13
I did a quick scroll through the pages and the two things that jump out me are: * Front page, "set up a Pack Broker on Kubernetes" should be "Pact Broker" * Image missing on step 3

bethskurrie
2020-07-16 03:13
You gave me a few chuckles.

bethskurrie
2020-07-16 03:14
(Not related to the typo, I mean, your actual content was humorous, just in case that wasn't clear!)

bethskurrie
2020-07-16 03:16
Can we link to this from http://docs.pact.io?

matt.fellows
2020-07-16 03:18
> write a consumer that defines and published Pact contracts publishes? > verify the consumer Pacts against a producer pacts

jonathan.johnson
2020-07-16 03:19
Linking from http://docs.pact.io would be and honor, yes!

jonathan.johnson
2020-07-16 03:19
I will fix all these great finds now. Thank you!!!

matt.fellows
2020-07-16 03:20
step 4: > Here is one consumer. The Node.js code is independent of the Kubernetes cluster and by running a Pact test is creates a Pact contract running a Pact test _it_ creates a Pact contract

matt.fellows
2020-07-16 03:21
I have to run to a meeting shortly, but so far it?s very good

matt.fellows
2020-07-16 03:21
all of the commands ?just worked? so far

matt.fellows
2020-07-16 03:22
one of the LOLs Beth?

bethskurrie
2020-07-16 03:22
yes. how did you know?

bethskurrie
2020-07-16 03:22
:laughing:

jonathan.johnson
2020-07-16 03:22
@matt.fellows Thank you. I added a link to your recent article.

matt.fellows
2020-07-16 03:23
I saw that - thanks!

matt.fellows
2020-07-16 03:23
Also, I have _not_ come across Marie Drake before. Cool!

jonathan.johnson
2020-07-16 03:23
The un-un publish joke is actually a tip of the hat to Beth as I saw your recent command on JS written in 10 days, what did your expect.

bethskurrie
2020-07-16 03:24
hahaha

jonathan.johnson
2020-07-16 03:24
Yeah, I wanted to call her out. Don't know her, but has good stuff.

bethskurrie
2020-07-16 03:24
The only sticker I have on my laptop says "NOTICE: Employees must wash hands after using Javascript"

jonathan.johnson
2020-07-16 03:26
I agree, I was not happy with the Node experience in this npm node thing. Freaking environment variables - why are they reinventing a wheel.

jonathan.johnson
2020-07-16 03:26
dont get me started.

bethskurrie
2020-07-16 03:26
I'll be honest, the most recent ES6 is just about a proper language. But it does still drive me nuts.

jonathan.johnson
2020-07-16 03:33
If aliens came to our blue marble and audited us for readiness for space travel then they would leave as soon as they saw Javascript. Yup, you need to evolve more, bye.

bethskurrie
2020-07-16 03:33
HA!

g.pou
2020-07-16 04:42
has joined #general

matt.fellows
2020-07-16 08:05
Has anybody used Karate framework before? Care to take a stab at the pros/cons of using something like Karate over Pact?


yousafn
2020-07-16 08:24
I used Karate around 5 years ago and brought it in at a client to perform CDC, we used wiremock to spin up mock providers. Since then Karate has evolved to cover things like load testing / ui testing / mocking and cdc. I found it really easy for non-technical testers as gherkin steps are available for all the API functions but depending on the implementation, it can be badly abstracted which overs little detail on what is sent. `Given I have sent a valid request` but that is the same with any gherkin based implementation, often used to abstract code away from the users (testers) it clouds understanding imo. The maintainer is a bit of a character and tends to have it out with a few other big players in the api testing world but he is awesome, listens to his community and is always smashing out features. I?m not sure what their CDC offering looks like, and if they have a pact broker style portal to view contracts, as that is one of the killer pros in pact. Back when we used in all them years ago, visibility of the contracts to providers was always an issue, and again like our current scenario, full buy in across the teams was a big issue. Maybe the value proposition of the benefits of this testing approach especially in CI/CD wasn?t sold well enough.

matt.fellows
2020-07-16 08:27
Interesting, thanks (and absolutely no surprise you responded to this :stuck_out_tongue: )

matt.fellows
2020-07-16 08:27
Btw your Cypress spike is going to get some love from me. I had a call with Randall (co-founder Cypress) last night. He was keen to play with Pact. My suggestion was that I could put together a PoC showing Cypress and Pactflow working together end-to-end.

matt.fellows
2020-07-16 08:28
I?ve half done that, just needs some tidy up.

matt.fellows
2020-07-16 08:28
:clap:

yousafn
2020-07-16 08:36
Feckin? awesome! I have a good relationship with a few of the Cypress developers over the past couple of years

dineshkr9090
2020-07-16 09:13
has joined #general

dineshkr9090
2020-07-16 09:14
Hi Team,

dineshkr9090
2020-07-16 09:16
Hi Team, Please let me know which version of Java supports Pact framework. I am doing Pact contract testing but getting error like "java.util.function.supplier can not resolved" Thanks, Dinesh Kumar

bethskurrie
2020-07-16 09:17
@dineshkr9090 please ask in #pact-jvm

dineshkr9090
2020-07-16 09:18
ok. Thanks

bethskurrie
2020-07-16 09:18
Also, it will help if you provide an example repository or gist (don't just paste a big slab of code!)

bethskurrie
2020-07-16 09:19
BTW, did you get a message from our greet bot, mentioning the different channels?

a.smith
2020-07-16 10:06
@bethskurrie From my work workspace, it looks like `/github settings` will give you a list of repositories that have rich previews enabled, and the option to disable them.

bethskurrie
2020-07-16 10:08
I did see some mention of that. I don't think we have that plugin though

bethskurrie
2020-07-16 10:08
When I type /github I only get the notifications prompt.

a.smith
2020-07-16 10:41
What about `/github help`? I see a whole bunch of stuff from that, including `/github settings` :thinking_face:

os.shulyak
2020-07-16 14:49
has joined #general

greg719
2020-07-16 18:55
hey, i made a channel in which i talk about your awesome tool pact for angular: https://www.youtube.com/playlist?list=PL1BlcTalLDBcPSvrr4ji0OEYJqO6Bw_9t

greg719
2020-07-16 18:56
any spreading love is appreciated :slightly_smiling_face:

matt.fellows
2020-07-17 03:09
absolutely, great stuff - i?ll watch a bit later today over lunch

matt.fellows
2020-07-17 03:49
How is Pact different to Postman. It?s been asked a few times, so here is a quick post - feedback welcome: https://pactflow.io/blog/how-is-pact-different-than-postman/

maciej.olko
2020-07-17 08:05
Hello, is there a place where one can track progress on support for v3 spec in Pact core?


maciej.olko
2020-07-17 08:58
Thank you! And it was also the thing I was looking for: https://github.com/pact-foundation/pact-python/issues/88

borwoj
2020-07-17 09:37
has joined #general

matthew.thomas
2020-07-17 09:52
has joined #general

shaundavin.se
2020-07-17 10:54
has joined #general

matthew_weisfeld
2020-07-17 13:48
has joined #general

vladg
2020-07-17 20:55
has joined #general

sreeram.thinkal
2020-07-17 21:20
has joined #general

vladg
2020-07-17 21:54
Hi folks. I am a bit confused about Provider States(specifically in PHP). I have a NodeJS consumer service that consumes an http API from a PHP provider service. We have swagger schemas for the PHP API service. I created a pact for simple `/someResource/12345` API using jest-pact DSL in the NodeJS Consumer for both positive and negative(i.e. resource not found) flows, validated it against the swagger api schema and then published the pact to pact broker. Now on to the Provider side(in php): As part of Pact verification, i startup up the Provider API process and then create a php Verifier that is pointed to both the provider API and pact broker. It fetches the corresponding pact from the broker and then try to hit its own `/someResource/12345` endpoint and understandably fails with a 404. I have few questions? 1. Are my expectations that Provider should grab a pact and try to run it against its actual code correct? If so, why does ProviderState config seems to be so limited 2. It seems that some pact implementations(JVM, JS) have a simpler approach to specifying state data than pact-php. Is there any work happening to bring PHP up to the standard of other implementation 3. Does anyone have a good production(ie. working) example of setting up test-only provider state APIs in php ?

bethskurrie
2020-07-17 22:09
Hi @vladg

bethskurrie
2020-07-17 22:09
Best to ask in #pact-php

bethskurrie
2020-07-17 22:09
Did you get a message when you joined from our greet bot mentioning the different channels?

vladg
2020-07-17 22:28
no not yet :slightly_smiling_face:

bethskurrie
2020-07-17 22:28
Hm.

bethskurrie
2020-07-17 22:28
We'll have to check that.

bethskurrie
2020-07-17 22:28
Can you see a message from a greet bot on the side panel?


bethskurrie
2020-07-17 22:29
Did you just join today?

vladg
2020-07-17 22:30
yeah :slightly_smiling_face:

bethskurrie
2020-07-17 22:30
Ok, we'll look into that.

vladg
2020-07-17 22:30
no bots in side panels unfortunately

bethskurrie
2020-07-17 22:31
There is meant to be an ephemeral message that appears to greet you and tell you about the channels. There is also supposed to be a greet bot that leaves a more permanent private message.

bethskurrie
2020-07-17 22:31
@yousafn @matt.fellows ^^

bethskurrie
2020-07-17 22:32
Can you guys have a look when you have a moment?

matt.fellows
2020-07-17 22:32
Will do, thanks

matt.fellows
2020-07-17 22:32
I disabled the greet bot so i can explain that. I'll check the logs for other one

vladg
2020-07-17 22:33
nice Yousaf is here as well ? couldnt get far without his jest-pact-typescript readmes and examples

vladg
2020-07-17 23:07
@bethskurrie my question in there is actually two-fold. one part is PHP specific, but another part is about my understanding of ideal pact flow

vladg
2020-07-17 23:08
ie. providers test pacts against their own live APIs

bethskurrie
2020-07-17 23:08
I'm afraid I'm not a php maintainer so I don't know.

bethskurrie
2020-07-17 23:08
No, providers don't do the tests.

vladg
2020-07-17 23:08
its not php specific

vladg
2020-07-17 23:08
just the conceptual pact flow

bethskurrie
2020-07-17 23:08
Or rather, the API itself doesn't. It's a test harness.

bethskurrie
2020-07-17 23:08
The test harness (aka verifier) fetches the pacts, replays the requests, and compares the actual responses to the expected responses.

vladg
2020-07-17 23:08
once consumer defined a pact and submitted it to the broker


vladg
2020-07-17 23:09
what is provider supposed to do with it? i.e. how do i ensure that if provider changes its API in a way that breaks the contract, that PACT tests will break as well


bethskurrie
2020-07-17 23:10
There are two workflows where the pacts should get verified - one when the pact changes, and one when the provider commits.

bethskurrie
2020-07-17 23:10
Have a read of that page I just sent (and the entire pact set up guide). it should explain what you need to know.

vladg
2020-07-17 23:10
so a simulated consumer tests against live provider api in https://docs.pact.io/how-pact-works#slide-4

vladg
2020-07-17 23:11
this implies that the data that the simulated consumer tests against already exists in the provider

bethskurrie
2020-07-17 23:11
yes.

bethskurrie
2020-07-17 23:11
before the request is replayed, the right data needs to be set up in the provider.

vladg
2020-07-17 23:11
so does that mean that pact itself is coupled to data in the provider

bethskurrie
2020-07-17 23:11
to do this, generally and endpoint is invoked with the name of the provider state, and it's up to that endpoint to set up the right data.

bethskurrie
2020-07-17 23:12
yes, the pact is coupled to the data. it has to be.

bethskurrie
2020-07-17 23:12
you can't expect a 200 if the database is empty.

vladg
2020-07-17 23:12
got it

bethskurrie
2020-07-17 23:12
the provider state for each interaction is set up separately to avoid the situation where failures from one interaction cause failures in a later interaction.

vladg
2020-07-17 23:13
got it

yousafn
2020-07-18 01:08
Welcome @vladg! Glad to hear you have got on well with jest-pact. @tjones also needs props :call_me_hand: he came up with the idea and made the readme extra awesome.

yousaf.nabi
2020-07-18 01:20
has joined #general


charu.agarwal
2020-07-18 21:42
We are using consumer-driven contract testing for our RESTful APIs. We also use Kafka with a schema registry for asynchronous communication between different applications. I am trying to understand how Pact for messaging will help if we are already using schema registry? Will it be overkill?

matt.fellows
2020-07-18 22:12
Schema registry won't pick up the issue until you deploy the app. So at the very least you have a shorter feedback loop if you use Pact

matt.fellows
2020-07-18 22:14
It also won't help you orchestrate a release. Pact maintains a compatibility matrix that you can use for deploys (and rollbacks). This need to builds your own for schema registry

matt.fellows
2020-07-18 22:16
I'll have a watch. I did a talk in Sydney last year and met Sam there. Interested to see her thoughts

vladg
2020-07-18 22:17
Thank you all ? getting started on the consumer side was significantly simpler due to jest-pact readmes and provided examples and shell scripts. Provider side (in my case in php) took some time wrapping my head around. Im doing a POC as part of a HackWeek at work and im hoping to show the value that pact offers in terms of a quality gating factor.

bethskurrie
2020-07-18 22:17
Cool! Thanks @yousafn

bethskurrie
2020-07-18 22:17
To be honest, the provider side is always harder to implement.

bethskurrie
2020-07-18 22:18
There are so many more variables, and it's where the tricky matching takes place.

vladg
2020-07-18 22:18
Makes sense. My hope is that i can easily demonstrate flow where an API change on the provider side will break the build if consumers are relying on it.

bethskurrie
2020-07-18 22:18
There's a CI/CD workshop, if that helps.


bethskurrie
2020-07-18 22:20
It's not php, but it will show you the principles.

vladg
2020-07-18 22:20
Provider States were especially difficult. I wish they were implemented as ?before? callbacks rather than requiring an API to be spun up. I understand where that requirement comes from ? we are wrapping a native executable that has no way to communicate with current runtime other than http. I still wish there was a different way

bethskurrie
2020-07-18 22:20
Funnily enough, @matt.fellows was talking about a solution to this the other day

vladg
2020-07-18 22:20
I ended up avoiding dealing with them entirely by relying on existing data that is currently being used in provider?s integration tests anyway?.

bethskurrie
2020-07-18 22:21
See how far you can get!

vladg
2020-07-18 22:22
I believe Provider State management is implemented differently in pact-js and pact-jvm and that pact-php is a bit behind

bethskurrie
2020-07-18 22:22
Yes, it hasn't been updated for a while I believe.

bethskurrie
2020-07-18 22:23
Trying to keep 11 libraries at parity is a difficult task.

vladg
2020-07-18 22:23
Yeah totally understandable!

matt.fellows
2020-07-18 22:41
You get a great call out too Beth!

matt.fellows
2020-07-18 23:01
Perfect timing - cypress and Pact :heart:

matt.fellows
2020-07-19 10:38
Not sure what happened with that last sentence sorry. But I think you caught my drift

charu.agarwal
2020-07-19 10:42
Thanks Matt for the quick response. We have set schema registry compatiability type to be FULL_TRANSITIVE. We do run our component test in development against real Kafka and schema registry. We keep track of all released schema versions in dev. After deploying in production, we copy the released version of schema to a released folder with a version number. I am not sure what we are missing.

matt.fellows
2020-07-19 10:50
cool

matt.fellows
2020-07-19 10:50
when you say dev, do you mean on your local development machines or elsewhere?

matt.fellows
2020-07-19 10:53
I believe also you need to ensure your test environments exactly match production, not just in the design but also the state - otherwise the history of schema compatibility won?t be there

matt.fellows
2020-07-19 10:53
but again, it?s doable, just not ideal

matt.fellows
2020-07-19 10:54
What Pact will give you over and above your own workflow to ensure the above, is the I want to introduce a breaking/new change into the system, and evolve that safely. That?s what Pact will help you orchestrate

matt.fellows
2020-07-19 10:54
e.g. consumer has a new expectation on the producer

charu.agarwal
2020-07-19 11:23
We can run all our tests locally as well as in our build environment. Both places we use the same Kafka and schema registry. I think I am understanding what you are saying. With schema registry, we are doing provider driven development/testing. Let me try to understand the benefit of schema registry? Is there anything which schema registry gives but Pact doesn't? Schema registry brings the complexity of its own. Pact gives me visibility about each consumer what it needs. I don't have that with schema registry.

matt.fellows
2020-07-19 11:24
I think that?s fair to say

matt.fellows
2020-07-19 11:25
I?m not a Kafka expert, so please do what you think is best of course!

matt.fellows
2020-07-19 11:25
But

matt.fellows
2020-07-19 11:26
I tend to think of the deployment workflows (ultimately, that?s what Pact is for). For example, if you were to rollback a provider (let?s say there is an issue), are you given guarantees that the next provider is compatible with its consumers? i.e. will you know in advance if that rollback will be successful or is it luck?

matt.fellows
2020-07-19 11:27
My understanding is that Kafka schema registry will maintain all versions (deployments). If that data isn?t available to your local dev/test environments you may lose out

alex.mccormick
2020-07-20 02:15
has joined #general

mark.abrahams
2020-07-20 08:38
has joined #general

mark.abrahams
2020-07-20 08:55
Dear Pact friends, I am currently looking at the pact-jvm-server (https://docs.pact.io/implementation_guides/jvm/pact-jvm-server/) for implementing the pact framework with a low code tool. Currently I am able to start the server and register some interactions via the /create endpoint. As mentioned in the documentation you have to define a state and path while doing so. Should I only register one interaction per /create call or can I add multiple? I noticed it works to add multiple interactions to the json however what should be the state filled in in the /create call then since the json contains multiple? And while running the tests how can I set the state the mock server should be in? For example state "user 1 does not exist" should return 404 on GET /user/1 and state "user 1 exists" should return 200 on GET /user/1. Can someone over here tell me how the pact-jvm-server is designed to be used? (register one interaction per /create call or is there some endpoint where I can specify the state the mock server should be in?) Looking forward to your answer!

bethskurrie
2020-07-20 09:30
Hi Mark. The best people to ask are in #pact-jvm

bethskurrie
2020-07-20 09:30
We have so many languages supported that each language has its own channel.

angelo
2020-07-20 09:46
has joined #general

angelo
2020-07-20 09:47
Hi! We're using pact-js (v9.11) for consumer side and pact-php (v5.0) for provider side. Is there a way to have WIP & Pending pacts activated using the php library for the provider side? Ive seen in the github issues that's its yet to be implemented and I wonder if there's a workaround?

bethskurrie
2020-07-20 10:42
There's an open issue to upgrade.

bethskurrie
2020-07-20 10:44
You could try calling the new api directly, and then verifying the pacts individually, ignoring failures for the ones that are marked as pending.

gcoradini
2020-07-20 10:55
has joined #general

mark.abrahams
2020-07-20 11:50
Ok Beth I will give it a try over there. Thanks!

matt.fellows
2020-07-20 12:11
It should be an easy modification. I'd say forking pact php and submitting a PR is likely to be less effort (and also quite rewarding :pray:)

pulgupta
2020-07-20 13:03
has joined #general

pulgupta
2020-07-20 13:09
Hello Everyone! I am currently evaluating Pact to write contract tests for our APIs. Can someone please share some resource highlighting how we can use Pact with Jest and JSDOM? As per the documentation only node is supported with Jest. I can?t use node environment for testing my components. Because of the this I am now planning to create a test consumer for my APIs(just to generate contracts) in java and then use pact-junit runner to generate consumer contracts.


yousafn
2020-07-20 13:16
> The test environment that will be used for testing. The default environment in Jest is a browser-like environment through https://github.com/jsdom/jsdom. If you are building a node service, you can use the `node` option to use a node-like environment instead.

yousafn
2020-07-20 13:18
Is it pact-js that doesn?t work in jsdom? do you need to use pact-web instead?


pulgupta
2020-07-20 15:43
I tried with @pact-foundation/pact and it seems to work in Jest with JSDOM environment.

pulgupta
2020-07-20 15:44
I think I can use it. Somehow pact documentation gives an impression that Pact is only supported in node environment and not in JSDOM

yousafn
2020-07-20 15:51
it does indeed give that impression https://github.com/pact-foundation/pact-js#usage-with-jest maybe the above section could like to pact-web section for users who require jsdom

yousafn
2020-07-20 15:52
out of interest, have you seen jest-pact? https://github.com/pact-foundation/jest-pact

pulgupta
2020-07-20 16:02
not really, I was using @pact-foundation/pact. However I think jest-pact seems promising, will try it out. One more issue which I would like to discuss, Actually, I have a code with jquery.ajax() and I cannot use some random port in the ajax() url. Due to this I have to use a single file for all my tests. As per the documentation if we need to split our tests in separate files we will need to use separate ports for each provider of each test file. Do you have some idea, how can I solve this issue?

yousafn
2020-07-20 16:06
In jest-pact we assign a random port when we instantiate the provider and pass this to our method that utilises the api call internally, and the test is checking the output of the function, whilst the pact provider verification checks that pact got the right request.

yousafn
2020-07-20 16:06
I am not sure if it has made it into pact-js but it is a very useful feature.

pulgupta
2020-07-20 16:11
Yes, That is true, but since jquery?s ajax method only sends request to the same server?s host and port, I had to make even the pact mock server port static. To do this I configured a jest test server port and then use the same port while configuring my pact server. It is a limitation more from the jquery.ajax() method side. With axios I was able to use the pact?s random port feature and it is working perfectly.

yousafn
2020-07-20 16:15
ahh yeah that sucks, I haven?t used ajax much at all, spend most of my time with backend services and dip in and out of ui code mainly react with xhr?s to a backend service

pulgupta
2020-07-20 16:32
yes pact-jvm is nice :-)

tjones
2020-07-20 17:31
@pulgupta could you tell me a bit more about your setup? With jquery, I think you should still be able to specify the URL - can you not pass the full URL to the mock server at test time?

mr.manish22d
2020-07-20 18:55
has joined #general

matt.fellows
2020-07-20 22:34
> I am not sure if it has made it into pact-js but it is a very useful feature. Do you mean does it assign a random port? If so, yes

matt.fellows
2020-07-20 22:36
> Yes, That is true, but since jquery?s ajax method only sends request to the same server?s host and port That?s not true. You can definitely send a CORS request using JQuery

matt.fellows
2020-07-20 22:36
You just need to ensure that the server responds with appropriate CORS headers

matt.fellows
2020-07-20 22:37
And Pact has the `cors: true` option for that

matt.fellows
2020-07-20 22:38
> I think I can use it. Somehow pact documentation gives an impression that Pact is only supported in node environment and not in JSDOM This statement is misleading. JSDom _runs_ on NodeJS

matt.fellows
2020-07-20 22:38
`pact` won?t run in a browser, though, that is what `pact-web` is for

tien.xuan.vo
2020-07-21 01:53
has joined #general

pulgupta
2020-07-21 04:59
thanks @matt.fellows setting the cors option on Pact has made everything work.

matt.fellows
2020-07-21 05:00
Awesome!

ashish_garg5
2020-07-21 06:22
Hi All, ```http://localhost:8500/pacts/provider/provider/consumer/consumer/version/1.0.0``` I am using this broker url to make a put request in python now i want to add pact-broker-username and pact-broker-password as well, how to do that ? Can i pass in this same url or there is any other way. Thanks.

matt.fellows
2020-07-21 06:26
This probably belongs in #pact-broker

matt.fellows
2020-07-21 06:27
the username and password are basic auth credentials, so you need to consult the docs for your Python HTTP client about how to add those

ashish_garg5
2020-07-21 06:27
ok thanks

mr.manish22d
2020-07-21 06:35
Hi Pact friends, I stucked with one issue, need help! Scenario: My API is Post request, which is having one token in body. I want to generate this token in provider state using provider state. In consumer test, I want to use method valuefromProviderState. But I am not getting any approach where I can add above method in my payload string. I am using Java, springboot for pact. If anyone have seen such scenario or I should follow some other approaches, please let me know. Thanks in advance. Regards, Manish

matt.fellows
2020-07-21 06:36
Can you please ask this in #pact-jvm ?

mr.manish22d
2020-07-21 06:37
Sure

angelo
2020-07-21 09:31
I was wondering if the pending/wip pacts can be applied to trunk based development for consumer side and what's the workflow like? Do we use feature flags for the pact tests?

tjones
2020-07-21 09:33
with trunk based, you can tag whatever is deployed. If your pacts are different with feature flags on / off, I would recommend including the flags in the version

tjones
2020-07-21 09:38
If you?re using semver, you could put it in the build information, eg v1.2.3+flagX.flagY

angelo
2020-07-21 09:51
For example you have a pact tagged master in master branch which is green. And you have 2 new features on 2 short lived feature branches: One changes the contract, the other doesnt. Both are then prd and merged to master. One problem with this is it makes the pact go red for both features. So, I'm not quite sure because I version using latest git tag semver + commit hash and tag pacts once they are merged to master (with the branch name master). While the examples I see push and tag contracts on a per branch basis and use can-i-deploy to check if they can merge to master which I do not want to follow because it breaks our trunk based development by waiting for the API counterpart and having dangling branches. Or is this the right approach for a trunk based development? As for feature flagging pact tests, it is something we are considering but may be there's a more elegant solution. Would really love a concrete example to do this right.

tien.xuan.vo
2020-07-21 10:43
Hi all, Is Pact Rust the main implementation of current/future Pact specifications? Does it mean that for example, Pact PHP will replace pact-ruby-standalone to use Pact Rust Standalone (or Rust FFI calls) to implement Pact specification v3 in the future?

matt.fellows
2020-07-21 10:43
Yes!

matt.fellows
2020-07-21 10:43
Why do you ask?

matt.fellows
2020-07-21 10:44
A short lived branch is not trunk based development

matt.fellows
2020-07-21 10:44
It's GitHub flow

tien.xuan.vo
2020-07-21 10:45
I asked because I have plan to learn both contract testing (Pact) & Rust. Maybe it's a good idea to learn Rust to contribute to Rust implementation?

matt.fellows
2020-07-21 10:49
We?re certainly happy to have more contributors

matt.fellows
2020-07-21 10:49
I?d open the chat in #pact-php and we can get the maintainers in on the conversation about how to do it

angelo
2020-07-21 10:56
It can be as long as you use feature flags to differentiate code and have the feature branch commits be squashed to master and wont last for more than a day or two


matt.fellows
2020-07-21 10:59
Maybe I?m a purist, but I cannot see how creating a branch and merging that to master is considered ?trunk based development?. In that flow, all of the usual Pact/Pactflow features work as advertised.

matt.fellows
2020-07-21 10:59
It?s really only when you?re commiting directly to master and using feature toggles alternative Pact approaches are needed

matt.fellows
2020-07-21 10:59
that being said, a colleague has done some work on this - i?ll try and dig it up and share online (somewhere!)

angelo
2020-07-21 11:01
Thanks! That Would really help a lot

angelo
2020-07-21 11:03
Also were doing it like this (short lived feature branches) so we dont use up all our ci build minutes since were a small org with a tight budget

abdul.hussain
2020-07-21 15:28
has joined #general

joel.whalen
2020-07-21 16:49
General philosophical Pact question: How do you all feel about running pact verifications on feature branches that *do not* deploy to a test environment? According to this diagram, we should be doing verification before deploying to an environment. Our feature branches don?t deploy anything, only our shared develop and master branches do. Is it worth the early warning to the developers to have the verification on their feature branches? Or is it too costly in terms of breaking the verification ?too often??

jarmy
2020-07-21 17:00
I?d like some clarification on pact verification in regards to how it fits into CI/CD. I have a consumer contract test (jvm) that publishes a pact as part of its CI and I have a provider verification test (js). Where does the provider verification test run in the CI/CD pipeline? According to https://github.com/pact-foundation/pact-js/#provider-api-testing documentation: _1. Start your local Provider service,_ the provider verification test needs a running API to run against. How would you accomplish this in a CI build where you typically only compile your code, run unit tests and _don?t_ deploy anything? Our typical workflow is to follow up the CI build job with a docker build job and then a docker deploy job. Is it feasible to run the pact verification test _after_ deploying the provider as part of an acceptance test job?

phil.endsley
2020-07-21 17:01
imo, I think it's worth it. It's mentioned in the ci/cd workshop, but you can use `can-i-deploy` as a "can I merge" check. So even if you don't deploy the feature branch itself, you can still leverage the verification results to ensure your branches stay compatible. If you wait until you merge into your main branches, that's too late in the process (imo) to be finding out. We like to keep our develop branches > Or is it too costly in terms of breaking the verification ?too often?? I don't think this really matters in practice, does it? Bad verification results are ok. They just stop you from deploying breaking changes.

phil.endsley
2020-07-21 17:12
> How would you accomplish this in a CI build where you typically only compile your code, run unit tests and _don?t_ deploy anything I guess I'll preface with, there are a lot of different ways to do things, and sometimes you might find yourself constrained by things outside of your control at your company. Our workflow is to run all of our test suites in the CI build. Our provider verifications happen in what I would usually classify as integration tests. In those tests, we spin up our application and the provider verification tests run against those. We also have other applications that require a lot more work than others to start up. For those, we just stand up the parts of the application that affect the pact tests we're running (ex: Maybe just a single rest controller and the service layer that's affected vs the entire application).

joel.whalen
2020-07-21 17:28
ok, thanks for the input. I?ll do it that way then it makes sense

joel.whalen
2020-07-21 17:31
yeah we are spinning up 3 containers to make this work: 1. the application itself 2. a redis container dependency 3. the pact verification test. All of this happens within CICD, and thankfully you *don?t have to mirror your production setup* https://docs.pact.io/faq/question_archive#my-team-wants-to-run-the-application-inside-docker-as-they-feel-that-running-it-inside-a-docker-with-http-server-is-much-more-realistic-scenario-in-line-with-production

krisdinesh
2020-07-21 22:53
@all - looking for pactnet matcher, current doc shows the example in ruby. Could you please share any example on the matcher using pactnet . Thanks in advance!!

matt.fellows
2020-07-22 00:25
:point_up: What Phil said

matt.fellows
2020-07-22 00:26
:point_up: thanks folks!

matt.fellows
2020-07-22 00:26
Yes, ideally you don?t need to deploy the application to run it.

matt.fellows
2020-07-22 00:27
most of our examples show a pact verification running locally (on your dev machine or on CI) where it is started first, and then pact tests use this locally running service

matt.fellows
2020-07-22 00:28
Where possible, I tend stub external dependencies to avoid slow/complex setups. Some people stub all layers except the controller.

matt.fellows
2020-07-22 00:28
Both are OK, as long as you know what coverage/scenarios you?re trading off and have a strategy to get the appropriate level of confidence

jarmy
2020-07-22 00:31
It would sure be easier to run the pact verification tests as part of the CI job. I?ll need to talk to the devs to see how I can stub the external dependencies of this API.

jarmy
2020-07-22 00:35
If run as part of CI, we won?t need any vault tokens to start the acceptance test job if triggered by a webhook created from the consumer tests

matt.fellows
2020-07-22 00:43
ah I see

matt.fellows
2020-07-22 00:43
> I guess I?ll preface with, there are a lot of different ways to do things, and sometimes you might find yourself constrained by things outside of your control at your company. So Phil?s point stands

matt.fellows
2020-07-22 00:44
Ideally, you can stub things out quickly and easily and then it won?t require things like vault tokens etc.

matt.fellows
2020-07-22 00:44
or, are those vault tokens for access to the broker or something?

matt.fellows
2020-07-22 01:35
Extract from the presentation. I hope it?s useful!

bethskurrie
2020-07-22 05:54
@dineshkr9090 there is a channel for each language.

bethskurrie
2020-07-22 05:54
Try asking in #pact-net

bethskurrie
2020-07-22 05:56
Can I also mention how awesome @phil.endsley is?

bethskurrie
2020-07-22 05:57
What Phil said :wink:

ranjanayush03
2020-07-22 06:05
has joined #general

mamtha.3687
2020-07-22 06:07
has joined #general

ranjanayush03
2020-07-22 06:12
Hi all,I am trying to configure pact broker using mysql instead of postgres but I am getting 500 internal server error so can someone please help me with the steps or a document on how to configure this..

ukrainian1991
2020-07-22 08:52
Hi, I faced with a strange ConsumerVersionSelector behaviour (I use latest pact-jvm version and gradle plugin 4.1.6). I have several versions of Consumer mr85 mr86 mr87 and I want to verify Provider against *all* of this versions. According to docs I assigned for all of these versions the same tag "admin-client" and disable option *latest.* Here is the Gladle plugin pactVerify task config ```serviceProviders { iPaaS_CPE { ... fromPactBroker { selectors = [ new ConsumerVersionSelector("admin-client", false)] // specify your tags here. You can leave this out to just use the latest pacts }``` Also, I have tried to do this via Providers tests ```@PactBroker(host="0.0.0.0", port = "9292", consumerVersionSelectors = { @VersionSelector(tag = "admin-client", latest = "false")}) public class PactProviderPaaSTest {``` In both cases, only latest version of Consumer verified against the Provider. Could you point me how to achieve my goal?

ukrainian1991
2020-07-22 08:55
Maybe I misunderstand the meaning of "latest" option from here https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors

abubics
2020-07-22 08:56
I don't have an definite answer, but probably good to move this to #pact-jvm :innocent:

ukrainian1991
2020-07-22 08:57
But it's about a general "consumerVersionSelectors". Is it a jvm specific option?

abubics
2020-07-22 08:58
that annotation is JVM, and I don't know if other implementation have such a feature

abubics
2020-07-22 08:58
I think if you have several live consumers, you need to run `can-i-deploy` once for each version . . . but I don't know if the annotation can provide a similar functionality (only because I haven't used it)

tjones
2020-07-22 09:00
Which version of the broker do you have?

ukrainian1991
2020-07-22 09:01
pact-broker: image: pactfoundation/pact-broker:2.57.0.1

ukrainian1991
2020-07-22 09:04
@abubics I checked can-i-deploy and I cant properly verify exact combination ```-Ppacticipant=PortaBilling -PpacticipantVersion=MR86 --Ppacticipant=iPaaS_CPE -PpacticipantVersion=1.0.1``` For example such parameters says that all is ok) But I definitelly know that 1.0.1 could not be deployed with mr86)

ukrainian1991
2020-07-22 09:05
Maybe I misuse somehow...

abubics
2020-07-22 09:13
I feel like that's pretty close to examples @bethskurrie has given before :thinking_face:

ukrainian1991
2020-07-22 09:20
My case is the following: I need to verify that each commit to Provider side does not break the compatibility with all Consumer versions.

ukrainian1991
2020-07-22 09:33
Maybe it would be better to represent each version as separate Consumer

abubics
2020-07-22 09:40
It's a usage that's come up before, and I think modelling it as a single consumer with multiple versions is the suggested approach. You just can't rely solely on `latest`, because you have multiple live versions, not just a latest :slightly_smiling_face:

rupesh.sawaliya374
2020-07-22 09:50
has joined #general

rupesh.sawaliya374
2020-07-22 09:54
Hi, I trying to use pact-jvm for our web API which returns soap XML as a response. I am looking for examples in which if I can validate XML response against XSD schema. Need suggestion, is it a good idea to use pact for web API's which returns xml response? Please help.

helen
2020-07-22 12:26
has joined #general

uladzislau_danilchyk
2020-07-22 12:40
Hi guys! Can you help? How can I pass custom params into constructor for target pointed with `@TestTarget` ? I need to pass params for that from my properties. Currently I use Spring Context and want to pass params without Spring Boot. Maybe you have some suggestions?

phil.endsley
2020-07-22 12:43
#pact-jvm was the right channel to ask in. Just need to wait for some input :slightly_smiling_face:

uladzislau_danilchyk
2020-07-22 12:43
@phil.endsley already. But haven't answered yet...

phil.endsley
2020-07-22 12:47
Right...just have to be a little more patient

angelo
2020-07-22 13:14
I have confusion about the versioning. Currently I version my pact using a combination of git tags + commit sha and tag it with the branch name (ex. pact-version: 1.0.1+1fjdkolw tag:feature/new1). So, the scenario is when I pr merge this feature branch to master branch, do I publish a new pact in master with its new version + master tag or use the feature branch latest exact pact version and tag (ex. pact-version: 1.0.1+1fjdkolw tag:feature/new1) and just change the tag to master? (ex. pact-version: 1.0.1+1fjdkolw tag:master)

matt.fellows
2020-07-22 14:05
Have you read the docs on versioning and the ideal pact workflow? They should clear that up for you

rupesh.sawaliya374
2020-07-22 14:29
@uglyog and @matt.fellows can you please comment on this?

jarmy
2020-07-22 16:09
The vault tokens are for acceptance test and deployment job permissions

uglyog
2020-07-22 23:01
Pact-JVM doesn't validate against XSD schemas

abubics
2020-07-23 00:12
Pact provides for more business/domain logic reasoning than just an XSD. You can use them together, if you want. Just Pact won't do the XSD bit for you.

matt.fellows
2020-07-23 01:34
I?m probably lacking context to understand why they would be needed to run Pact locally against a localy running provider - does the provider need to talk to other systems and requires secrets to do so? Can you stub out those systems for these pact tests so those aren?t needed?

danhitchcock
2020-07-23 07:54
Hi all, So I've hit a slight roadblock in using the matchers with an array that often has a null value in either the 0 or 1 position. I've tried eachlike(integer(1234)) and that always seems to throw an error because of the null value. ```{ "values": [ { "key": "2020-04-01T00:00:00.000+01:00", "values": [ 14676, null ] } }``` Any ideas on how i match this array, as I am expecting either a null or an integer? My current code for attempting to match this part of the response. ``` values: eachLike({ key: iso8601DateTimeWithMillis("2020-07-01T00:00:00.000+01:00"), values: eachLike(integer(1234)), }),```

uglyog
2020-07-23 07:56
You should use two different tests, one where the value is non-null, and the other were it is null


danhitchcock
2020-07-23 08:15
Ok so maybe i should just say look for an array with something in it. The null value might not be there next week, as this response json is currently hardcoded.

paul.stitt
2020-07-23 08:33
has joined #general

paul.stitt
2020-07-23 08:49
Hi all, I?m interested in trying out the ?pending pacts? beta feature.

hello997
2020-07-23 09:14
has joined #general

sambowenhughes
2020-07-23 09:19
has joined #general

tjones
2020-07-23 09:34
Hi Paul! That?s great! Let us know if you have any questions.

paul.stitt
2020-07-23 09:59
I found some links on the verifications channel, so I?ll see if we can get our broker configured and take it from there.

matt.fellows
2020-07-23 10:08
Which language are you using?

paul.stitt
2020-07-23 12:51
We?re mainly jvm and nodejs.

danhitchcock
2020-07-23 13:00
I am still hacking away trying to make a very basic (it's just an array, don't check the types) statement. It looks like https://github.com/pact-foundation/pact-specification/issues/71 does maybe answer /solve my problem?

krisdinesh
2020-07-23 13:40
Sorry @beth !!

daniele.scillia
2020-07-23 15:05
has joined #general

krisdinesh
2020-07-23 15:24
Exactly this issue is road block to me as well....waiting for V4 and it is a co incident same question I asked yesterday :blush:

danhitchcock
2020-07-23 16:00
In the end i just removed the whole array from the spec, as i couldn't find an acceptable halfway house that followed 'Postels Law' in some way or other.

krisdinesh
2020-07-23 16:03
Yes, I did remove that field in consumer contract as it is not highly required field in validation. Additionally, this field I removed is validated as part of unit test and also in end to test so that it covered in testing

sschectman
2020-07-23 16:18
has joined #general

komeershettyvinod
2020-07-23 18:53
Hi @matt.fellows

komeershettyvinod
2020-07-23 18:53
I have a question

komeershettyvinod
2020-07-23 18:53
I have a very large json body that i need to verify at consumer side

komeershettyvinod
2020-07-23 18:54
i cannot mention the whole json body within withBody {}

komeershettyvinod
2020-07-23 18:54
is there any clean way to do this

komeershettyvinod
2020-07-23 18:54
can you please help me out?

joel.whalen
2020-07-23 18:54
Pact team is on Australian time so there?s usually some delay

komeershettyvinod
2020-07-23 18:56
Hi Joel

komeershettyvinod
2020-07-23 18:56
can you help me out with my problme

joel.whalen
2020-07-23 18:57
No, I?m still quite new to Pact myself. Usually there?s about a day?s worth of time before a question is answered but this slack channel has been very good at answering my questions so far.

komeershettyvinod
2020-07-23 18:59
ok np

jarmy
2020-07-23 22:20
The secrets are only needed for deployments. I?ve just learned that the provider has ~20 dependent services so stubbing them all out would be cost prohibitive. I?ve currently positioned the pact verification test inside the acceptance test suite, which is run against a canary. If the canary fails, the deployment is rolled back. It sounds like Phil?s point still stands.

matt.fellows
2020-07-23 22:36
Cool. Let me know if you have issues with JS

matt.fellows
2020-07-23 22:37
I'm not sure what you mean by it's too big. Can you please ask the the appropriate language channel e.g #pact-js

komeershettyvinod
2020-07-24 03:05
I mean to say its very large , it has lot of fields to verify and having that raw json in test file is not looking clean, is there any way we can store that in json file and verify

matt.fellows
2020-07-24 04:09
what?s stopping you creating a separate file with the body in it, and then requiring that in your test?

matt.fellows
2020-07-24 04:09
I often create a fixtures directory, and have payloads there to reduce the noise in bigger test files

mike.geeves
2020-07-24 06:16
Hi, quick question, I had the ok to share back the Pact examples I was working on, if it would actually be of any use ofc. As a reminder I was creating some hello world examples using GitLab CI/CD to demonstrate multiple consumers and providers, primarily python. Unfortunately due to other priorities, I didn't do the next steps *yet* of making the GitLab pipelines spin up a docker database to then setup states to test against and finish documenting it all (GitLab setup especially) - would any of that be of use, if tidied up and completed a bit more ("that might be helpful if it had...."), I didn't see good example of GitLab pipelines or states apart from very simple hardcoded responses - any strong preference of open source license if sharing to release under?

matt.fellows
2020-07-24 06:16
sounds awesome, and thanks for the offer!

matt.fellows
2020-07-24 06:17
We tend to release under MIT, but that?s because it?s the most liberal and so tends to mean enterprises won?t be afraid to go near it

matt.fellows
2020-07-24 06:18
I think the provider states on the provider side is usually the most complicate concept to grasp, so that?s great if you have examples around that

matt.fellows
2020-07-24 06:18
Nice on the Gitlab webhooks, any lessons we may ?borrow? into the webhook template library

mike.geeves
2020-07-24 06:24
:+1: MIT should be fine, I'll add that in My bash-fu webhooks may or may not have been the best way but it worked for a start I'll add in MIT, tidy up and come back when there's something in a presentable state so may be a little while but I should have more time on it soon :slightly_smiling_face: state stuff looked really interesting, quite a lot to do there though

matt.fellows
2020-07-24 06:24
That?s great, thanks so much for the offer

matt.fellows
2020-07-24 06:25
I?m sure #pact-python will be super happy, and we?ll do our best to promote it around here

matt.fellows
2020-07-24 06:25
@elliottmurray is currently doing a lot of work in this space, he may be interested to see what you come up with to influence any design decisions too

mike.geeves
2020-07-24 06:38
:+1: the current ones were using AWS Chalice as a simple python lambda framework, I'm in the process of trying to now use FastAPI for everything because OMG documentation. Anyway, will tidy, share, and engage more in a bit (might be a week or two)

matt.fellows
2020-07-24 06:49
ha!

komeershettyvinod
2020-07-24 06:55
do we have some example

komeershettyvinod
2020-07-24 06:55
to share

komeershettyvinod
2020-07-24 06:57
I am not sure how to use in conjunction with withbody tag, I see most of the examples having small json which are used withbody tag

vishwa.amit
2020-07-24 07:32
has joined #general

poojashree_gopal
2020-07-24 11:04
has joined #general

komeershettyvinod
2020-07-24 15:08
@matt.fellows is it possible to share some example?

sidhartha.k.subudhi
2020-07-24 16:55
1. I need information for: Can we send an attachment along with certain JSON body in a request if yes how to do that? 2. Can we expect an attachment from a response, if yes, how to do that?

sidhartha.k.subudhi
2020-07-24 16:55
1. Can we send an attachment along with certain JSON body in a request if yes how to do that? 2. Can we expect an attachment from a response, if yes, how to do that?

bzifkin
2020-07-24 18:00
has joined #general

bzifkin
2020-07-24 18:01
Hi everyone I'm a developer for a start up in Chicago, USA

bzifkin
2020-07-24 18:02
im trying to run a POV to get my organization started with pact

bzifkin
2020-07-24 18:02
I am having some trouble getting my pact verify results to publish to my broker though

phil.endsley
2020-07-24 18:08
What language are you using for your providers? There's a channel for each language, and you'll probably get more targeted help there

2020-07-24 18:30
A new post has been created in *Feature Requests*

bzifkin
2020-07-24 18:31
im using java

phil.endsley
2020-07-24 18:38
We can get into the details in #pact-jvm

bzifkin
2020-07-24 18:38
thanks @phil.endsley

bzifkin
2020-07-24 18:38
ill post there

slack1260
2020-07-24 20:55
has joined #general

uglyog
2020-07-25 02:19
You need to be explicit about what you mean by _attachment along with certain JSON body_. What is the attachment and how are you sending it with the JSON body.

vishwa.amit
2020-07-25 18:42
Hi guys, I am new to pact contract testing .. I am trying to understand the pact test from contract side .. where service response is being mocked.. not sure how to mock as the example given in `pact-python` and `pactman` seems to be using the real response ...?

vishwa.amit
2020-07-25 18:42
``` def user(user_name): """Fetch a user object by user_name from the server.""" uri = 'http://localhost:1234/users/' + user_name return requests.get(uri).json()```

vishwa.amit
2020-07-25 18:44
where requests.get() is getting the actual resp from service?

vishwa.amit
2020-07-25 18:48
and in the test we matching against expected results. ```import atexit import unittest from pact import Consumer, Provider pact = Consumer('Consumer').has_pact_with(Provider('Provider')) pact.start_service() atexit.register(pact.stop_service) class GetUserInfoContract(unittest.TestCase): def test_get_user(self): expected = { 'username': 'UserA', 'id': 123, 'groups': ['Editors'] } (pact .given('UserA exists and is not an administrator') .upon_receiving('a request for UserA') .with_request('get', '/users/UserA') .will_respond_with(200, body=expected)) with pact: result = user('UserA') self.assertEqual(result, expected)``` `

vishwa.amit
2020-07-25 18:49
or am I missing something?

matt.fellows
2020-07-25 22:29
You still hit a real server, you just hit the Pact mock server instead of your usual provider

matt.fellows
2020-07-25 22:39
The pact mock server listens and validates everything and then records the contract

elliottmurray
2020-07-26 08:46
@mike.geeves we could do with a Chalice example as well in python. It is on my list but re-jigging the current e2e one at the moment

elliottmurray
2020-07-26 08:48
I suggest reading the docs a bit more first


elliottmurray
2020-07-26 08:49
explains what is going on pretty well (spoiler yes you are making actual http requests) but digest some of the content above.

elliottmurray
2020-07-26 08:49
If you have python specific problems there is #pact-python where we?ll try and answer your questions

mike.geeves
2020-07-26 09:24
@elliottmurray sure, will be happy to shuffle around I was thinking AWS could actually be a nice "starting point" anyway with a free tier. K8s cluster as a starting point to spin up into being a non free starting point once you get past local. Not sure about db though :thinking_face:

elliottmurray
2020-07-26 10:11
Whatever you?re comfortable with - all contributions welcome!

2020-07-26 12:00
A post in *Feature Requests* has been marked as *in progress*

bethskurrie
2020-07-26 22:22
@mike.geeves if you have some Gitlab webhooks that accept parameters, would you be able to submit a PR to this example? https://docs.pact.io/pact_broker/webhooks/template_library#gitlab---trigger-build

bethskurrie
2020-07-26 22:24
Hi @vishwa.amit . It seems like you might not have a good grasp yet of how pact works. Can I recommend watching this https://docs.pact.io/how-pact-works#slide-1

alexei.hmelevski
2020-07-27 00:42
has joined #general

scwang
2020-07-27 01:34
has joined #general

scwang
2020-07-27 01:36
Hi Guys, when I am running target , I always got "Request Failed - Unrecognized SSL message, plaintext connection?" , How I can make a https request ?

bethskurrie
2020-07-27 01:36
Hi @scwang. Can you please read this? https://docs.pact.io/resources/how_to_ask_for_help

scwang
2020-07-27 01:37
thanks

matt.fellows
2020-07-27 01:44
I?d say you?re either sending an `http://foo.bar/resource` to an `https://` running server, or vice versa.

matt.fellows
2020-07-27 01:45
but most of the time you do not need to test SSL with Pact. Because it just doesn?t add any value

francis.lobo
2020-07-27 01:59
has joined #general

bruno
2020-07-27 10:17
has joined #general

umfarooq
2020-07-27 13:28
has joined #general

sidhartha.k.subudhi
2020-07-27 14:09
When I am testing creation of a defect in Jira trough API. I need to send an attachment (a word file or any screenshot). So I need to send the attachment along with the request. How can I do this in PACT?

saulof
2020-07-27 18:39
has joined #general

joaquin
2020-07-27 23:04
has joined #general

bzifkin
2020-07-27 23:15
@bzifkin set the channel topic: Help us to help you! Please ask your question in the right channel for your language, and remember to use threads so we can keep the discussion focused on your issue. Thanks!

matt.fellows
2020-07-28 12:02
For those interested or unaware it?s happening, I?ve release a PoC of integrating Pact with Cypress. Read more over in the #cypress channel

matt.fellows
2020-07-28 12:02
Anyone doing work in that space, we?d love to get your thoughts and feedback if this is something we should pursue further

alexei.hmelevski
2020-07-28 13:30
Hi everyone, sorry if i used the wrong channel. I have a question is it possible to test contract like that. Im writing from the Consumer side for iOS but the question is more generic. More like is it possible? and does it make sense? Any opinion are valuable. Thank you. ```{ // Fixed payload "associatedEntities": [ { // fixed and dynamic payload (can be completely different based on the object) "associatedEntities": [ { //objects with different structures } ] } }```

david025
2020-07-28 15:02
has joined #general

daniel.pritchard
2020-07-28 15:03
has joined #general

guilherme.correa-ext
2020-07-28 19:34
has joined #general

guilherme.correa-ext
2020-07-28 19:39
Hi everyone, i don't know in what channel i should send this message but i and trying to upload 2 contracts for the same provider with version and tag but only one of these 2 contracts have the tags i verify that this is a know issue https://github.com/pact-foundation/pact-js/issues/289 My question is there is any thing i could make on my code to garanty that i will send the two contracts with tags ? or there is any estimate for when this bug will be fixed. Thanks for the help

jan.krejci
2020-07-28 20:09
has joined #general

paul.fairless
2020-07-28 21:44
has joined #general

javier.molina
2020-07-29 08:40
has joined #general

venkat.batchu81
2020-07-29 09:30
has joined #general

marco.dallagiacoma
2020-07-29 09:36
has joined #general

ivan.lombardiborgia
2020-07-29 09:40
has joined #general

matias.waterloo
2020-07-29 12:22
has joined #general

mike.geeves
2020-07-29 12:50
Breathe. FYI, vagueness due to I'm just coming to the end of a pretty intense period (about 12 years :smile:) of going through the crazy journey from sole 3rd party contractor dev to startup founder/first dev to head of tech/dev team, being bought out, "the things that happen when you're bought out" and finally now moving on. pact is on my list of tech I want to spend some time on while I take a little break :slightly_smiling_face: so many conversations the past few years of "if only we had some shared idea of the calls/payloads we wouldn't be in this mess" :joy: so yep, will certainly take a look, I just hope I can still remember how to code well enough :joy: little pause to get myself sorted before I get started on anything though

matt.fellows
2020-07-29 13:01
We?re here for you mate!

matt.fellows
2020-07-29 13:01
and also, congrats (I think?)

mike.geeves
2020-07-29 13:37
Thanks :slightly_smiling_face: I have no clue yet :rolling_on_the_floor_laughing:

amer.mohammed
2020-07-30 12:21
has joined #general

rafael.espillaque
2020-07-30 12:49
hi guys, I have a ?philosophical? question for you, when using Pact for messages. https://stackoverflow.com/questions/63173517/pact-flow-for-event-driven-applications I hope you can help me!

krisdinesh
2020-07-30 14:42
Hello Guys - I have a question on best practice. Kindly suggest your thought here. Running provider test post deploying to an instance is a good practice ? or Running provider test against codebase as soon as coding is completed(localhost)?

rafael.espillaque
2020-07-30 15:44
the best practice is to run them before even merging. Have a look at https://docs.pact.io/pact_nirvana and https://docs.pactflow.io/docs/workshops/ci-cd/

rafael.espillaque
2020-07-30 15:44
sorry, forgot to mention you @krisdinesh

krisdinesh
2020-07-30 16:57
Thanks @rafael.espillaque, so do we need to run the provider test again after we deploy/code merge?

abubics
2020-07-30 23:47
Running them again after deployment won't have any benefit, as long as the deployed things match the tested things.

abubics
2020-07-30 23:48
What you "need" to do depends on how much confidence you're trying to build.

abubics
2020-07-30 23:49
It's common, however, to run tests on merges, because that creates a new, unique set of code. You ideally want to test unique code, right?

krisdinesh
2020-07-30 23:52
In my case, doing provider test after merge has got great benefit to address multiple dev changes and also doing the same after deployment is totally different than localhost testing.

abubics
2020-07-30 23:54
If it gives you confidence, then go ahead :slightly_smiling_face: that's what testing is for. I guess I'd like to know why/how you'll get a different kind of confidence from contract tests in those environments, though.

krisdinesh
2020-07-30 23:56
Awesome

krisdinesh
2020-07-30 23:57
I totally agree with you....I am in process of identifying to best process here to fit....your point makes more sense

abubics
2020-07-31 00:19
I came for Pact, but stayed for the philosophy :troll:

abubics
2020-07-31 00:20
The way I tend to use Pact doesn't go very deep into either side of the network boundary, so re-running those tests after deploy wouldn't give me anything extra. I know many people use it differently, so it's horses for courses :innocent:

abubics
2020-07-31 00:21
It's always interesting to hear about the different setups people have, so if you end up with a new shape that you haven't read about, please share it somehow :party_parrot: People love blog posts and guides that better match their scenarios.

krisdinesh
2020-07-31 00:31
Thanks @abubics for your suggestion which clarified me few things regarding best practice.

sharath.konda
2020-07-31 15:02
has joined #general

ray.bradley
2020-07-31 16:39
has joined #general

francislainy.campos
2020-08-03 02:12
Hi, not sure if I understand the question fully but if you have your contract published to an online broker you should be able to verify against that.

francislainy.campos
2020-08-03 02:13
Owh, I see the rest of the conversation now. It's seem the issue is fixed, right?

bruno.penha
2020-08-03 07:54
has joined #general

bruno.penha
2020-08-03 08:02
Hello @channel: Does anyone already have this issue on not finding a feature file? It's repeating the project name... ```Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.01 sec <<< FAILURE! - in com.compay.project.rs.resources.MyCucumberNoPactITTest initializationError Time elapsed: 0.008 sec <<< ERROR! java.lang.IllegalArgumentException: Not a file or directory: C:\existing_path\<project_name>\<project_name>```

bruno.penha
2020-08-03 08:03
And this feature test exist on C:\existing_path\<project_name> but not in C:\existing_path\<project_name>\<project_name>

antonello
2020-08-03 08:15
It doesn?t look like a Pact problem, Bruno.

bruno.penha
2020-08-03 08:15
But this is blocking me to execute Pact tests

bruno.penha
2020-08-03 08:17
And you are right, seems more like a Cucumber problem than a Pact one...

antonello
2020-08-03 08:18
I appreciate that, but this is not the best place to get help with Cucumber. You might be better off asking on StackOverflow, a Cucumber forum or perhaps in your organisation.


bruno.penha
2020-08-03 08:21
Thanks, anto! I've already looked into Stackoverflow, but I'm not sure which is the appropriate channel for this question... I will browse the channels available :)

matt.fellows
2020-08-03 08:25
If you prove it?s a Pact issue, definitely here is a good place to ask. Ideally, you have an example repository we can look at to help.

matt.fellows
2020-08-03 08:25
I don?t hear cucumber here very often so I?d recommend trying Pact outside of Cucumber and getting that working first, and then integrating the two

matt.fellows
2020-08-03 08:26
otherwise you?re trying too many variables at once

bruno.penha
2020-08-03 08:28
You have a point, I'm looking int that - thanks :slightly_smiling_face:

william.isaksson795
2020-08-03 12:23
has joined #general

jarmy
2020-08-03 16:00
Is there a way to do exclusions when verifying pacts? E.g. to say that ?run all contracts except a, b?

antonello
2020-08-03 16:01
in what language?

jarmy
2020-08-03 16:02
Any language really, but JavaScript in this particular case

antonello
2020-08-03 16:03
the way you?d do it would be dependent on the languge

antonello
2020-08-03 16:03
in pact-jvm, you can, for example, filter by consumer

antonello
2020-08-03 16:03
and interactions

jarmy
2020-08-03 16:07
Is that done via `consumer_version_selectors`?

priyanshu.jain
2020-08-03 17:32
has joined #general

mthirupathi47
2020-08-03 18:02
has joined #general

voloshin1986
2020-08-03 18:25
has joined #general

matt.fellows
2020-08-03 23:37
Not with the flexibility I think you might want (albeit if you?re interested, please help vote on this RFC request: https://github.com/pact-foundation/pact-specification/issues/75#issuecomment-667624532)

matt.fellows
2020-08-03 23:37
You can run selected tests based on the interaction name/state or both: https://github.com/pact-foundation/pact-js#re-run-specific-verification-failures

bethskurrie
2020-08-03 23:42
@jarmy are you talking about excluding certain pacts based on a consumer name, or certain interactions (request/response pairs)? Which language?

matt.fellows
2020-08-03 23:42
He mentioned JS

jarmy
2020-08-03 23:43
Yes, JS. And yes, the capability to exclude certain pacts based on a consumer name.



matt.fellows
2020-08-03 23:46
(The link in Pact JS is broken, looks like an old alias is broken - i?ll fix that now)

bethskurrie
2020-08-03 23:47
The selectors don't currently let you exclude based on a consumer name.

bethskurrie
2020-08-03 23:47
If you're using pending pacts though, failing consumers won't fail your test suite.


jarmy
2020-08-03 23:53
I believe consumer_version_selectors just support inclusion. The team I?m working on bringing Pact to has a pretty aggressive deployment model. Their biggest requirement at the moment is being able to dynamically include/exclude consumers on the fly without having to make code changes. I?ll mention pending pacts to them again to see if it will meet their needs

bethskurrie
2020-08-03 23:53
can you explain that further?

bethskurrie
2020-08-03 23:53
how do you exclude consumers?

bethskurrie
2020-08-03 23:53
what does that mean in terms of what is happening in real life?

jarmy
2020-08-03 23:56
For example, a pact verification breaks because of a bad action (bad pact) by a consumer. The provider team doesn?t want their deployments to be held up while waiting for the pact to be fixed by the consumer

bethskurrie
2020-08-03 23:56
If they're using can-i-deploy, they'd need to use the "manual" version of it, because we don't yet have the option to exclude a pacticipant (though it's on the feature request list) https://docs.pact.io/pact_broker/client_cli/readme#alternate-usage---specifying-dependencies-explicitly

matt.fellows
2020-08-03 23:57
> For example, a pact verification breaks because of a bad action (bad pact) by a consumer. The provider team doesn?t want their deployments to be held up while waiting for the pact to be fixed by the consumer That?s what pending Pacts are for: http://blog.pact.io/2020/02/24/how-we-have-fixed-the-biggest-problem-with-the-pact-workflow/

bethskurrie
2020-08-03 23:57
> The provider team doesn?t want their deployments to be held up while waiting for the pact to be fixed by the consumer Pending pacts will fix this.

jarmy
2020-08-03 23:57
Ah, let me chat with my teammates again

tim.den.dulk
2020-08-04 08:05
has joined #general

jeroen.kropman
2020-08-04 08:09
has joined #general

stephen.attard
2020-08-04 09:54
has joined #general

matt.fellows
2020-08-04 10:34

sschectman
2020-08-04 14:17
Is there a way to establish state in consumer tests ? I am working with an API call that has a foreign key constraint and should work only if the foreign key exists

rafael.espillaque
2020-08-04 14:25
but, isn?t the foreign key in the provider side?

matt.fellows
2020-08-04 23:31
Yep, that?s what provider states are for Shifra

matt.fellows
2020-08-04 23:32
The consumer says ?the provider should be in _<some state>?_ and just before that test is run on the provider, it gets an opportunity to setup for that interaction



francis.lobo
2020-08-05 01:39
Pact newbie here. Does anyone know of any open source projects that use Pact ? I am interested in looking for some real world use cases to see how PACT usage evolves over time in real projects.

matt.fellows
2020-08-05 01:41
Well, it well depend on the language. For example, if you go to the Pact JS repo you can see the ?used by?. I know Pact is used in the IBM cloud tooling

matt.fellows
2020-08-05 01:42
I?m not aware of any high profile OSS projects using it, but would love to hear about them if they exist

francis.lobo
2020-08-05 01:43
sweet! that is exactly what I want. Thanks for pointing out :slightly_smiling_face:

tjones
2020-08-05 02:12
This is an awesome question! Would love to hear what you find out from your investigation, if it's easily summarisable

sklein
2020-08-05 13:20
How have individuals approached provider verification where the provider actually sits behind a proxy/gateway in production that handles redirects/rewrites for the path? In this scenario the consumer generated contract is listing the expected pathing to the proxy, but that path doesn't actually exist in the provider impl.

egor.ostapenko
2020-08-05 13:43
has joined #general

uladzislau_danilchyk
2020-08-05 14:11
@matt.fellows I have found following solution. You can define method with `@PostConstruct` and inside of it create `HttpTarget` instance. Could it be noted in your docs for JVM version of Pact? It would be quite useful.

matt.fellows
2020-08-05 14:22
There may be an article on our docs about this, I can?t quite recall

sklein
2020-08-05 14:23
Perfect, I'll take a read

sklein
2020-08-05 14:23
Thanks!

matt.fellows
2020-08-05 14:25
If it?s _just_ the path mapping it?s doing, then you can do a few things: 1. Run the proxy as part of the tests (or replace it with a suitably simpler/dumb proxy layer) 2. Configure the BaseURL in the consumer tests pact to have the path of the actual provider 3. Configure the provider side pact test to know about this path 4. Manipulate the pact before it hits the provider to re-write the paths. More dangerous, but things like request filters (in JS/JVM/Go) can do that fairly safely). It should be easy enough to put a layer

matt.fellows
2020-08-05 14:25
they all have good/bad bits to them, but it?s going to be better than creating a whole new pact interaction between the proxy as well

sklein
2020-08-05 14:26
I figured 1) might be the answer which, in our case, might be the best approach since we already spin up an nginx proxy in the verification stack to run ssl termination. I was hoping we maybe wouldn't need to carry forward the redirects also, but that's fine

sklein
2020-08-05 14:27
Yes creating pacts with the proxy was not something I wanted to hear :slightly_smiling_face:

ukrainian1991
2020-08-05 16:37
Hi, does pact work with several interactions in single @ Pact method? ```@Pact(provider = "B", consumer = "A") public RequestResponsePact pactForGenerateFullProfile(PactDslWithProvider builder) { return builder .uponReceiving("request correct get_devices_metainfo") .path("/cpe/get_device_metainfo/200") <<<< the first .method("POST") .headers(headers) .body(...) .willRespondWith() .status(200) .headers(headers) .body(...) .uponReceiving("request generate full profile") <<< the second .path("/cpe/generate_profile/200") .method("POST") .headers(headers) .body(...) .willRespondWith() .status(200) .headers(headers) .body(...) .toPact(); }```

phil.endsley
2020-08-05 17:25
I'd try asking in #pact-jvm since this is specific to that library

jbradyj
2020-08-05 21:01
has joined #general

matt.fellows
2020-08-05 22:39
that being said, it?s possibly a use case we could support better. If you had ideas don?t be afraid to raise a feature request

matt.fellows
2020-08-05 22:39
one example could be to allow a configurable ?base path? type thing in the verification process. I think at the moment it only accepts a hostname and the path is ignored. I may be wrong there

matt.fellows
2020-08-05 22:41
but TL;DR yes

2020-08-06 07:08
A new post has been created in *Feature Requests*

ashish_garg5
2020-08-06 09:23
Hi, Is there any specific channel for pact-node ? i am using angular 8 and facing issue while downloading pact dependencies. want to know which version is compatible with Angular 8. Thanks.

matt.fellows
2020-08-06 09:34
There is a channel for that. It's named exactly that

ashish_garg5
2020-08-06 09:36
ok thanks

matt.fellows
2020-08-06 09:36
:+1:

sam.tavakoli
2020-08-06 10:29
has joined #general

sam.tavakoli
2020-08-06 11:02
Hi all, I'm currently trying to understand the pactbroker.pactURL variable substitution and when the structure was changed. We were running pact broker 2.19.2-1 and upgraded it to 2.57.0.0 the url structure of pactURL changed from https://pactbroker.local/pacts/provider/foo/consumer/bar/version/consumer_version_number to https://pactbroker.local/pacts/provider/foo/consumer/bar/pact-version/somehash/metadata/base64data_with_consumer_version_number_etc I'm wondering if this is the commit that changed the behaviour: https://github.com/pact-foundation/pact_broker/commit/426b0b19 Would it be possible to configure the behaviour of this pactURL substitution?

matt.fellows
2020-08-06 11:24
Hi Sam, this might best be asked in the #pact-broker channel

matt.fellows
2020-08-06 11:26
You might also be best mentioning why it?s an issue for you.

hadjaliabir
2020-08-06 12:17
Hello everyone ! can i change the folder (target\pacts) where my pacts are generated ?

rafael.espillaque
2020-08-06 12:43
if using java and junit, you can use the @PactFolder annotation

ranjanayush03
2020-08-06 13:34
Ye s you can do that by setting the rootDir like for example if you want it to be present inside build folder then pact.rootDir =("build/pacts") might work for you include this in your consumer side test cases.

hzhang1
2020-08-06 20:18
has joined #general

jacques.murekezi
2020-08-07 08:24
has joined #general

jacques.murekezi
2020-08-07 08:44
@here I am having trouble setting up my test: I have an Api (.net core), The point of entry is a controller/action. the controller calls the service. In terms of making consumer/Producer is the controller the producer and Service call the consumer?

abubics
2020-08-07 10:20
Probably want to hop over to #pact-net :slightly_smiling_face:

jan.krejci
2020-08-07 18:22
Hi guys, I have a question : Is it a best practice to have the same consumer name if my consumer has two different providers? It is because I can set up a different name for each Pact like that `- @Pact(provider = "AccountBalanceProvider", consumer = "AccountConsumer")`

camila.pinto-ext
2020-08-07 18:25
hi jan!

bzifkin
2020-08-07 18:33
Hey all....my organization does feature branch development. Branch names are guaranteed to be unique. I know that pacticipant version numbers are usually recommended as app version numbers plus a git sha, and tthat branch name is recommended for tagging

bzifkin
2020-08-07 18:34
however if the branch names are guaranteed to be unique would that make them a good choice for pacticipant versions as well?

phil.endsley
2020-08-07 18:38
Don't you have a "main" branch you merge into/release from? Any pacts generated from that would all have the same version, and you should be generating pacts with each build (each time you merge) In addition, any branch that has multiple builds would have multiple pacts generated with a shared version as well.

bzifkin
2020-08-07 18:52
so we utilize a pr system and a portion of our CI/CD pipeline runs then. I was thinking that at that time we would publish/version. Then when we merge to master theres no publishing/verification

bzifkin
2020-08-07 18:53
i see your point about the multiple pacts w/ a shared version though....esp if the consumer expectations get changed in two separate commits to the same branch

bzifkin
2020-08-07 18:57
alright then - i guess we'll use the commit sha to version...i kinda wanted to branch names just cause ive been having a hell of a time getting the commit sha into the version

bzifkin
2020-08-07 19:13
@phil.endsley how does your org get the commit sha to put it in the version number

phil.endsley
2020-08-07 19:22
The way we derive our application versions is over-engineered and complicated. So much so, that we wrote a gradle plugin that does it for us. The commit sha is involved in that process, so we get it for "free" Essentially, the part you care about boils down to running `git rev-parse --short HEAD` Also, your CI server might already provide it and expose that for you? We use Bamboo and it does this out of the box I believe. Would have to dig through your CI's documentation to find out though...

mamtha.3687
2020-08-07 20:08
Have a similar issue. Could use some help if this has been solved @jarmy. We're trying to do pact verify in Jenkins. Unable to get the localhost up for the pactverify to succeed. Getting a connection refused error (obviously because the localhost:8080 isn't running. What I am looking for is, is there a way to run the java springboot app im background in the CI at least until pactVerify runs and then if I can just kill it.

jarmy
2020-08-07 20:18
I might be wrong but I think you?ll want to annotate your verify test class with `SpringBootTest`. You might get better advice in #pact-jvm

bzifkin
2020-08-07 20:35
hmm...we use jenkins to run gradle scripts

bzifkin
2020-08-07 20:36
the issue is that no matter what i do w/ gradle i cant get it to run the command that gets the commit sha

matt.fellows
2020-08-07 22:12
Yes you should keep the same name

victor.mansilla.munoz
2020-08-08 03:49
has joined #general

tjones
2020-08-10 02:48
I usually include the branch name in the version string

tjones
2020-08-10 02:49
Because Pact has some requirements about version numbers, I've been thinking that it might be useful for us to provide gradle plugins (etc) that provide version numbers

steve.mackinnon
2020-08-10 03:10
has joined #general

vit.barabash
2020-08-10 08:05
has joined #general

stanislav.ondac
2020-08-10 10:05
has joined #general

coduo123
2020-08-10 11:12
has joined #general

sam.tavakoli
2020-08-10 13:48
Hi All, According to https://docs.pact.io/pact_broker/#step-2-provider-ci-build it says "The provider has a verification task that is configured with the URL to retrieve the latest pact between itself and the consumer." Why is it latest and not the specific interaction that triggered the content_change webhook? Imagine if there are two PR's on a consumer project which changes interactions with provider. How would Provider be able to distinguish them two if it only looks at latest interaction?

matt.fellows
2020-08-10 13:51
It's a good question! Of course, you can configure all of those things :wink:

matt.fellows
2020-08-10 13:52
Read the effective pact setup guide goes through all of this

matt.fellows
2020-08-10 13:52
The CI/CD workshop is also very good and more detailed when you're ready to implement

sam.tavakoli
2020-08-10 13:53
CI/CD workshop is specific for pactflow if I'm not mistaken? Is this the effective pact setup guide? https://docs.pact.io/pact_nirvana

sam.tavakoli
2020-08-10 13:53
Thanks for the quick response @matt.fellows

sidhartha.k.subudhi
2020-08-10 13:55
Hi,

nkelly
2020-08-10 14:20
has joined #general

bzifkin
2020-08-10 16:22
that would be great, for such a simple things it been pretty difficult to get it to work well

nodirbek
2020-08-10 21:18
has joined #general

matt.fellows
2020-08-10 22:04
It uses Pactflow but the principles are the same

matt.fellows
2020-08-10 22:05
You can achieve the same thing using the OSS broker and the entire workshop is compatible with both

bethskurrie
2020-08-11 06:37
@sam.tavakoli if you configure it correctly, in the "contract changed" workflow, you *are* verifying the one that has changed.

bethskurrie
2020-08-11 06:37
There are two flows - one when the provider changes, and one when the contract changes.

bethskurrie
2020-08-11 06:38
When the contract changes, the Pact Broker triggers the webhook with the URL of the changed pact, which gets passed through to the build.


bethskurrie
2020-08-11 06:41
The docs on the particular page you're on should be updated to make that clearer - they're quite old.

sam.tavakoli
2020-08-11 07:28
Thank you Beth, I did have a deeper read of it and it's more clear now. What wasn't clear in that article was the use of latest without mentioning tags. If I have two PR's where I use their branch name as tag then choosing the latest pact content based on this makes more sense than 'latest interaction'. https://docs.pact.io/getting_started/versioning_in_the_pact_broker This page was hugely helpful in understanding how pact does it also behind the scene

sam.tavakoli
2020-08-11 07:29
That's good to know, cheers!

bethskurrie
2020-08-11 07:37
> What wasn't clear in that article was the use of latest without mentioning tags

bethskurrie
2020-08-11 07:37
Those docs were originally written 6 years ago, and have been incrementally updated - I should just remove them and point to the other ones that I sent to you.

ales.orel
2020-08-11 08:08
has joined #general

jacques.murekezi
2020-08-11 15:54
Hi All, I have this function: ```saveApplication(details: Application): Observable<any> { return http://this.http.post(`http://localhost:5000/Apply`, details); }``` And I am writing a Pact Test for it (API contract testing) and below is the test: ```describe('ApplicationService contract testing', () => { let provider: PactWeb; let applicationService: ApplicationService; beforeAll(function (done) { provider = new PactWeb({ cors: true, host: '127.0.0.1', port: 9776, logLevel: 'error' }); setTimeout(done, 2000); provider.removeInteractions(); }); afterAll(function (done) { provider.finalize().then(function () { done(); }, function (err) { done.fail(err); }); }); beforeEach(() => { TestBed.configureTestingModule({ providers: [ApplicationService], imports: [HttpClientTestingModule] }); applicationService = getTestBed().get(ApplicationService); }); afterEach((done) => { provider.verify().then(done, e => done.fail(e)); }); describe('Save', () => { const _details: Application = { title: 'Mr', firstName: 'Application', lastName: 'applicant', dob: new Date(1977, 10, 10).toString(), gender: 'M' }; beforeAll((done) => { provider.addInteraction({ state: ' a task to save the dashboard application to mongo', uponReceiving: ' a request to post', withRequest: { method: 'POST', headers: { 'Content-Type': 'application/json' }, path: '/Apply', body: _details }, willRespondWith: { status: 201, headers: { 'Content-Type': 'application/json' } } }).then(done, e => done.fail(e)); it('should call the API to Post the application Content', (done) => { const _response: any = {}; applicationService.saveApplication(_details).subscribe(res => { expect(res).toEqual(_response); done(); }, error => { done.fail(error); } ); }); }); }); });``` The test isn't running when id npm run test or ng test, ut the pacts directory is being created. I don't know what is missing from my configs This is what I have in Karma: ``` frameworks: ['jasmine', '@angular-devkit/build-angular','pact'], plugins: [...., require('@pact-foundation/karma-pact')], pact: [{ cors: true, port: 9776, consumer: "ui", provider: "Apply", dir: "pacts/", spec: 2 }], proxies: { '/api/applications/v1/': 'http://localhost:9776/Apply/' },``` Not sure what I am missing. any help?

elliottmurray
2020-08-11 16:28
probably for #pact-js ?

bret.mcclory
2020-08-11 18:39
has joined #general

bret.mcclory
2020-08-11 18:53
Hi there, new user. Trying to test out WIP pacts, hopefully missing something simple here. Uusing http://Pactflow.io and the pact-net client. The broker is stubbornly refusing to return any WIP pacts in the resp. Verbose logging shows I'm getting an empty collection in the /for-verification request, despite including the "includeWipPactsSince" flag. ```"POST /pacts/provider/[REDACTED]/for-verification HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: application/hal+json\r\nUser-Agent: Ruby\r\nContent-Type: application/json\r\nAuthorization: [redacted]\r\n" <- "{\"includePendingStatus\":true,\"consumerVersionSelectors\":[{\"tag\":\"master\",\"latest\":true},{\"tag\":\"prod\",\"latest\":true}],\"providerVersionTags\":[\"bret-test\"],\"includeWipPactsSince\":\"2020-07-12\"}" -> "HTTP/1.1 200 OK\r\n" -> "Date: Tue, 11 Aug 2020 18:32:08 GMT\r\n" -> "Content-Type: application/hal+json;charset=utf-8\r\n" -> "Content-Length: 160\r\n" -> "Connection: keep-alive\r\n" -> "Status: 200 OK\r\n" -> "X-Pactflow-Git-Sha: 99df8905\r\n" -> "Vary: Accept\r\n" -> "X-Pact-Broker-Git-Sha: 2c140da0\r\n" -> "X-Request-Id: 59f7ce580157e8d8c8c3e1da811e032e\r\n" -> "X-Pact-Broker-Version: 2.59.1\r\n" -> "X-Frame-Options: SAMEORIGIN\r\n" -> "X-XSS-Protection: 1; mode=block\r\n" -> "X-Content-Type-Options: nosniff\r\n" -> "Referrer-Policy: strict-origin\r\n" -> "Strict-Transport-Security: max-age=31536000 ; includeSubDomains\r\n" -> "\r\n" reading 160 bytes... -> "{\"_embedded\":{\"pacts\":[]},\"_links\":{\"self\":{\"href\":\"https://[REDACTED].http://pactflow.io/pacts/provider/[REDACTED]/for-verification\%22,\%22title\%22:\%22Pacts to be verified\"}}}"``` Looking in Pactflow UI, I see an unverified pact hanging out there for this provider (published an hour ago) with a tag that doesn't match the explicit ("prod" and "master") in the request. I expected this Pact to get returned and verified (in pending mode). Suggestions?

phil.endsley
2020-08-11 19:48
> "providerVersionTags\":[\"bret-test\"] Do you have a provider version that is tagged with `bret-test` already? The tag you send in `providerVersionTags` has to already be existing

briana.mcn
2020-08-11 19:48
has joined #general

bret.mcclory
2020-08-11 19:50
I was wondering about that. No, I don't. I'm doing this entirely via the pact-net client right now, and looking at the verbose logs, it doesn't appear to be making any PUT/tag request (to establish the tagged provider version) before making this request /for-verification. Is that something I'll need to do explicitly out side of the pact-net client?

phil.endsley
2020-08-11 19:56
I'd check in #pact-net for specifics about how to do that with the pact-net client. I've never touched it, so can't help you there... I know the jvm libraries have ways to publish tags. I would be surprised if pact-net does not support that. I think best practice would be that you're tagging the provider (and consumer) versions when you publish verification results and pacts. The WIP pacts get picked up for the "main" branch build once you merge the provider in. I don't think you'll be able to tag a provider version before running the /for-verification request, since that's what pulls in the contracts to verify against. You won't have verification results to publish and tag, because you haven't pulled any down yet.

bret.mcclory
2020-08-11 19:59
I did make an explicit API call just now to establish a provider version with that tag -- PUT /pacticipants/[providername]/versions/[vers]/tags/bret-local -- and the request /for-verifications to include wip pacts still returns nothing. Is there some chicken/egg boostrapping issue here? I.e. does this provider (+version) need to have verified at least one pact before it really exists in the broker? I'm just starting out here, working in non-master branches, so I don't have _any_ published verifications for _any_ consumer versions of this Pact yet.

phil.endsley
2020-08-11 20:15
> /bret-local Not sure which one is right, but the logs you had above had `bret-test`, not `bret-local` The provider verification results have to be published for it to exist in broker to tag. Also, there's also a pretty solid workshop that walks through the whole workflow of pacts, including WIP pacts, if you haven't seen it: https://docs.pactflow.io/docs/workshops/ci-cd/

bret.mcclory
2020-08-11 20:19
I'm still trying to grok your first reply: > Do you have a provider version that is tagged with `bret-test` already? The tag you send in `providerVersionTags` has to already be existing What brings a provider version/tag into existence? Exploring the HAL Browser, I observe that "providers" are created on-the-fly when a new Pact is published, but no versions/tags exist for that provider yet. I assumed that a provider versions would be created on-the-fly when verification results are published during CI builds. On an initial build of a new provider tag (branch), that tag won't exist yet in the Pact broker, so I don't know how it could be "already existing" for purposes of this wip feature. But I'm sure I'm overlooking something fundamental here.

bret.mcclory
2020-08-11 20:19
BTW thanks for helping out, and good catch on the -test / -local diff, I'll double check.

phil.endsley
2020-08-11 20:19
I don't think WIP pacts are great for the feature branch being developed. I think the use case it was trying to solve was fixing the merging workflow for a consumer and provider feature branch. If you're doing feature branch development, ~the~ a happy path where everything "just works" seems to be: ? Develop consumer in feature branch ? Develop provider in feature branch ? Merge provider ? Merge consumer WIP pacts make it easy to go from "merge provider" to "merge consumer". After using starting to use the feature, it doesn't seem like it makes sense to leverage WIP pacts for a provider feature branch. @bethskurrie feel free to correct me

phil.endsley
2020-08-11 20:30
> On an initial build of a new provider tag (branch), that tag won't exist yet in the Pact broker, so I don't know how it could be "already existing" for purposes of this wip feature. But I'm sure I'm overlooking something fundamental here. Yeah, it won't exist yet, so it won't pick up the WIP pacts I think it's worth opening the discussion about this though. This is the third time this has confused people (me being one of the three). I can see both sides though ? If /for-verification returned WIP pacts when the `providerVersionTags` does not exist in broker, that means all your existing pacts (since includeWipPactsSince) will be verified against new feature branches. Which is probably something most people don't want most of the time? Really, you only care about the one consumer feature branch you're implementing functionality for (I'm making assumptions :slightly_smiling_face: ) ? On the other hand, it seems like people expect it to return WIP pacts if the tag doesn't exist yet. But this is kind of strange for feature development if you think about it, because after the first successful verification, it won't pick it up anymore (because it's no longer WIP)

bret.mcclory
2020-08-11 20:31
I think I get what you're saying. > it doesn't seem like it makes sense to leverage WIP pacts for a provider feature branch. So the guidance may be, when dynamically fetching Pacts for verification, as demonstrated in the CI/CD workshop, you should only do `includeWipPactsSince` when provider tag == "master" (or something like that?) I was hoping the WIP feature would give me feedback that I've implemented my provider feature correctly -- i.e. verified the consumer feature Pact -- _before_ I merge it to master.

phil.endsley
2020-08-11 20:32
Yeah. Instead, you need to set up your provider in a way that the consumer version selectors would pick up your consumer feature pact.

phil.endsley
2020-08-11 20:33
As an example, one way would be to name your provider and consumer branches the same, and use that as the tag in a consumer version selector. Set it as an env var in your CI build so it would pick up the consumer feature pact

bret.mcclory
2020-08-11 20:33
Was afraid of that. Per the guidance of the CI/CD workshop, guess that means I either need to tinker with the verification code (and remember to undo changes before merge to master) or ensure that provider/consumer branch names are matching.

phil.endsley
2020-08-11 20:35
We're in the same boat. We can't name our branches the same, because we have unique prefixes to match tickets. I wrote up a feature request to support regex for tags though. It would solve it for us, not sure if it would help you as well. https://pact.canny.io/feature-requests/p/allow-version-selectors-to-specify-tags-with-regex

bret.mcclory
2020-08-11 20:36
I'll have a look. Thanks again for your help!


sschectman
2020-08-12 14:25
Getting this error when verifying a pact with state : Error setting up provider state at http://localhost:54926/_pactSetup

hzhang1
2020-08-12 14:29
hello all, anyone has some code sample for using pact-python against graphql endpoint?

bzifkin
2020-08-12 19:28
Hello all. I asked this question in #pact-jvm but figured id ask here as well. For the provider tests it seems like the entire service has to spin up. Some of our provider services take anywhere from 10-20 minutes to spin up (using docker)

bzifkin
2020-08-12 19:29
one of our goals is to speed things up so this isnt kinda a barrier to entry....how have people handled this in their implementations of pact?

abubics
2020-08-13 00:25
Best to ask in a channel specific to your provider platform (e.g. #pact-jvm, #pact-js, etc)

matt.fellows
2020-08-13 04:19
are you running them on an external platform (e.g. deploying to Kube/ECS/GKE or something)?

matt.fellows
2020-08-13 04:19
Or locally?

matt.fellows
2020-08-13 04:19
(hint: you should do it locally)

matt.fellows
2020-08-13 04:20
yep, please do that and share some code that you?ve written (ideally share the states setup bit at a minimum, and the entire log)

matt.fellows
2020-08-13 04:20
see the debug section in the Pact JS docs

lucasmat.7
2020-08-13 07:36
has joined #general

subash.gururaj
2020-08-13 12:00
has joined #general

amod.shankar
2020-08-13 12:59
has joined #general

bzifkin
2020-08-13 14:33
Yeah running them on an external platform

bzifkin
2020-08-13 14:35
in the case of a consumer merge our jenkins pipeline would kick off provider(s) verification test and that would need to build on the platform wouldnt it?

andrea.spina
2020-08-13 16:14
has joined #general

tom.wilson
2020-08-13 18:13
has joined #general

ziadtawfeek05
2020-08-13 19:34
has joined #general

matt.fellows
2020-08-13 21:24
We would recommend you don't test providers on a deployed environment but rather a locally running provider (e.g. on the CI server itself or locally on dev machines when making changes)

bzifkin
2020-08-13 21:31
sorry i think i may have misunderstood.... it would be running on a CI server, but we would be spinning it up on demand based on the test

bzifkin
2020-08-13 21:31
and the spinning up could take a while if the full docker image is built

iesmite
2020-08-14 00:37
has joined #general

bethskurrie
2020-08-14 00:38
Is there a way you can test the app directly, or does it have to be spun up via docker?

bethskurrie
2020-08-14 00:39
@hzhang1 not that I've seen. There are some js examples, but pact python doesn't have any graphql helpers. You would have to hand code the expectations.

bethskurrie
2020-08-14 00:41
The app that I'm working on at the moment is Pactflow (funnily enough :laughing: ). It gets deployed as a docker image. Pactflow has Pact verification tests that run just after the unit tests. We test the application directly - we don't build it first.

bethskurrie
2020-08-14 00:41
We want the feedback to come as early as possible - waiting for a docker image to be built would slow down the feedback cycle.

bethskurrie
2020-08-14 00:42
Ideally, you want to be able to run the pact tests as early as possible in the release pipeline. Is that possible for you?

matt.fellows
2020-08-14 02:53
And a follow up to this (to help with the ?pact is slower than what we had? argument), what did you do to test things before?

preethighalke
2020-08-14 07:13
Hi, we are trying to publish pact to a pact broker using the maven plugin, but end up with this error intermittently: ```Failed to execute goal [32mau.com.dius:pact-jvm-provider-maven:4.0.10:publish[m [1m(default-cli)[m on project [36mpublisher-pact[m: [1;31mExecution default-cli of goal au.com.dius:pact-jvm-provider-maven:4.0.10:publish failed: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 337 column 3 path $[m ->``` we have this defined in our build: <plugin> <groupId>http://au.com.dius</groupId> <artifactId>pact-jvm-provider-maven</artifactId> <version>4.0.10</version> <configuration> <pact.showStacktrace>true</pact.showStacktrace> <pactBrokerUrl>${broker.url}</pactBrokerUrl> <projectVersion>${project.version}</projectVersion> <trimSnapshot>true</trimSnapshot> <!-- Defaults to false --> <skipPactPublish>false</skipPactPublish> <!-- Defaults to false --> </configuration> </plugin> Are we missing anything? any reference would help. Regards.

matt.fellows
2020-08-14 07:14
what does your pactfile look like? It seems to be reporting its invalid json

preethighalke
2020-08-14 07:20
the pact jsons that are getting generated using the consumer tests are very much valid, used json validator to validate the generated Json, but the maven plugin fails.

matt.fellows
2020-08-14 07:21
then my next guess is that it?s not able to communicate to the broker and is not getting a valid JSON response

matt.fellows
2020-08-14 07:21
maybe enable debug logs to see what the plugin can see?

preethighalke
2020-08-14 07:25
The connection to broker looks fine as mvn pact:publish works sometimes and when it fails it shows the error mentioned above. we have this enabled <pact.showStacktrace>true</pact.showStacktrace> but we could not see any more debugs

matt.fellows
2020-08-14 07:26
fair enough - that?s about as far as I can go as I don?t know anythting about the Maven setup I?m afraid

preethighalke
2020-08-14 07:33
ok i thought the issue is with the pact maven plugin as it handles the response from the pact broker and i was unable to set the ```JsonReader.setLenient(true)``` for the plugin

os.shulyak
2020-08-14 09:03
Hey there. Got a question regarding Messages testing with PACT for PHP. Is that available now or it?s only for JVM ?


krisdinesh
2020-08-14 13:39
Hello All - I am successfully able to implement PACT for our Client and tones of thanks to all the folks who helped to answer my questions and I would like to call out @matt.fellows for his kind help. This is really a fantastic tool for contract testing for sure. Thank you all :slightly_smiling_face:

ruchika.lakhina
2020-08-14 15:42
has joined #general

bzifkin
2020-08-14 20:41
@matt.fellows sorry its definitely not slower, but its not much of an improvment

bzifkin
2020-08-14 21:05
@bethskurrie so what would happen rn is we would push a feature branch for a consumer, kicking off our jenkins pipeline, after unit tests we would hit the pact broker and tell it to begin any applicable provider verification tests. So the verification tests would be after unit tests but before the integration tests of the consumer itself. I'm just concerned that adding in the call for the provider verification tests will be time consuming b/c the providers need to be spun up

bzifkin
2020-08-14 21:06
I think i maybe missing something here, sorry if this is a silly question

uglyog
2020-08-15 02:42
Does it go through a proxy server?

alexfdz
2020-08-17 06:04
has joined #general

alexfdz
2020-08-17 06:15
Aloha Pact! I?m trying to find good practices around sharing our pacts with internal/external devs in a more friendly way than json. Anyone here doing something like that? Docs autogeneration of some sort? We would love to expose something similar to the pactflow generated docs, but in our own content provider.

alexfdz
2020-08-17 06:19
I found something for https://github.com/pact-foundation/pact-ruby/wiki/Autogenerated-documentationbut it does not seem available in other languages (we are with pact-go)

tjones
2020-08-17 06:33
I haven't done anything like this, but I'm interested. What's the use case?

tjones
2020-08-17 06:35
I tend to think that pact (and also swagger) is for machines to read, not humans. However, sometimes there needs to be supporting information with the contract in order to implement the provider side - especially around provider state. So there are probably some improvements or helpful recommendations we could make in the documentation.

alexfdz
2020-08-17 06:35
We generate the Pact for some consumers (internal) of our API, and they would like a more friendly docs


alexfdz
2020-08-17 06:36
Pactflow?s outcome is probably good enough, but we would like to publish it with our internal API docs

alexfdz
2020-08-17 06:38
thanks @matt.fellows! I guess is a standalone version of https://github.com/pact-foundation/pact-ruby/wiki/Autogenerated-documentation

tjones
2020-08-17 06:41
> We generate the Pact for some consumers (internal) of our API, and they would like a more friendly docs Are your consumers not controlling their own pacts?

tjones
2020-08-17 06:42
If you only have one consumer and one provider, a pact (often) enumerates all the endpoints. However, when there are multiple endpoints, not all pacts will use all endpoints (or all parts of a response). For this reason, it's hard to document or draw an entire picture of what is available in the API from pacts

alexfdz
2020-08-17 06:42
not all of them? We are trying to move them to CDC

alexfdz
2020-08-17 06:43
`pact docs` is probably more than enough!

tjones
2020-08-17 06:43
It is possible to draw a picture of what is used - I remember talking (maybe with @bethskurrie?) a while back about creating something that would take a swagger doc and a pact, and colour the parts of the API that were unused

tjones
2020-08-17 06:44
I didn't build anything on it, but I think it would be a cool tool

tjones
2020-08-17 06:45
I'm keen to hear more about what you're up to - are you saying you have like "example pacts" that you share with your consumers who aren't using CDC yet?

tjones
2020-08-17 06:46
or do you share other consumer's pacts?

matt.fellows
2020-08-17 06:46
The atlassian mock validator could be a starting point to do that btw Tim

tjones
2020-08-17 06:47
Yes, potentially. I was looking at it the other day for another reason

os.shulyak
2020-08-17 08:34
Morning. I?m trying it implement PACT messages in php with this example https://github.com/pact-foundation/pact-php#message-support , but i?ve got the error with using of `ExampleMessageProvider` class, and the error looks like this: ```Error : Class 'MessageProvider\ExampleMessageProvider' not found``` and this is the namespace that i use: ```use MessageProvider\ExampleMessageProvider;``` For now, have no idea how to fix that..

matt248
2020-08-17 08:51
has joined #general

alex.elmekeev
2020-08-17 09:29
has joined #general

matt.fellows
2020-08-17 10:34
Might best ask in #pact-php


tomas.bruhn
2020-08-17 13:32
has joined #general

damianattademo
2020-08-18 01:39
has joined #general

alexfdz
2020-08-18 10:46
@tjones we are trying to use ?example pacts? for endpoints with consumers not CDCing, so we get: ? Integration tests ? Documentation of our API to share with them ? Mocks to share with them ? A way to convince them to create the pacts by themselves

sidhartha.k.subudhi
2020-08-18 14:47
Need help on how to write provider test for POST and DELETE requests. If anybody can give some example it will be great help.

sidhartha.k.subudhi
2020-08-18 14:48
Just need help the functionality of injectAccessToken(HttpRequest request)

vladyslav
2020-08-18 15:08
has joined #general

francislainy.campos
2020-08-18 16:06
```package com.hmhco.crs.v2.pact_tests.consumer; import au.com.dius.pact.consumer.dsl.DslPart; import au.com.dius.pact.consumer.dsl.PactDslJsonBody; import au.com.dius.pact.consumer.dsl.PactDslWithProvider; import au.com.dius.pact.consumer.junit5.PactConsumerTestExt; import au.com.dius.pact.consumer.junit5.PactTestFor; import au.com.dius.pact.core.model.RequestResponsePact; import au.com.dius.pact.core.model.annotations.Pact; import io.restassured.RestAssured; import io.restassured.response.Response; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import java.util.HashMap; import java.util.Map; import static com.hmhco.crs.v2.config.Constants.CRS_SERVICE; import static com.hmhco.crs.v2.config.Constants.ED_UI; @ExtendWith(PactConsumerTestExt.class) public class PACTConsumerEdUiCrsTest { Map<String, String> headers = new HashMap<>(); String getRecommendations = "/api/v1/getRecommendations"; @Pact(provider = CRS_SERVICE, consumer = ED_UI) public RequestResponsePact createPact(PactDslWithProvider builder) { headers.put("Content-Type", "application/json"); DslPart body = new PactDslJsonBody() .object("students") .eachKeyLike("2d6c9d8b-b3d4-4a7c-8e4b-3211e2a1df17") .stringType("refId", "2d6c9d8b-b3d4-4a7c-8e4b-3211e2a1df17") .stringType("lasid", "818-29-6858") .stringType("email", "") .stringType("username", "QAStudent9_92023601_int") .stringType("grade") .object("name") .stringType("firstName", "Nathanael") .stringType("middleName", null) // this may or not be null for some users. Remove it from contract. .stringType("lastName", "Nathanael") .closeObject() .closeObject() .closeObject() .eachLike("skills", 1) .stringType("id", "7810fb5f-a45d-41af-baeb-ac08dd10546b") .stringType("title", "Read Words with Consonant \\\"r\\\" /r/") .stringType("skillRecommendationReason", "Progressing: this student is progressing towards proficiency with the following standards and will benefit from additional instructions and practice.") .array("students") .closeArray() .eachLike("contentRecommendations") .stringType("identifier", "l_479ac4a4-6fc3-4323-9609-ca614c672016_ac54bcae-235c-4d50-a5d8-bca2767dabe7") .decimalType("score", 1.2450236288128311) .array("contentRecommendationReason") .string("The next items in the TOC matching the skill") .closeArray() .closeArray() .closeArray(); return builder .uponReceiving("getRecommendations") .path(getRecommendations) .method("POST") .headers(headers) .body(" { \"discipline\": \"ED18_RLA\", \"programs\": [\"ELA_IR_G1_NA\"], \"sectionId\": \"357e6a22-ea67-458f-8d1a-7e15ec8d4cce\" }") .willRespondWith() .body(body) .toPact(); } @Test @PactTestFor(providerName = CRS_SERVICE, port = "8080") public void runTest() { //Mock url RestAssured.baseURI = "http://localhost:8080"; Response response = RestAssured .given() .headers(headers) .when() .body(" { \"discipline\": \"ED18_RLA\", \"programs\": [\"ELA_IR_G1_NA\"], \"sectionId\": \"357e6a22-ea67-458f-8d1a-7e15ec8d4cce\" }") .post(getRecommendations); assert (response.getStatusCode() == 200); } }```

francislainy.campos
2020-08-18 16:06
```package com.hmhco.crs.v2.pact_tests.provider; import au.com.dius.pact.provider.junit.Provider; import au.com.dius.pact.provider.junit.State; import au.com.dius.pact.provider.junit.loader.PactBroker; import au.com.dius.pact.provider.junit5.HttpsTestTarget; import au.com.dius.pact.provider.junit5.PactVerificationContext; import au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider; import com.hmhco.crs.v2.config.UserType; import com.hmhco.crs.v2.config.Constants; import org.apache.http.HttpRequest; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.extension.ExtendWith; @Provider(Constants.CRS_SERVICE) /* Uncomment this and comment @PactBroker instead to test locally by pasting a .json file for the contract under the target/pacts folder */ //@PactFolder("target/pacts") @PactBroker(host = Constants.BROKER_PACT_URL, consumers = {Constants.ED_UI}) public class PactProviderEdUiCrsTest { @TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) void pactTestTemplate(PactVerificationContext context, HttpRequest request) { request.addHeader("Authorization", Constants.AUTHORIZATION_TOKEN); context.verifyInteraction(); } @BeforeEach void before(PactVerificationContext context) { context.setTarget(new HttpsTestTarget(Constants.BASE_PACT_CRS_V2_URL, 443, "/")); Constants.getAuthorizationToken(UserType.TEACHER); } @State("getRecommendations") public void sampleState() { } }```

francislainy.campos
2020-08-18 16:08
This is the whole piece of code for both consumer and provider for what we have here on our side for POST example.

francislainy.campos
2020-08-18 16:09
And unless the body for the response for the delete method is consumed by the UI it may not be something you'd have on PACT but rather under a functional test instead.

sidhartha.k.subudhi
2020-08-18 17:46
Here is my code: Consumer: - ```package com.sap.icn.mlp.consumer.petClinic; import au.com.dius.pact.consumer.ConsumerPactBuilder; import au.com.dius.pact.consumer.Pact; import au.com.dius.pact.consumer.PactProviderRuleMk2; import au.com.dius.pact.consumer.PactVerification; import au.com.dius.pact.consumer.dsl.PactDslJsonBody; import au.com.dius.pact.consumer.dsl.PactDslWithProvider; import au.com.dius.pact.model.RequestResponsePact; import com.sap.icn.mlp.Constants; import org.junit.Rule; import org.junit.Test; import static io.restassured.RestAssured.*; public class Post_AddPetType_Consumer { private final String PROVIDER = "petType_provider"; private final String CONSUMER = "petType_consumer"; @Rule public PactProviderRuleMk2 mockProvider = new PactProviderRuleMk2(PROVIDER, "localhost", 8081, this); @Pact(provider=PROVIDER, consumer=CONSUMER) public RequestResponsePact addPetTypeContract(PactDslWithProvider builder) { return ConsumerPactBuilder .consumer(CONSUMER) .hasPactWith(PROVIDER) .uponReceiving("a POST request to create a pet type.") .path(String.format(Constants.PETTYPE))// POST http://localhost:8081/petclinic/api/pettypes .method("POST") .willRespondWith() .status(201) .matchHeader("Content-Type", "application/json;charset=UTF-8") //; [Cc]harset=UTF-8 .body(new PactDslJsonBody() .integerType("id",7) .stringValue("name", "Reptile")) .toPact(); } @Test @PactVerification(value=PROVIDER, fragment = "addPetTypeContract") public void shouldBeAbleToAddPetType() { given() .baseUri("http://localhost:8081") .header("Content-Type", "application/json;charset=UTF-8") // .header("Accept-Encoding","gzip, deflate, br") .body("{\n" + "\"id\": 8,\n" + "\"name\": \"Hatch1\"\n" + "}") .post("/petclinic/api/pettypes/") .then() .assertThat() .statusCode(201); } }``` Provider: ```package com.sap.icn.mlp.provider.petClinic; import au.com.dius.pact.provider.junit.PactRunner; import au.com.dius.pact.provider.junit.Provider; import au.com.dius.pact.provider.junit.State; import au.com.dius.pact.provider.junit.TargetRequestFilter; import au.com.dius.pact.provider.junit.loader.PactBroker; import au.com.dius.pact.provider.junit.loader.PactFolder; import au.com.dius.pact.provider.junit.target.HttpTarget; import au.com.dius.pact.provider.junit.target.Target; import au.com.dius.pact.provider.junit.target.TestTarget; import com.sap.icn.mlp.Constants; import com.sap.icn.mlp.DataProvider; import com.sap.icn.mlp.enums.AppConfigKeys; import com.sap.icn.mlp.provider.base.BaseCleaProviderTest; import org.apache.http.HttpRequest; import org.apache.http.client.methods.HttpRequestBase; import org.junit.runner.RunWith; import java.io.FileNotFoundException; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import static io.restassured.RestAssured.given; @RunWith(PactRunner.class) @Provider("petType_provider") //@PactBroker(host="localhost", port = "9006") @PactFolder("target/pacts") public class Post_AddPetType_Provider extends BaseCleaProviderTest { private final DataProvider dataProvider = new DataProvider(); private final String PET_BASE_URL = dataProvider.getAppConfig(AppConfigKeys.PETCLINIC_BASE_URL).getAsString(); @TestTarget public final Target target = new HttpTarget(new URL(PET_BASE_URL), true); public Post_AddPetType_Provider() throws MalformedURLException, FileNotFoundException { super(); } @TargetRequestFilter public void injectAccessToken(HttpRequest request) throws MalformedURLException, URISyntaxException { // injectAccessToken(request, CLIENT_ID, CLIENT_SECRET, OAUTH_BASE_URL); // request.("access_key", "ff2877fbb3b0eec582cc5e0a435ba1ac"); String uri = ((HttpRequestBase)request).getURI().toString(); //// uri = uri + "/api/pettypes"; // ((HttpRequestBase)request).setURI(new URI(uri)); } @State("Post PetType") public void addPetType() throws MalformedURLException { // String bearerToken = "Bearer " + getBearerToken(CLIENT_ID, CLIENT_SECRET, OAUTH_BASE_URL); given() // .relaxedHTTPSValidation() .baseUri("http://localhost:9966/") // .queryParam("id", ACTIVE_MODEL_ID) .header("Content-Type", "application/json;charset=UTF-8") .body("{\n" + "\"id\": 8,\n" + "\"name\": \"Hatch1\"\n" + "}") .when() .post("petclinic/api/pettypes/") .then() .assertThat() .statusCode(201); } }```

sidhartha.k.subudhi
2020-08-18 17:51
I am getting error in Provider Test: Verifying a pact between petType_consumer and petType_provider a POST request to create a pet type. returns a response which has status code 201 (FAILED) includes headers "Content-Type" with value "application/json;charset=UTF-8" (FAILED) has a matching body (FAILED) Failures: 0) a POST request to create a pet type. returns a response which has status code 201 expected status of 201 but was 400 1) a POST request to create a pet type. returns a response which includes headers "Content-Type" with value "[application/json;charset=UTF-8]" Expected 'text/plain;charset=UTF-8' to match 'application/json;charset=UTF-8' 2) a POST request to create a pet type. returns a response which has a matching body comparison -> Expected a response type of 'application/json' but the actual type was 'text/plain' java.lang.AssertionError: 0 - expected status of 201 but was 400 1 - Expected 'text/plain;charset=UTF-8' to match 'application/json;charset=UTF-8' 2 - Expected a response type of 'application/json' but the actual type was 'text/plain' at au.com.dius.pact.provider.junit.target.BaseTarget.getAssertionError(BaseTarget.kt:71) at au.com.dius.pact.provider.junit.target.HttpTarget.testInteraction(HttpTarget.kt:80) at http://au.com.dius.pact.provider.junit.InteractionRunner$interactionBlock$statement$1.evaluate(InteractionRunner.kt:207) at au.com.dius.pact.provider.junit.InteractionRunner.run(InteractionRunner.kt:148) at http://au.com.dius.pact.provider.junit.PactRunner.runChild(PactRunner.kt:137) at http://au.com.dius.pact.provider.junit.PactRunner.runChild(PactRunner.kt:51) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)

sidhartha.k.subudhi
2020-08-18 17:56
Why the error is coming with error code 400 and 1) a POST request to create a pet type. returns a response which includes headers "Content-Type" with value "[application/json;charset=UTF-8]" Expected 'text/plain;charset=UTF-8' to match 'application/json;charset=UTF-8' 2) a POST request to create a pet type. returns a response which has a matching body comparison -> Expected a response type of 'application/json' but the actual type was 'text/plain'

damianattademo
2020-08-18 19:50
Buenas tardes! Mi nombre es Damián, soy nuevo en el mundo de PACT y me quiero sacar algunas dudas, alguien que hable castellano por aquí? Muchas gracias!

brandon.craig
2020-08-18 21:13
has joined #general

alexfdz
2020-08-18 21:39
Hola Damián, quizá te puedo ayudar

matt.fellows
2020-08-18 21:47
If you're getting a 400 it means your pact contains an invalid request and your provider API is rejecting it. It seems your provider returns a different content type in these situations hence two assertion failures

matt.fellows
2020-08-18 21:47
You need to update the test to match the provider or vice versa

damianattademo
2020-08-18 21:48
hola Alex, gracias! te comento lo que entiendo, a ver si estoy bien rumbeado: El contexto es: en un proyecto de microservicios que aún no existe ni uno: queremos implementar Pact. Los servicios van a ser todos en Golang. Y yo como QA debo implementar Pact en todo el ecosistema. Preguntas: 1. En todos los servicios va a tener que "vivir" una estructura de pact (ya sea consumer o provider)? O es preferible hacer un projecto en el medio de cada projecto? Entiendo que va un pedazo de codigo en el consumer y otro en el provider no? 2. Para evitar que el consumer cambie y rompa el contrato tengo que usar can i deploy, ejecutandolo desde el jenkins que integre al consumidor y pegar contra el broker que yo cree para guardar los contratos, verdad? 3. Para evitar que el Provider cambie y rompa alcanza con correr los specs en el provider contra el contrato del broker, verdad? 4. Si todo el ecosistema donde viven es Golang, conviene que sea golang o puedo ir por js? Muchas gracias!

abubics
2020-08-19 00:25
Hi, Damián, welcome :slightly_smiling_face: Integrating Pact in new services is definitely one of the easiest ways to get started! As a unit-testing-style tool, you will need to be comfortable with programming, app architecture, networking, and maybe containerisation. We get a lot of questions from people who are in QA roles, but with no dev experience, and it's hard to assist them. It sounds like you're comfortable enough, though~* 1. In each side of a consumer or provider, you would have some pact structure that declares and confirms the extent of a contract. If a microservice is both a consumer and a provider, then it will have both parts (one on each end). 2. Yes, that's a good workflow, and matches https://docs.pact.io/pact_nirvana. You don't have to use Jenkins, of course. You also don't have to create your own broker, if you'd rather use http://pactflow.io. 3. Yep, that's perfect :thumbsup: 4. The Pact testing code is implemented (ideally) in the same codebase that you want to test. It should be in the same language (unless you have another way of using your app code directly from tests) to keep things uncomplicated.

damianattademo
2020-08-19 01:17
Thanks Boris! I hope i can do it right, following good practicies would be a good starting point. I really think this tool has a huge potential. Thanks again and have a nice one.

abubics
2020-08-19 01:45
No worries ^^ and thanks for your considerate & though-out line of questioning. There is a lot of content for docs and guides, so always have a search there first. But also feel free to ask questions in here any time :smile: If you're doing everything in Go, I'd recommend hanging out in #pact-go to get the best help.

sidhartha.k.subudhi
2020-08-19 06:35
ok, Thank you. I am looking into the issue. Please let me know if need to send the POST body in PACT... Meaning once I POST the request to add PetType, as a successful response it gives code 201 and the same JSON I send as body of POST - e.g. {     "id": 7,     "name": "Reptile" } This is body of both request and response (in JSON format.) So my PACT is like below: ``` @Rule public PactProviderRuleMk2 mockProvider = new PactProviderRuleMk2(PROVIDER, "localhost", 8081, this); @Pact(provider=PROVIDER, consumer=CONSUMER) public RequestResponsePact addPetTypeContract(PactDslWithProvider builder) { return ConsumerPactBuilder .consumer(CONSUMER) .hasPactWith(PROVIDER) .uponReceiving("a POST request to create a pet type.") .path(String.format("/petclinic/api/pettypes"))// POST http://localhost:8081/petclinic/api/pettypes .method("POST") .willRespondWith() .status(201) .matchHeader("Content-Type", "application/json;charset=UTF-8") //; [Cc]harset=UTF-8 .body(new PactDslJsonBody() .integerType("id",7) .stringValue("name", "Reptile")) .toPact(); }``` Please let me know if I am making any mistake here.


matt.fellows
2020-08-19 12:27
It looks like you aren?t sending a body, just asking to receive one - so I suspect the issue is that you need to add a `.body(?)` after the `.method("POST")` call, before you start declaring the response

matt.fellows
2020-08-19 12:27
right now, there is no post body being sent, probably the cause of the `400`

denitsa.kulezich
2020-08-19 13:13
has joined #general

sidhartha.k.subudhi
2020-08-19 13:19
body is sent in @Test. ```@Test @PactVerification(value=PROVIDER, fragment = "addPetTypeContract") public void shouldBeAbleToAddPetType() { given() .baseUri("http://localhost:8081") .header("Content-Type", "application/json;charset=UTF-8") // .header("Accept-Encoding","gzip, deflate, br") .body("{\n" + "\"id\": 8,\n" + "\"name\": \"Hatch1\"\n" + "}") .post("/petclinic/api/pettypes/") .then() .assertThat() .statusCode(201); }``` Please let me know where I am missing the body. The body is 2 lines only: {     "id": 7,     "name": "Reptile" } Do I need send another body in @PACT? Please send code snippet if I am missing something. I have given the entire Consumer and Provider code in the beginning of this discussion.

matt.fellows
2020-08-19 13:39
See my comment above. You still need to register the expectation in the pact setup as well as send thru the actual body in your test

matt.fellows
2020-08-19 13:39
Currently, you've only specified what should be returned

matt.fellows
2020-08-19 13:40
I can see how that may be confusing, but you need to be explicit about how you're mocking the request in pact

sidhartha.k.subudhi
2020-08-19 13:57
Ok, thanks a lot, it worked now. But again a small question. If the value in the PACT body is not matching it should not give failure. But I get that error though with clear message about the mismatch in value. My understanding is that it should not give error message for mismatch in value. Please clarify. If .body(...) is mandatory after .method(POST), should it not throw an error message in Consumer test itself?

sidhartha.k.subudhi
2020-08-19 13:58
Is there any location where I can get more information and example of different requests for Consumers and Providers. Also need more information about different annotations.

sidhartha.k.subudhi
2020-08-19 14:00
Is there any help for DELETE and PUT?

sidhartha.k.subudhi
2020-08-19 14:15
Please let me know what the following code is meant for in provider test. ```@TargetRequestFilter public void injectAccessToken(HttpRequest request) throws MalformedURLException, URISyntaxException { String uri = ((HttpRequestBase)request).getURI().toString(); }```

alexfdz
2020-08-19 14:44
Philosophical question here: We have a consumer (1)-->(*) providers model were a consumer has multiple providers and all of them must provide the same API contract. Our idea was to declare a unique pact `consumer-generic_provider` , and make sure all providers verify their contract compliance with it. :arrow_down:

alexfdz
2020-08-19 14:45
The problem: We loose the consumer?s `can-I-deploy` feature, as the relation matrix does not know about the providers, only about this fictional `generic_provider`

alexfdz
2020-08-19 14:46
As we would like to avoid the need of create one pact for each provider (`consumer` --> `provider-X` ), the only option we can see is use tags when the providers publish their verification results, so the tag represents each different provider.

alexfdz
2020-08-19 14:47
Does this approach make sense for you? Maybe we should not try to apply CDC in this scenario?

bernardoguerr
2020-08-19 15:47
This is a little bit old (1/2 a year). Accidentally retweeted it haha. Still valid though!

brendan.donegan
2020-08-19 16:13
has joined #general

matt.fellows
2020-08-19 22:57
Lol. Well it got likes :joy:

matt.fellows
2020-08-19 23:47
Can you please elaborate on why all 3 providers are exactly the same?

matt.fellows
2020-08-19 23:48
I?m conscious that this is a form of the XY question, so want to make sure I understand the root of the problem before I provide any advice

2020-08-20 04:02
A post in *Feature Requests* has been marked as *planned*

alexfdz
2020-08-20 05:10
It could be seen as a plug-in model, where you have a container ?consuming? different plug-ins. All these plug-ins must implement a specific contract, so the container knows how to talk to them. The plug-ins are not exactly the same, they offer different features, but they implement the same contract.

matt.fellows
2020-08-20 08:01
> If the value in the PACT body is not matching it should not give failure no it should definitely give a failure - it?s not expected. Why do you think it would it not fail?


matt.fellows
2020-08-20 09:02
What are the issues you're having with PUT?

matt.fellows
2020-08-20 09:03
It's the same process for any request method

matt.fellows
2020-08-20 09:03
I'd run thru the JVM workshop if you haven't already so you've got a good handle on the basics: https://docs.pact.io/implementation_guides/workshops

matt.fellows
2020-08-20 09:04
It'll be time well spent I promise!

charliemic
2020-08-20 15:03
has joined #general

charliemic
2020-08-20 15:11
I'm in a scenario where the integration between various components is file-based (downstream components consume files produced by other components) Does anyone know if there's any good tooling for file-based contract testing? I'd love to have some contract tests and something like pact, but haven't been able to find anything suitable

sidhartha.k.subudhi
2020-08-20 16:09
Thanks Matt. I will go through the workshops.

iannsantos8
2020-08-20 18:20
has joined #general

rcrodrigues39
2020-08-20 18:22
has joined #general

luiz.filho
2020-08-20 18:43
has joined #general

2020-08-21 00:21
A new post has been created in *Feature Requests*

2020-08-21 00:21
A post in *Feature Requests* has been marked as *planned*

tjones
2020-08-21 02:01
You might be able to use message pacts for this

tjones
2020-08-21 02:04
Ron wrote a couple of posts about contracts that include S3 - here's a link to part 2: https://dius.com.au/2018/10/01/contract-testing-serverless-and-asynchronous-applications---part-2/ Some ideas in there might help you

rene.bodack
2020-08-21 07:35
has joined #general

charliemic
2020-08-21 07:52
That's the basic principle behind what I'm after yep - thanks for the steer, that's really useful

matt.fellows
2020-08-21 08:14
Good call our Tim. We should document this as like a "recipe" or something.

matt.fellows
2020-08-21 08:14
Reminder set

bheemreddy181
2020-08-21 18:16
I mean latest pact broker image

matt.fellows
2020-08-21 21:14
No, what's the issue?

bheemreddy181
2020-08-21 23:35
When we pulled the latest pact broker image we were not able to publish verification results back after verifying contract

matt.fellows
2020-08-21 23:48
Can you please share thr verbose log showing the problem? It may help us understand what's going on. You may need to upgrade your client libraries to work with it also Please share the versions of things you're using too

bheemreddy181
2020-08-22 01:33
Verbose log was not enabled will share version soon - is there a read me you can refer me to which gems needs to be updated

matt.fellows
2020-08-22 01:56
From this thread I didn't know what you were using. I'm not very familiar with the Ruby lib but I'm surprised if things are not backwards compatible.

matt.fellows
2020-08-22 01:56
If there is a big difference in versions of the broker that you've changed its possible

matt.fellows
2020-08-22 01:56
Hence why it's important to know library and pact broker version (to/from)

ian.letourneau
2020-08-22 14:00
has joined #general

bheemreddy181
2020-08-22 15:47
Pact Broker Upgrade : 2.54.0 -> 2.59.2 And Pact Library Versions as below

nikhilkumar20.1995
2020-08-23 09:33
has joined #general

matt.fellows
2020-08-23 13:54
Thanks Bheem. Can you explain the problem your experiencing? Probably best to get a bug report so we can reproduce the issue

matt.fellows
2020-08-23 13:54
That being said I'm not familiar with the Ruby DSL and others may spot something obvious

bheemreddy181
2020-08-23 23:59
Post verification of contracts - i am not able to publish results back to pact broker from my provider side - My CI fails while publishing results

bheemreddy181
2020-08-23 23:59
the only error i could see is in the CI screenshot i shared above

matt.fellows
2020-08-24 00:01
The newline character problem seems interesting - does the tag or something contain a new line?

alecgerona
2020-08-24 03:07
has joined #general

alecgerona
2020-08-24 03:20
Hi all, really interested in implementing Pact for our microservices architecture testing. I'm currently at the last stages of our POC at our company and am currently stuck at implementing the contract verification. For context, we're using a Django backend as the provider with Gitlab CI. I've implemented the webhook that calls the pipeline but that's where it falls short. I'm using the pact-cli docker image to call the `verify` command that will publish the results to our broker. Now this requires a url to replay the requests to. I was hoping to use Gitlab CI to run the Django app for me then just have verify call it since `pact-python`'s `Verifier` class doesn't appear to have a publish option as of yet and/or I haven't yet seen a guide that can run a local instance of a Django app during a pytest run unlike, say, a Flask app that is shown on the `pact-python` example. Problem is it seems like it's not possible for Gitlab CI to run a standalone server on itself if it's using a docker based runner? Am I overcomplicating things or is there a simple way to do this? I would hate for our POC for Pact to be wasted at this final step. Any help is much appreciated. Thank you! Relevant part for pact verification step on my `.gitlab-ci.yml` file: ```test: image: alecgerona/python-docker:python3.6 services: - postgres:11 - docker:dind stage: test script: - build server here - setsid nohup python manage.py runserver > nohup.out & - make verify_publish # Call pact-cli's verify command with appropriate arguments```

matt.fellows
2020-08-24 03:32
:wave:

matt.fellows
2020-08-24 03:32
Hello, awesome to hear you?re getting started with Pact!

matt.fellows
2020-08-24 03:32
First up, probably want to ask in #pact-python as you?ll likely get more targeted support

alecgerona
2020-08-24 03:32
Got it. Will repost this message there.

matt.fellows
2020-08-24 03:33
> Problem is it seems like it?s not possible for Gitlab CI to run a standalone server on itself if it?s using a docker based runner? Can you please elaborate on this? What is not possible by running in docker? (running docker in docker, for example might be a pain)

robert.strehli
2020-08-24 08:19
has joined #general

alecgerona
2020-08-24 09:23
Has anyone tried to mock any internal methods using the provider states? We have an endpoint that calls an external dependency and it'd be great to be able to mock that instead of having to manually add an environment check to skip it.

antonello
2020-08-24 10:17
What language is the provider written in?

matt.fellows
2020-08-24 10:18
Yes, any reason you can't do it?

matt.fellows
2020-08-24 10:18
Ha, timing

matt.fellows
2020-08-24 10:18
He's using python so it should very much be doable

antonello
2020-08-24 10:18
and advisable!

matt.fellows
2020-08-24 10:19
:point_up:

alecgerona
2020-08-24 10:20
Sorry how is this doable in Python? I'm using the `pact-verifier` with states. Do I mock our internal methods in each call or..?

alecgerona
2020-08-24 10:20
Apologies I don't have any experience in mocking a live running python app before.

parveensultanauk
2020-08-24 11:33
has joined #general

bheemreddy181
2020-08-24 14:42
I don?t think so - i verified them

nsusanward
2020-08-24 16:07
has joined #general

nsusanward
2020-08-24 16:09
Can I use Pact to test a library? We're moving to a microservices framework. Several of the services will import a library that we develop and use it in some of the calls.

elliottmurray
2020-08-24 16:36
Assuming you are making REST calls in the library and you want to import that library into each of the microservices?

elliottmurray
2020-08-24 16:38
Then yes though I think you may lose some of the benefits or have to think through a few more things. For example if MS A and B use it and you update A to a new version, is B now broken? How would you know?

lucaseverain
2020-08-24 17:41
has joined #general

ismail.alam2
2020-08-24 18:19
has joined #general

sudhachilamakuri
2020-08-24 19:35
has joined #general

sudhachilamakuri
2020-08-24 19:49
Hi Guys, I need some help I am at the early stage of implementing Pact, I have scenario where I will get a code from the response of one request and I want to use that code in the request body of next request to get access token in the response , how can I write provider tests , did some one worked this kind of scenario, if yes can you provide some examples pls

sudhachilamakuri
2020-08-24 19:49
I am using Pact Junit5

matt.fellows
2020-08-24 21:11
Whilst you lose some of the benefits, you can certainly still gain this breaking change one of you do it right

matt.fellows
2020-08-24 21:14
I wrote about it here as I used it on a client site quite effectively https://pactflow.io/blog/should-i-write-contract-tests-for-client-sdks/

alecgerona
2020-08-25 02:04
@matt.fellows@matt.fellows@matt.fellows @elliottmurray?

alecgerona
2020-08-25 02:08
Hmm. Way I'd implement it is to make sure it's gonna be a constant code all throughout. I'd make sure it'll return that constant code via the provider state.

matt.fellows
2020-08-25 02:35
Sorry I can?t speak to Python as I haven?t written any real code in it

alecgerona
2020-08-25 02:35
How is this done with other languages? Do they run the app with environment checks instead?

matt.fellows
2020-08-25 02:35
but presumably somewhere you have a piece of code that is responsible for calling downstream systems. In your provider state route (or perhaps elsewhere in the test setup/context), you should be able to replace that with a fake implementation

alecgerona
2020-08-25 02:36
Do you have an example of that being done with other languages? Examples I see use mocks for this. But that works because they run it in a testing scope.

matt.fellows
2020-08-25 02:37
> How is this done with other languages? Do they run the app with environment checks instead? There is no ?one way? so answering this is very much dependent on many factors


matt.fellows
2020-08-25 02:37
it is run in a test scope though because it?s easy to do

matt.fellows
2020-08-25 02:37
I?m sure without much work you could do the same in Python

alecgerona
2020-08-25 02:40
I would love to run my provider verification in a test scope as well using pact python but as I raised in an earlier issue, it doesn't support publishing and requires a running python app _inside_ the test scope. I've heard @elliottmurray was doing an example for this but haven't seen any yet.

matt.fellows
2020-08-25 02:41
You can still start your application from within a ?test scope?. there are a myriad options to kick off the verification - for example, you could `shell out` to the verification process from within the test

matt.fellows
2020-08-25 02:42

matt.fellows
2020-08-25 02:42
I?m not convinced about why you can?t execute the binaries as per yesterday, because that?s exactly how the python verifier works now

matt.fellows
2020-08-25 02:42
it?s likely something configuration-y that needs sorting, I?m just not familiar enough with the Python ecosystem to fix it

alecgerona
2020-08-25 03:12
Hmm I guess either way I'd need to find a way to mock the actual requests. I see that the example you gave did it by returning a Promise on the handlers.

matt.fellows
2020-08-25 03:13
how would you mock it if you weren?t using Pact?

matt.fellows
2020-08-25 03:13
that?s probably the question to be asking, and then you can work out how to make it work with Pact

matt.fellows
2020-08-25 03:13
(and in this case, we actually want to _stub_ it, not mock it)

alecgerona
2020-08-25 03:15
I'd stub it in the testing scope. Hmm.

matt.fellows
2020-08-25 03:15
so why not do that - start the service, stub the bits you need and then execute the verification from python itself (shelling out, or uplifting pact-python with the extra bits you need?)

alecgerona
2020-08-25 03:17
Lemme try. :crossed_fingers: Thanks for all the help so far.

matt.fellows
2020-08-25 03:17
see https://github.com/pact-foundation/pact-python/blob/master/pact/pact.py#L217-L243 - under the hood, it?s simply executing the binaries I shared

matt.fellows
2020-08-25 03:18
huh, according to https://github.com/pact-foundation/pact-python/blob/master/pact/constants.py the binaries should be in the local dir :thinking_face:

matt.fellows
2020-08-25 03:18
ah lol nevermind, the package install _is_ the local dir according to that. scrap that.

alecgerona
2020-08-25 03:19
Haha I think it'd be easier to just open a PR that would accommodate the publishing.

heytaco
2020-08-25 03:57
has joined #general

heytaco
2020-08-25 03:57
Hi there! My name is HeyTaco!, and you can use me to give people tacos to show your appreciation. My tacos will spread joy through Slack!

matt.fellows
2020-08-25 04:03
So yes, we now have this :point_up:

matt.fellows
2020-08-25 04:03
as a starting point, I?m going to throw some tacos

matt.fellows
2020-08-25 04:04
@phil.endsley loving your work answering and helping out in #pact-jvm :taco:

matt.fellows
2020-08-25 04:04
@elliottmurray thanks for your awesome work both donating to pact-python and migrating to docusaurus v2. Please enjoy this :taco:

matt.fellows
2020-08-25 04:05
@yousafn because I meant to give you tacos a while back for all of the demos, the welcome bot and general awesomeness -> :taco:

matt.fellows
2020-08-25 04:06
@antonello for you and your team contributing to #pact-jvm and getting stuck into meaty issues :taco:

matt.fellows
2020-08-25 04:06
I feel like I?m accepting an academy award ?I have so many people to thank??

bethskurrie
2020-08-25 04:07
I +1 those tacos

matt.fellows
2020-08-25 04:08
Last but not least is @abubics, who has been sharing with us his wisdom, contributing to driving a positive culture and hanging out here for such a long time. :taco:

matt.fellows
2020-08-25 04:09
If you want to +1 properly, send them a `:taco:`

bethskurrie
2020-08-25 04:10
There's a fine line between tacos and spam :stuck_out_tongue:

alecgerona
2020-08-25 04:12
@matt.fellows thanks for all the support. This is the most real-time quality support I've gotten out of any open-source project I've worked with. :taco:

aforeman
2020-08-25 05:01
has joined #general

sathisan
2020-08-25 05:17
has joined #general

sathisan
2020-08-25 05:37
Hi All Maybe someone can help me..if i use the provider verification part with spring mvc, do i need to test against a Running Service ?

sathisan
2020-08-25 05:46
In my contract Test, i am testing that a GET request Returns a string. If i verify with spring mvc, i got an Error " expected a Header 'content-type' but was missing".. can someone explain me this error?

uglyog
2020-08-25 06:02
In your expectations in the test, you have specified the Content-Type header. This means it is a required header, and needs to be included in the request. If it is not required, remove it.

sathisan
2020-08-25 06:05
This is what my consumertest looks like

sathisan
2020-08-25 06:12
Providertest

sathisan
2020-08-25 06:12
Consumertest

sathisan
2020-08-25 06:15
Although I followed what you said, I still get sone errors which I could Not resolve

abubics
2020-08-25 06:18
The combination of ? missing `Content-Type` header, and ? status of 404 sounds like your provider doesn't provide an endpoint to matches your request.

uglyog
2020-08-25 06:18
Your pact file has specified that the response needs to be a JSON response, with a correctly set `Content-Type` header. When the actual request was made, no content type header was returned, so it was assume that it was a text plain response.

abubics
2020-08-25 06:19
@sathisan Also, any reason you're taking photos of your screen, instead of copying & pasting the code in a code block?

sathisan
2020-08-25 06:26
So i need to Start a the Real application to validate my request against a Running service? I thought it is Not necessary if i Work with spring mvc? Since the endpoint in my usecase is an https endpoint, do i need to mock the whole security context in the @state annotation to validate against Provider?

sathisan
2020-08-25 06:29
@abubics i am using my tablet to communicate via slack since slack is Not supported by my laptop

abubics
2020-08-25 06:34
If you're getting a 404, then there's certainly a web server listening on the expected port (probably your service).

sathisan
2020-08-25 06:37
@abubics is this Not the idea that the target defined in the provider should point to the port where my service is listening? In the End, i want to verify against a Running service

sathisan
2020-08-25 06:44
@uglyog thank you for your answer, so if i use PactDSLJsonBody, i already define that my response needs to be a JSON response? Is there an Attribute which I can use to define that my response should be "text/plain"?

matt.fellows
2020-08-25 06:45
@sathisan slack web? Or do you work for one of those places that blocks Slack :grimacing:

sathisan
2020-08-25 06:47
@matt.fellows Yes it is blocked

matt.fellows
2020-08-25 06:47
You can use the spring context to start the app e.g. https://github.com/pactflow/example-provider-springboot

matt.fellows
2020-08-25 06:47
I don?t know spring MVC very well (basically at all), but I assume you can start it as part of the test


matt.fellows
2020-08-25 06:51
there you go

sathisan
2020-08-25 06:55
if i use PactDSLJsonBody, i already define that my response needs to be a JSON response? Is there an Attribute which I can use to define that my response should be "text/plain"?

uglyog
2020-08-25 06:57
Use a string value for the body, instead of PactDSLJsonBody

sathisan
2020-08-25 07:10
Thank you @uglyog

sathisan
2020-08-25 07:13
For Basic understanding: For the provider verification, is it Not necessary that the provider listens to the port where my service is listening?

uglyog
2020-08-25 07:16
Your service is the provider

sathisan
2020-08-25 07:24
I still trying to resolve this issue with status 404 I am using the Concept with mvc, created an instance of my controller and initialized with MVCTarget Since i do Not Set any Ports in this concept, i could Not Think of anything of how to resolve this issue

uglyog
2020-08-25 07:34
From what I can see from your test code, you are setting the controller to the result of calling `MockauthController.getUserInfo()`. You shouldn't so that, you should pass your actual controller class there.

uglyog
2020-08-25 07:34
You're getting the 404 Not Found because MockMVC is not finding a controller to handle the request.


sathisan
2020-08-25 07:43
Target.setRuntimes is actually Calling the mvc container which I initialized before?

sathisan
2020-08-25 07:45
From the official documentation, I still could Not figure what the use Case of the controlleradvice might be? Thank you for your help @uglyog

dan.rh.jones
2020-08-25 11:45
has joined #general

dee_n
2020-08-25 14:56
has joined #general

nsusanward
2020-08-25 15:21
Thank you!

alecgerona
2020-08-25 20:40
Hi I'm having trouble running https://github.com/pact-foundation/pact-ruby-standalone/releases on my docker image. I would like to be able to start a stub server on my Gitlab CI. On local it works great, curl -> tar -> execute. On a docker image it doesn't work. You can see the error log here https://github.com/alecgerona/python-docker/runs/1028444147?check_suite_focus=true#step:5:1512

matt.fellows
2020-08-25 22:10
--help isn't a command

matt.fellows
2020-08-25 22:11
It should just be `help` I think

sathisan
2020-08-25 23:22
Is there a Way to check for type e.g Stringtype if my contenttype is text/plain.... So far i Think the stringtype, integertype etc. can only be checked when used in combination with PactDslJsonbody or PactDslJsonArray?

tjones
2020-08-25 23:22
This might be a question for #pact-jvm

tjones
2020-08-25 23:24
In general, I'm not sure if matchers work in text/plain. If you have a clear type is there some reason you can't use json?

sathisan
2020-08-25 23:36
PactDslRootValue exists, but in the contract the contenttype will be defined as application/json..so I assume any attribute from the DslPart class sets contenttype as application/json

tjones
2020-08-25 23:37
I don't know how the JVM DSL works, sorry. You'll need to ask in #pact-jvm

alecgerona
2020-08-26 03:15
Was just using the `--help` as to see if the executable actually works. But the error is something like the ruby dependency cannot be found even though it's clearly there.

matt.fellows
2020-08-26 05:01
Thanks. Sorry I was on the phone when this happened. I can?t actually see in that repo how you?re installing the binaries - is your repo up to date? (FYI the uglyog stub server is probably the better one to use anyway, which I note you?ve updated to)

matt.fellows
2020-08-26 05:02
FYI it may be one of the glibc or readline type dependencies missing. We can update https://docs.pact.io/docker/ if you find the missing lib it needs

matt.fellows
2020-08-26 05:02
I think your image should have bash, so that shouldn?t be it (unless it?s a bash version compatibility, but we haven?t had a problem with bash 5 before to my knowledge)

alecgerona
2020-08-26 05:03
I'll try to recheck. Was going for this as I would like a docker image that can be executed in a CI environment that has all the pact executables.

matt.fellows
2020-08-26 05:04
kk

matt.fellows
2020-08-26 05:04
I?m guessing it?s going to be a missing lib

alecgerona
2020-08-26 05:06
But yeah you're right I'll be sticking to pact stub server for now. Any tips on how to handle downstream dependencies dynamically? Do I have to pull the dependent pacts everytime?

matt.fellows
2020-08-26 05:07
actually, no, you?ve downloaded the x86 version.

matt.fellows
2020-08-26 05:07
you need to install the 64 bit

alecgerona
2020-08-26 05:07
Ooooh.

matt.fellows
2020-08-26 05:07
:laughing:

matt.fellows
2020-08-26 05:07
yeah

alecgerona
2020-08-26 05:08
Okay lemme try.

alecgerona
2020-08-26 05:08
So thoughts on the downstream dependencies?

alecgerona
2020-08-26 05:08
It's my main use case for the stub server

sathisan
2020-08-26 05:48
Okay Thank you:+1:

matt.fellows
2020-08-26 06:03
Maybe ask it again in #general as a top level question. Keen to hear others? answers

alecgerona
2020-08-26 06:06
When dealing with downstream apis (A calls B which calls C), the ideal solution is to use pact-stub-service to stub B's contract with C. Does this mean the contracts should be pulled everytime for the stub service to use? Or is this checked into version control (especially for external APIs)? If to be pulled manually, is there a command for it already?

alecgerona
2020-08-26 06:06
Done! Thanks again! Will give you another taco. Haha.

bethskurrie
2020-08-26 06:07
I would pull it in live from the broker, personally

bethskurrie
2020-08-26 06:08
depending on which stub service you're using, you can just give it a URL.

alecgerona
2020-08-26 06:08
I'm using pact-stub-server.

bethskurrie
2020-08-26 06:08
There are two :wink:

bethskurrie
2020-08-26 06:08
But you probably mean the rust implementatoin

alecgerona
2020-08-26 06:08
Yes the rust one.

bethskurrie
2020-08-26 06:09
` -u, --url <url>... URL of pact file to verify (can be repeated)

alecgerona
2020-08-26 06:09
Ah I see what you mean. I can just construct the URL based on what the consumer/provider is.

bethskurrie
2020-08-26 06:09
yes

bethskurrie
2020-08-26 06:10
you typically select the latest one for a particular tag

bethskurrie
2020-08-26 06:10
.../latest/prod or .../latest/main

alecgerona
2020-08-26 06:35
@bethskurrie excellent advice as always :taco:

sathisan
2020-08-26 11:34
Hi guys I have one question regarding the provider Test If i verify the contract on the provider Side, what is the difference between verifying against the MockMVC Target and the target which is specified as HttpTarget?

elliottmurray
2020-08-26 11:49
Is this a JVM specific issue? If so #pact-jvm is your best bet

sathisan
2020-08-26 12:32
Okay Thank you:+1:

matt.fellows
2020-08-26 13:09
Also Alec, Pactflow has a hosted stub service available as part of our product. Just in case :wink:

andy.furnival
2020-08-26 16:46
has joined #general

rchong.allan
2020-08-26 19:46
has joined #general


alecgerona
2020-08-27 05:48
See what you did there :smile:

nishtha.kakkar.28
2020-08-27 11:18
has joined #general

sathisan
2020-08-27 16:30
@uglyog thank you, After doing the research, i still could Not figure out the following: As far as I understood, with mockmvc the contract is verified against the weblayer( controller) and with Httptarget the contract is verified against the whole Server with Application context. But in the official documentation, it is stated that pact is testing messages between two Applications at HTTP Level. So if I am testing at Http Level, does it have an impact for my testing if service Layer is mocked or not mocked?

kapilrajput27
2020-08-29 17:06
has joined #general

kapilrajput27
2020-08-30 15:11
Hello all, I am using PactNet and trying to pass a variable value from consumer to the provider-state. MockProviderService .Given($"X exists with id {*Guid.NewGuid()*}") . . . The provider state code looks like this: public ProviderStateMiddleware(RequestDelegate next) { _next = next; _providerStates = new Dictionary<string, Action> { { "X exists with id *??*", CreatXIfNotExists } }; } Is it possible to pass the guid from consumer to the provider side?? Or Am I missing something here, probably the provider states are meant to be controlled by the provider and consumer is just meant to use it as-is :?

imione9
2020-08-30 18:51
has joined #general

matt.fellows
2020-08-30 21:32
Bingo. The last thing you said is how to use them

g.doergeloh
2020-08-31 08:06
has joined #general

kapilrajput27
2020-08-31 15:36
Hi @matt.fellows, Our APIs are not idempotent (if I post again the response would be different) and the ids are auto-generated. So we need a way to provide values with provider state. Do you know of any alternatives?

ryan.dens
2020-08-31 16:20
:wave: Curious, is it recommended to use a contract test to verify a consumer own/managed by your organization works properly with a service external to your organization? The example I?m thinking of is testing the interaction between a backend service (consumer) and an API provider like Hashicorp Vault (a backend service which we don?t build, but are responsible for running/upgrading).

p0deje
2020-08-31 22:23
Hey folks! Does anyone have experience with using Pact for testing federated GraphQL (https://www.apollographql.com/blog/apollo-federation-f260cf525d21/). The idea is that all consumers start talking to a special gateway that is responsible for sending parts of GraphQL query to the services implementing them. This way consumers only need to make a single request and receive response from multiple services. Of course this breaks existing contracts because there is now a new layer in between. However, it?s not possible to perform contract verifications on the gateway itself since it acts as a proxy. I wonder if anyone faced similar issue and what the solution could be?

matt.fellows
2020-08-31 22:27
Answered in #graphql


abubics
2020-09-01 00:08
Pretty sure there's a FAQ about this, but I can't seem to find it . . . My short answer is it has diminished value, but may be better than many other options. It's not the best situation, because you don't get much of a feedback loop (e.g. how do you detect when the provider changes, apart from polling?).

rasih.caglayan
2020-09-01 00:33
has joined #general

jgauthier
2020-09-01 05:36
has joined #general

ryan.dens
2020-09-01 13:22
Thanks for the response! I also looked for something, and I vaguely recall reading something, but couldn?t find it. I agree there?s diminished value. Part of the value of the contract (in my opinion) is that the provider can safely deprecate and remove endpoints. However, I think the feedback loop is still there for external services that are run ?on premise? like the example I gave, Vault. We?re responsible for upgrading the version of Vault we run, so we can re-run contract verification tests then. Contract testing integration with a saas service like Stripe definitely seems like it would have less value.

ryan.dens
2020-09-01 13:25
I did find this: https://docs.pact.io/getting_started/what_is_pact_good_for#what-is-pact-good-for > You (or your team/organisation/partner organisation) control the development of both the consumer and the provider.

gianrubio
2020-09-01 13:48
has joined #general

lmerlin
2020-09-01 13:51
has joined #general

phillip.lo
2020-09-01 16:26
has joined #general

lzyzy1996
2020-09-01 17:08
has joined #general

abagraw3
2020-09-01 21:32
has joined #general

michaelkochub
2020-09-01 21:35
has joined #general

abagraw3
2020-09-01 21:36
Hi All! I'm trying to write a provider test using junit. I've contract files and I want to run them on multiple environment and hence a particular field in request body needs to be modified which is env specific. Is there any way to modify the value of an attribute in request body?

matt.fellows
2020-09-02 00:12
It soundsn like you are matching on specific values, rather than matching on type. Are you using flexible matchers? Can you please share the contract file/test code?

abubics
2020-09-02 00:14
Sounds like you're on the right track :thumbsup:

ashley.graf101
2020-09-02 01:46
has joined #general

alex.radulescu
2020-09-02 07:52
has joined #general

ben.johnson
2020-09-02 11:35
has joined #general

nate.smith
2020-09-02 14:22
has joined #general

carlos.silva
2020-09-02 14:56
has joined #general

sagupta
2020-09-02 18:42
Hi All, I have a question for writing contract tests . So for our API , consumer can send a HTTP POST request with multiple optional fields in the request body based on what functionality consumer want to access from provider. How should we write contract tests in this case? Should we only write contract tests for the the properties which are not optional and always be present in the request and in response?

michaelkochub
2020-09-02 21:29
Hi All! I'm having a bit of trouble figuring out how to inject a value into a provider state from a gradle file. I'm generating a user UUID on the provider side that the consumer should use when making a request. I'm looking at the following bit of documentation https://docs.pact.io/implementation_guides/jvm/provider/gradle/#using-a-closure but an example would be extremely helpful

uglyog
2020-09-02 22:51
You need to return a Map from the closure. The keys need to correspond to the variable used in the expression in the pact file

uglyog
2020-09-02 22:52
I would write different tests for the combinations that are important

ananda-kumar.irudhaya
2020-09-03 07:03
has joined #general

sagupta
2020-09-03 12:21
ok so i should check on the consumer side what fields are important for them and write tests for those. And covering all combinations is not a good practice as well for contract tests

lewis.prescott
2020-09-03 12:45
has joined #general

lewis.prescott
2020-09-03 12:46
:wave: If you are new to Pact and want to learn the basics. Why not checkout my https://www.udemy.com/course/introduction-to-contract-testing-with-pact/?referralCode=90157BA4D133D89E6C0C

jeonghoon
2020-09-03 12:47
has joined #general

sri.prasanna
2020-09-03 12:49
has joined #general

michaelkochub
2020-09-03 13:43
Thank you!

phenchanter
2020-09-03 19:36
has joined #general

phenchanter
2020-09-03 19:42
Hi All, I've stumbled on Pact recently and trying to figure out couple of things. In my case I have quite complex form and depending on some fields values other fields are removed/added and some for some of the fields required state is changed. Is there a way to handle this via Pact? I couldn't find a direct answer in documentation at the moment and if anyone can guide me to somewhere it'll be awesome

matt.fellows
2020-09-03 23:51
So behind the scenes, the form is going to be submitted to an API right? You would normally create a separate Pact tests for the different important pairs of req/responses you?d expect.


olarrmide
2020-09-04 01:56
has joined #general

ravi.mijar
2020-09-04 02:50
Hello folks, I have recently implemented both consumer and provider pact tests using node and typescript. We're not using provider states yet. If we do so, will the provider microservice become state-full in a way? while I understand what the provider states will allow me to test, I'm trying to articulate whether my microservice will end up being termed as statefull ?

matt.fellows
2020-09-04 02:51
no, they will not. At least not in the way that most people refer to ?stateful? services

matt.fellows
2020-09-04 02:52
stateful services usually means that when deployed into a load balanced environment, specific state is stored in each instance of the hosted component (e.g. a users? session), meaning that future requests must hit the same instance for it to work

matt.fellows
2020-09-04 02:52
stateful services is a dumb term, because almost any interesting service has some ?state? - e.g . an Order will be in a ?quote? state, and then maybe ?accepted? and then ?fulfiled? type thing - that?s what we mean by a provider state

matt.fellows
2020-09-04 02:53
or ?user Sally exists?

matt.fellows
2020-09-04 02:53
this is a state, but not in the ?stateful? nomenclature

olarrmide
2020-09-04 04:25
Hi folks, I am implementing the Pact-Mock-Service due to corporate policies that disallow me from running the Pact-JS binaries that are installed via NPM. However, there's an instance of the standalone pact-mock-service that's allowed to run. My project is in Javascript and I wrote my tests using Jest. Right now I'm trying to convert my Javascript tests so I can run them against the standalone mock service. So far, I get that I have to start the mock service then write my interactions which I'll POST to the service. Specifically, I'm following https://github.com/pact-foundation/pact-mock_service/blob/master/script/example.sh. However, I don't get what exactly I'm supposed to do on line 35 (`curl localhost:1234/foo`). Does anyone have any helpful information to point me in the right direction? I've checked the docs but I couldn't find any answers. Thanks!

matt.fellows
2020-09-04 04:37
have you seen https://github.com/pact-foundation/pact-node#pact-download-location? That should get you around the NPM binary issue

lucaseverain
2020-09-04 14:17
Hello! First, thank you for mantaining this amazing tool! I'm having some issue with JUnit 5: in my consumer I use "pathFromProviderState", and in my provider I create a state that replaces the path correctly, but my TestTemplate is running twice, the first time with the path parameter null, and the second time with the right parameter. Any idea on how to implement this correctly?

olarrmide
2020-09-04 14:40
Thanks for the reply. Yes I have seen the workaround but that helps with installing the packages. The blocker I face is when running my tests. Group policy blocks the ?.bat? scripts within ?node_modules? from running. At the same time there?s a copy of the standalone that?s approved and hosted internally that I can download and run. If there was a way to make my tests run against that instance, I believe my problem will be solved. Alternatively, I?m willing to explore the option I outlined in my original question.

maciej.olko
2020-09-04 14:53
Hello! I am trying to use pending feature with broker we host internally. For some time our verification was failing because of new consumer pacts that aren?t implemented in our API. I?ve run verification with `--enable-pending` flag on and published the result, but the verification is still seen as ?failed?. What should I do to see failing interactions as pending?

marco.dallagiacoma
2020-09-04 15:44
Hello, We're having some trouble trying to verify a contract that uses the `timestamp` matcher. I generated the contract via pact-jvm (i.e., `body.datetime("myDateTime", "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")`) The generated contract includes the following matcher: ```"$.myDateTime": { "matchers": [ { "match": "timestamp", "timestamp": "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" } ], "combine": "AND" },``` while this is the related row in the `contents` section of the contract: ``` "myDateTime": "2000-01-31T14:00:00.000+01:00",``` The problem is that the verifier seems to be matching on the VALUE of the given timestamp instead of just the format. In other words, the verification succeeds only if the provided value is exactly the same as the one set in the `contents` section of the contract. For the example above, this means that it only succeeds if `myDateTime` is `"2000-01-31T14:00:00.000+01:00"`, but it fails e.g., if I change it to `"2000-01-30T14:00:00.000+01:00"` (day changed from 31 to 30). Is this expected? Any ideas on how to match on the format instead of the value? Thanks a lot in advance for your help!

phil.endsley
2020-09-04 18:41
https://docs.pact.io/faq/convinceme#but-our-company-develops-apis-before-consumers-eg-apidocument-driven-design > If you have control over any of them, then Pact could be a good fit - you just won't be driving the design from the consumer (that's OK too). Can someone weigh in on what this means for the development process of pacts? ? Write the API first, then circle back with pacts when the consumer gets around to using it?

phil.endsley
2020-09-04 18:46
Our company writes enterprise software. So we have a lot of teams all writing consumers and providers. We control everything. We're seeing some resistance to defining the contract first. ex: ? Team 1 is responsible for the consumer ? Team 2 is responsible for the provider ? Team 1 needs a new feature, but they're working on a bugfix/something else that has been deemed "more important" ? Team 2 has time to start working on the provider Since we don't have any contract tests in place today, this works out for us. Team 2 implements the new api, and that's ready to go when Team 1 gets around to consume it. How is this supposed to play out with contracts?

lucaseverain
2020-09-04 19:28
It was my mistake, sorry.

matt.fellows
2020-09-04 21:18
Hmm another option is trying out the v3 branch in pact JS. It uses a dynamic library

matt.fellows
2020-09-04 22:18
It doesn't have message support but has some newer matchers and things

matt.fellows
2020-09-04 23:10
The broker will get the failed status, it just won't break the provider build

matt.fellows
2020-09-04 23:11
The pending status is only shown locally

matt.fellows
2020-09-04 23:12
Because the broker doesn't know which tags are important to you it can't display "pending" in the UI, because the pending status is dependent on a few things

matt.fellows
2020-09-04 23:12
We?ve been thinking of be adding a config for something like this in Pactflow at some point because it would clearly be helpful

bethskurrie
2020-09-04 23:18
@phil.endsley I see contracts that are written by the consumer as having multiple purposes. ? requesting new functionality that doesn't exist ? ensuring the consumer is calling the API correctly ? ensuring backwards compatibility

matt.fellows
2020-09-04 23:19
But we haven?t connected it to this use case yet

matt.fellows
2020-09-04 23:19
(for example, `prod` and `master` tags may be the two tags you use to move things through the pipeline)

bethskurrie
2020-09-04 23:19
If the functionality already exists, then the first point is not relevant, but the second and third points are still relevant.

matt.fellows
2020-09-04 23:20
then we can track verifications etc. against these to increase visibility of what?s happening

phil.endsley
2020-09-04 23:22
Yeah, I'm specifically getting pushback about the first point. The others, I'm not so concerned about because we can do those "whenever"

phil.endsley
2020-09-04 23:22
I would prefer we do it the "right" way. Trying to see if there's any suggestions for a "something is better than nothing"

phil.endsley
2020-09-04 23:23
I'm willing to compromise some on process if it means they'll start writing them. My hope is they'll feel test pain and naturally switch to writing from the consumer first

bethskurrie
2020-09-04 23:23
I'm not sure if there is a "right" way.

bethskurrie
2020-09-04 23:24
Your tools need to match your process - modifying your process to match your tools... I'm skeptical of.

bethskurrie
2020-09-04 23:25
I say this as a total CDC fan - but not all APIs are consumer driven.

bethskurrie
2020-09-04 23:25
In this case, I think the benefits of consumer written contracts are mainly in the second and third points, and ensuring that the consumer has a valid mock.

bethskurrie
2020-09-04 23:25
We're actually working on some provider driven contract support in Pactflow at the moment.

bethskurrie
2020-09-04 23:26
Matt's got some posts coming out over the next few days. I'll make sure you get pinged when they come out.

bethskurrie
2020-09-04 23:26
I tell a lie - they're out


phil.endsley
2020-09-04 23:26
That's fair... I guess my opinion was that this would force our APIs to be better thought out, since most of them should be consumer driven (imo). The only reason they aren't is because, we've never done it that way before

bethskurrie
2020-09-04 23:26
There were so many thoughts, it's a 3 part series!

bethskurrie
2020-09-04 23:27
> The only reason they aren't is because, we've never done it that way before Technology is easy, people are hard!

phil.endsley
2020-09-04 23:27
We're interested in provider driven. We have a set of applications that are "core" in that most every other application consumes them

bethskurrie
2020-09-04 23:30
There's a page in the docs on "what is pact not good for" and one of the points is around "when you have an API that just isn't driven by consumers at all".

bethskurrie
2020-09-04 23:31
Hopefully this provider driven approach can help. I'm going get onto it right now! (I'm working Saturdays to help manage the parenting/working juggle :scream: )

phil.endsley
2020-09-05 02:10
> We're actually working on some provider driven contract support in Pactflow at the moment. > Pactflow only? Plans to make it open source at any point?

phil.endsley
2020-09-05 02:14
And back to the main point > I say this as a total CDC fan - but not all APIs are consumer driven. > What, in your mind is the determining factor? A team's process or the APIs functionality/purpose?

uglyog
2020-09-05 03:23
What is doing the verification?

ravi.mijar
2020-09-05 06:01
nicely explained! thanks Matt!

marco.dallagiacoma
2020-09-05 07:26
hi @uglyog, we're using the pact-cli for verification

marco.dallagiacoma
2020-09-05 07:28
We load the pact-cli via docker, running the `verify` command. In case it may be relevant, we're using pact v3 to verify messages

marco.dallagiacoma
2020-09-05 08:20
in case what we're experiencing is not the expected behavior from pact, I can develop and share a minimal example to reproduce it

uglyog
2020-09-05 08:20
pact-cli only supports V2 pact files, so the date/time matchers will not work


marco.dallagiacoma
2020-09-05 08:26
@uglyog I totally missed that, thanks a lot! Also, thank you so much for the tip about the v3 verifier! We'll try it out asap :slightly_smiling_face:

abubics
2020-09-05 11:07
I my experience, provider-driven often just comes from legacy practices and attitudes, usually paired with a "we specify it, you adhere to the spec" vibe. If you can convince the provider that they don't always know what's best, and consumers can help them avoid doing unwanted work, it can be quick to change :innocent:

abubics
2020-09-05 11:08
As usual, all computer problems are people problems :sweat_smile:

maciej.olko
2020-09-05 13:45
Oh, I see. Thank you for clarification!

suresh.tsv
2020-09-06 19:06
has joined #general

suresh.tsv
2020-09-06 21:12
Hi Folks First, I would like to appreciate this amazing tool and people behind it. Coming to the question I have, we are planning to implement CDC in our project and Pact is being considered as primary candidate. Currently I am working on a POC to set up end to end flow with CI/CD integration with GitLab. I have couple of questions related to Authentication/Authorization/security. 1. Consumer - Pact Broker: Consumers here are external partners. I see client side certificates as an option. I am not able to find documentation or info on Web for the options available. Please note that we will hosting the broker in AWS. 2. Pact Broker and Provider: Both components are part of our infrastructure. In this case I understand that we will be generating a GitLab trigger token which will be passed as part of future requests to Provider pipeline. We will be using same token every time. Could you please advise options available in both cases to make the communication more secure. Thanks in advance. Regards Venkat Thota

matt.fellows
2020-09-06 23:48
Thanks for the kind words!

matt.fellows
2020-09-06 23:48
It looks like you?re asking about pact broker security, so perhaps a better channel for that is #pact-broker

matt.fellows
2020-09-06 23:49
But I?ll briefly answer here. The OSS broker doesn?t have any security controls, other than basic auth (which isn?t very appropriate for external use for obvious reasons).

matt.fellows
2020-09-06 23:50
Where did you see that client certificates were supported? I?m sorry to say that is incorrect

matt.fellows
2020-09-06 23:50
You would need to add your own authentication layer for this purpose - if you had an API gateway that might be a good starting point

matt.fellows
2020-09-06 23:51
Alternatively, we have created a commercial version of OSS called Pactflow (see https://pactflow.io/features/) which has a full security model wrapped over the OSS broker. Happy to chat further if it?s something you?re willing to explore. We?re also very interested in the external consumer mode and how we can support that

matt.fellows
2020-09-06 23:56
What language are you using on the provider side Marco?

rafaelg
2020-09-07 06:21
has joined #general

marco.dallagiacoma
2020-09-07 07:03
Hi @matt.fellows, we're using PHP on the provider (sorry for the edit, I misread your question)

marco.dallagiacoma
2020-09-07 07:06
We wanted to use an out-of-process verifier to make the flow more technology-agnostic, since we have multiple providers implemented in different languages (and also since the v3 spec doesn't seem to be supported by most pact libraries yet)

matt.fellows
2020-09-07 07:06
Interesting!

marco.dallagiacoma
2020-09-07 10:05
@uglyog @matt.fellows Sorry to bother you again, but we're a little stuck. The pact-reference verifier does not appear to support messages (for services that communicate via event streams and message queues). Do you know if there is any cli verifier that fully supports the v3 specification? Thanks a lot again

marco.dallagiacoma
2020-09-07 10:24
Hoping it may help, I opened an issue about that https://github.com/pact-foundation/pact-reference/issues/73

matt.fellows
2020-09-07 10:59
There is no CLI support for it because it needs to be able to invoke a function directly (it doesn't act as a specific queue provider such as Kafka). It's a doable thing, but there is design work and thinking to get it going

matt.fellows
2020-09-07 10:59
I think PHP does support messages so that's your best initial path

matt.fellows
2020-09-07 11:01
Alternatively you could call the Ruby pact verifier directly and I think you can get JVM to spit out V2 matchers which should make it work

matt.fellows
2020-09-07 11:02
When I'm in front of a computer next I can go into more detail. There is the pact-message and pact-provider-verifier binaries that work on the consumer and provider sides.

marco.dallagiacoma
2020-09-07 13:25
Hi @matt.fellows, thanks a lot for your reply. I see your point, even though I'm not sure I totally understand the reasoning. Our idea was to expose an API on the provider to return stubbed messages, in order to let the verifier verify the contract. And it appears this is partially supported by the ruby cli (even though it lacks support for some v3 matchers), which is why we thought it would be supported by the new rust cli as well. But in case you think this would not be a sensible way to implement this, I will remove the issue on GitHub and we'll figure out how to do it ourselves, perhaps by wrapping the Java library in a Cli (unless there are better ways to achieve out-of-process verification of messages?). Thanks again, I really appreciate your support

olarrmide
2020-09-07 13:44
I looked at the branch but didn?t see anything that specifically applies. I?d still appreciate some explanation of the example mock-service request.

tjones
2020-09-08 03:05
^ Yep. I've faced similar issues on some clients. For me, I think provider-driven contracts only really make sense when you don't even know who your consumers are (eg, if you're just providing services for people to consume without speaking to you)

matt.fellows
2020-09-08 03:23
So you can download the v3 package this way: https://github.com/pact-foundation/pact-js#pact-js-v3

matt.fellows
2020-09-08 03:23
It doesn?t use `.bat` files, so shouldn?t suffer this issue at all

matt.fellows
2020-09-08 03:24
it loads a dynamic shared library using standard node processes - it?s not executing files like the current version

matt.fellows
2020-09-08 03:24
> I?d still appreciate some explanation of the example mock-service request. Not sure what you mean here sorry?


rarora
2020-09-08 04:33
has joined #general

diana.snyder
2020-09-08 18:31
has joined #general

armorsmith42
2020-09-08 21:36
has joined #general

uglyog
2020-09-08 23:14
If you can provide an endpoint to fetch the messages, we could update the CLI to work. Not sure what other mechanism can work in a general way.

matt.fellows
2020-09-09 00:08
> Our idea was to expose an API on the provider to return stubbed messages, in order to let the verifier verify the contract. > And it appears this is partially supported by the ruby cli (even though it lacks support for some v3 matchers), which is why we thought it would be supported by the new rust cli as well. Yes, that?s exactly how it works. As you say, it just doesn?t parse the v3 matcher format. So if you can serialise v2 format from JVM it should be doable via the CLI


matt.fellows
2020-09-09 00:13
As an FYI, I?ll be needing the Rust stuff to support this in the coming months as I add v3 matching support to Pact Go, and add message support to Pact JS v3 branch. So it will be done, but you can get going with the pact-provider-verifier right now

matt.fellows
2020-09-09 00:13
you should be able to look at the Pact PHP code base for how it does this too (based on the JS/Go implementations)

uglyog
2020-09-09 00:14
I think the point was to use the V3 format to get the date matchers, so serialise v2 format from JVM is not an option.

matt.fellows
2020-09-09 00:50
the date matcher is ultimately just a regex though, so Marco could replace it with a regex and be done with it

uglyog
2020-09-09 01:08
> date matcher is ultimately just a regex though That is so not true, it is semantic in that it parses the dates and understands different days in months, timezones, DST, leap years and leap seconds. I want to see you do that with a regex.

matt.fellows
2020-09-09 01:32
fair enough

matt.fellows
2020-09-09 01:32
I still think for the purposes of this a regex is likely to suffice and get Marco moving

aforeman
2020-09-09 01:56
Hi everyone :wave: I?ve recently joined @bethskurrie  @matt.fellows and @uglyog as the Product Marketing Manager for the commercial version of Pact - https://pactflow.io/. I would love to get in touch with some Pact users to understand how Pact is solving your testing problems. Happy for this to be an informal chat via Slack DMs or a video call at a time that suits you. BTW - I'm also on the hunt for some pin up users to provide testimonials and case studies.... :smile: Looking forward to hearing from you!

armorsmith42
2020-09-09 05:46
@aforeman For me, the value of testing tools, Pact included, is psychological. As I code, I go through the same core loop that I would in a video game: https://youtu.be/mGL5YGcAxEI 1. Understand my goal 2. Gather info 3. Form a hypothesis 4. Test my hypothesis 5. Observe results 6. Interpret data Specs make each step more clear. The stronger & more frequent hits of dopamine keep me motivated. This make me a simultaneously faster and more sure-footed developer.

matt.fellows
2020-09-09 05:49
When I first started to manage people, I realised the dopamine didn?t come in small hits like you do with dev. That was an adjustment!

armorsmith42
2020-09-09 05:58
Speculation: A 1-way pact broker can be a sales & support tool for an API-backed product. When I worked at GoCardless, our salespeople told us that the reference and tutorial docs we wrote helped them close deals by strengthening internal advocates and reducing the total cost of adoption. https://getputpost.co/overhauling-api-docs-with-gocardless-90cc2e656750 This was also Stripe?s early strategy ? I knew their 4th employee Greg. He dropped out of my uni to join them, giving me his dorm room. ??????? Great Docs + Fast tests: More powerful than docs alone.

armorsmith42
2020-09-09 06:14
Imagine if when you are using an API client and keep getting an error ? Why!!??!? frustrating! Imagine a command could make an ?unhappy contract file?. Now you can see your API call side-by-side with the contract ? You can see the diff between them. You could see and fix your bug more quickly. Imagine you could auto-remove the PII and email it to their support team. The API support team could immediately diagnose your confusion ? or see that the bug was on *their* end and API endpoint devs could reproduce and fix the bug in the API route. The Total Cost to Acquire that API-backed product just went down as well as their support cost and dev cost.

armorsmith42
2020-09-09 06:35
Yep! That happens any time you put time lag in the reward feedback loop. Know anybody who found it dramatically harder to focus when they suddenly went from working alongside their team to working remotely? They lost familiar ways to feel aligned with their team. It made it harder for their brain to model rewards ?> weaker and less frequent dopamine hits ?> less well-directed attention. ?????? A friend of mine makes videos on how keep AI systems aligned with humanity?s goals. He explains Reward Modeling well here: https://youtu.be/PYylPRX6z4Q I think the concept is useful for anyone with a deep neural network :brain: between their ears. Automated tests are a written artifact that strengthens a reward model.

matt.fellows
2020-09-09 06:38
Indeed.

matt.fellows
2020-09-09 06:38
> I think the concept is useful for anyone with a deep neural network dang, I was hoping it was going to be helpful for me :wink:

matt.fellows
2020-09-09 06:47
So these ideas are good - what else should we build Andrew!

matt.fellows
2020-09-09 06:47
(just in case, that should not be interpreted as sarcasm)

tjones
2020-09-09 06:47
I really like this

tjones
2020-09-09 06:49
Somewhat related, I'd like the ability to say "I don't like this response" - especially with AWS services - a lot of their APIs return 400 with no context when something is wrong. As a provider OR consumer it would be awesome if consumers could automatically flag "I found this response very unhelpful"

aforeman
2020-09-09 06:59
Getting into the flow @armorsmith42 love it

dabs1234
2020-09-09 07:34
has joined #general

dabs1234
2020-09-09 07:52
Hello All, I am new to PACT and just did a POC with JUnit5 on simple microservice consumer and provider. Now I need to implement it on real springboot microservice which uses oauth2. What is the best way of achieving this? Any sample code would be a great help.

matt.fellows
2020-09-09 07:58
Hello! Might be worth asking in #pact-jvm

matt.fellows
2020-09-09 08:00
howtolearn

2020-09-09 08:00
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

matt.fellows
2020-09-09 08:00
:point_up: have a look here as well, the workshop for Java has an example of how to work with auth

marco.dallagiacoma
2020-09-09 08:25
Thanks a lot @matt.fellows and @uglyog, you've been super helpful and we appreciate that a lot :slightly_smiling_face: We'll try to do as Matt suggests and use the ruby cli until this gets implemented in the rust cli. Again, thank you! :smile:

matt.fellows
2020-09-09 08:36
:slightly_smiling_face:

aftabshk
2020-09-09 09:32
has joined #general

aftabshk
2020-09-09 09:35
Hello All, we are working on a project where we get encrypted responses from providers. We are using pact-jvm-provider-gradle plugin version 4.0.3 for writing the contract tests. Could you please let us know how we can leverage the pact to check the contract after decryption of the response?

hader.araujo
2020-09-09 14:20
has joined #general

jagiles
2020-09-09 16:07
has joined #general

flavio.antunes
2020-09-09 17:22
has joined #general

tony.silva
2020-09-09 17:23
has joined #general

suresh.tsv
2020-09-09 22:57
Thank you very much for your quick response. As suggested, we will explore the options of API gateway and Pactflow. I will reach out to you or team if there are any questions. Regards

crazycabo350
2020-09-10 04:25
has joined #general

daniel.meisen
2020-09-10 06:52
has joined #general

armen.chuljyan
2020-09-10 07:44
has joined #general

aitorarce
2020-09-10 09:56
has joined #general

krisdinesh
2020-09-10 11:12
I am successful implementing Pact for the languages .net and java. Moving further to use in Ruby as well. Here I am having a question, is there a way that I can run provider test using like .exe instead of running like unit test. In the world of ci/cd I feel this could be great option for language agnostic

sagupta
2020-09-10 12:14
Hello , On running the provider side tests, is there a way to get the logs to know what was the actual response from the provider when the interactions are replayed? Currently I only see failure like this ```Failures: 1) Verifying a pact between <consumer> and <provider> Given a saved form with elements a request to publish a form with <> returns a response which has status code 204 Failure/Error: expect(response_status).to eql expected_response_status expected: 204 got: 404 (compared using eql?) # ./bin/pact:15:in `<top (required)>' 4 interactions, 1 failure``` I wanted to know what was the whole response returned from provider? Also currently I am not publishing the results back to pact broker , is there a way to see these response in pact broker as well?


matt.fellows
2020-09-10 12:16
The feedback is displayed in pactflow, not the oss broker I?m afraid

matt.fellows
2020-09-10 12:16
Which language are you using? There should be provider logs somewhere

sagupta
2020-09-10 12:17
ohh, i am using pact-cli provider-verify command to run provider tests

matt.fellows
2020-09-10 12:18
`--verbose` might get you somewhere

matt.fellows
2020-09-10 12:18
I have a feeling it does write a log file somewhere (you might need to do a search in the sub folders)

matt.fellows
2020-09-10 12:18
I can?t recall if there was a flag added recently to control log output

sagupta
2020-09-10 12:20
I find this in the provider-verifier readme ``` -o, [--out=FILE] # Write output to a file instead of $stdout.```

matt.fellows
2020-09-10 12:21
that?s just going to redirect stdout to a file, probably not what you want

sagupta
2020-09-10 12:21
But I guess it is for the failure logs which i posted in the message and not the response from provider

sagupta
2020-09-10 12:21
let me try --verbose

sagupta
2020-09-10 12:27
didnt help , it only added extra logs about connection to pact broker like this and the test logs are the same as before ```opening connection to pact-broker.gp.k8s.<>:443... opened starting SSL for pact-broker.gp.k8s.<>:443... SSL established <- "GET / HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: application/hal+json\r\nUser-Agent: Ruby\r\nAuthorization: [redacted]\r\n" -> "HTTP/1.1 200 OK\r\n"```

vittorio.guerriero
2020-09-10 12:28
has joined #general

sagupta
2020-09-10 12:35
I cant find any log file in the subfolder . However I found this as well in readme ``` # Default: 0 [--log-dir=LOG_DIR] # The directory for the pact.log file [--log-level=LOG_LEVEL] # The log level```

sagupta
2020-09-10 12:42
got it . it is indeed :point_up: . once i set the property --log-dir i got a .log file which has all the request and responses

copalco
2020-09-10 12:53
has joined #general

krisdinesh
2020-09-10 13:14
Exactly this is what I am expecting. @matt.fellows I don?t have words to express the way you help community. Without you I would have lost while implementing Pact.

crazycabo350
2020-09-10 13:15
`[ERROR] pactVerificationTestTemplate{PactVerificationContext}[1] Time elapsed: 1.222 s <<< ERROR!` `au.com.dius.pact.core.support.json.JsonException: Invalid Json document (1:3) - expected a string but found unexpected characters '[C@464c18c8'`

crazycabo350
2020-09-10 13:15
Wondering if anyone has an idea of what the error above could represent

crazycabo350
2020-09-10 13:16
The Pact is verified and result uploaded to broker successfully, but error causes test to fail

crazycabo350
2020-09-10 13:22
This is a Spring project using jUnit5

crazycabo350
2020-09-10 13:24
The character string mentioned I could not find in the HAL browser for the broker, so I'm not sure what it's referring to.

antonello
2020-09-10 14:24
It looks like some kind of encoding issue

sidhartha.k.subudhi
2020-09-10 16:18
I was giving a demo to the leadership today. I got a question and could not convince them. Need help in this. Question is, we are defining contract in Consumer test like this: ```.body(new PactDslJsonBody() .integerType("id",7) .stringValue("name", "Tiger"))``` But if there are 50 fields am I going to write one by one like this or there is any way we can feed everything in a file and call that in code?

crazycabo350
2020-09-10 18:24
Define DSL body in another class separate from tests for reusability

crazycabo350
2020-09-10 18:25
Yeah, but how can I troubleshoot it? Where do those characters exist during Pact verification.

michaelkochub
2020-09-10 19:49
Hello! Based on the documentation (https://docs.pact.io/implementation_guides/jvm/provider/gradle/#specifying-the-provider-hostname-at-runtime) you can specify the pact file location at runtime by setting the `pactFile` variable to a closure. This is for configuring a single consumer. Is it possible to do the same thing in the multiple consumer case? Like so: ```hasPactsWith('manyConsumers') { pactFileLocation = { lookupPactFolder() } }``` When I try to do this, Gradle throws a casting exception

antonello
2020-09-10 20:58
Can you tell us nord about your pact?

matt.fellows
2020-09-10 21:35
It's just java code, you could extract those into a fixture file or whatever you find simplest to manage

abubics
2020-09-10 23:48
Also, depending which language you're using, there might be a nicer Pact DSL, or syntactic sugar provided by the actual language.

bethskurrie
2020-09-11 09:01
Pact Broker Maintainer announcement: The Pact Broker API that supports the pending pact, WIP pacts, and consumer version selectors during verification has been officially released in 2.60.1. There are some versions of the pact-ruby-standalone (the underlying shared pact code) that use a beta version of the API that is now no longer supported (the original API used a GET, but the parameters turned out to be too complex, so it was changed to a POST). If you find issues, please upgrade to the latest version of your Pact client library.

bethskurrie
2020-09-11 09:07
Hi @michaelkochub - best to ask in the #pact-jvm channel

alex.elmekeev
2020-09-11 09:09
:wave: is it possible to specify the versions of client libraries we should update to? Do we have updates for all clients libraries to support this change?

bethskurrie
2020-09-11 09:10
Pact JVM will be fine - it never used the GET API.

bethskurrie
2020-09-11 09:10
Which library are you using?

alex.elmekeev
2020-09-11 09:11
we have ruby, jvm, js and python and I've updated our broer to 2.60.1 in order to report https://pact-foundation.slack.com/archives/C9VHVEDE1/p1599756784003800 so now I wonder if I broke something

bethskurrie
2020-09-11 09:28
@alex.elmekeev see the comments on the issue

sidhartha.k.subudhi
2020-09-11 12:03
Can you please give one example for JAVA. a small and simple one is ok to understand.

karasiewicz.business
2020-09-11 14:02
has joined #general

crazycabo350
2020-09-11 14:18
```{ "provider": { "name": "floorplan" }, "consumer": { "name": "payments" }, "interactions": [ { "description": "Request with floorplan ID", "request": { "method": "POST", "path": "/api/v2/floorplans/byFloorplanId", "body": "{[\u00272b1ce421-b80c-4f5b-aef4-b1691d0ff0a2\u0027]}" }, "response": { "status": 200, "headers": { "Content-Type": "application/json; charset\u003dutf-8" }, "body": { "id": "e2490de5-5bd3-43d5-b7c4-526e33f71304", "titleLocation": "string", "titleLocationId": 100 }, "matchingRules": { "body": { "$.id": { "matchers": [ { "match": "regex", "regex": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" } ], "combine": "AND" }, "$.titleLocation": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.titleLocationId": { "matchers": [ { "match": "integer" } ], "combine": "AND" } } }, "generators": { "body": { "$.id": { "type": "Uuid" }, "$.titleLocation": { "type": "RandomString", "size": 20 }, "$.titleLocationId": { "type": "RandomInt", "min": 0, "max": 2147483647 } } } } } ], "metadata": { "pactSpecification": { "version": "3.0.0" }, "pact-jvm": { "version": "3.6.15" } } }```

jan.krejci
2020-09-11 16:09
Hi guys. Is it possible somehow you create the provider states before the consumers actually exist within the Pact Broker ?

phillip.lo
2020-09-11 21:07
I was wondering if there are any known limits of how many pacts and number of consumers/providers the broker is able to handle? Are limits purely based on UI usability or is there a limit we should know about?

adrian.golawski
2020-09-12 00:14
has joined #general

matt.fellows
2020-09-12 00:14
How big are we talking? We have customers with hundreds or applications and integrations and tens of thousands of publications etc.

matt.fellows
2020-09-12 00:15
We have a way to clean out old data also if its really a problem, but it's unlikely to surface for a while

bethskurrie
2020-09-12 00:17
There's no offical documentation process for it, but you can write the code and share the documentation in your own way.

bethskurrie
2020-09-12 00:34
@phillip.lo one of the issues people have found with the OSS Pact Broker is that there is no way of grouping or filtering the applications in the dashboard. This is why we've just added teams support in Pactflow. It lets you assign people and applications to teams, and filter the dashboard by team, so you can just see the applications you're responsible for.

bethskurrie
2020-09-12 00:35
We'll be adding more team-centric functionality over the next few months.

phillip.lo
2020-09-12 01:51
Hundreds of apps and tens of thousands of publications is enough scale for what we need. Makes sense about the grouping and filtering from pactflow. Thanks for the info!

abubics
2020-09-12 01:57
https://docs.pact.io/implementation_guides/jvm/consumer/java8/ e.g. ```array.object((o) -> { o.stringValue("foo", "Foo"); # an attribute o.stringValue("bar", "Bar"); # an attribute o.object("tar", (tarObject) -> { # an attribute with a nested object tarObject.stringValue("a", "A"); # attribute of the nested object tarObject.stringValue("b", "B"); # attribute of the nested object }) });```

abubics
2020-09-12 01:58
but if you have a flat set of 50 fields, no DSL is going to help you much :slightly_smiling_face:

abubics
2020-09-12 02:08
If that's the case, it's up to you . . . you can make static fixtures (brittle, and makes matching hard), dynamic fixtures, dynamic fixture helpers . . . they all have different trade-offs, including maintainability and readability. You might also want to consider refactoring the data structures to make them easier to read, understand, and work with for all API consumers :innocent:

armorsmith42
2020-09-13 02:19
Idea 1: Target your marketing at the consumers of APIs who write tests as a way of doing TDD and checking that they understand the API. I naively suspect that the Pay-Per-Click auctions aren?t all that crowded for frustrating API errors. Idea 2: The API-consumer tool that advertises the competitors of your non-customers This CLI helps devs understand and check their assumptions about an API as they work with it. Unless configured otherwise, error responses can link to either A. An API support channel that the API host pays you to include. B. StackOverflow, if you want to leave money on the table. C. A privately-run StackExchange-like forum entry about that API endpoint or error. This page includes discussion of the error and how to use this frustrating API, but also advertisements for competing products. The more frustrating the API, the more ad-exposure its competitors get. Example: If someone is frustrated with the SalesForce ExactTarget API for sending emails, they could google for it and the near-top hits could be: 1. Pact Consumer tool download link. 2. The same Pact API Experience forum link that #1 could give them. It would show an advertisement for Mandrill. So you either A. make money off Mandrill for task-targeted advertizing. B make money from ExactTarget to ?help improve their API usability?

armorsmith42
2020-09-13 02:20
Is it a little bit of a protection racket? Sure, but if I?m right, its a protection racket that would create incentives for better-documented API developer experiences.

armorsmith42
2020-09-13 02:24
It also gives you an audience of devs who start using the consumer tools without needing signoff from anyone but the lead of their particular project.

armorsmith42
2020-09-13 11:27
(Er, maybe thats too convoluted)

me1276
2020-09-14 06:37
has joined #general

rarora
2020-09-14 07:55
Hi Team I am using jdk-11.0.8+10/ and pact version 4.0.4. Whenever i try to publish pacts to broker, my gradle daemon crashes without error in log and hss_err*.pid file is created

rarora
2020-09-14 07:57
Has anybody faced such error before?

uglyog
2020-09-14 07:59
Looks like libjansi is causing an issue. If you upgrade to 4.1.x, it doesn't use jansi anymore

matt.fellows
2020-09-14 08:00
Hello @me1276! How'd the talk go?

me1276
2020-09-14 08:02
Hey @matt.fellows! The talk is later today, it?s not really a talk rather a rundown panel where we review trends in testing, and Contract/Pact is getting a lot of attention :rocket:

matt.fellows
2020-09-14 08:04
Oh cool!

matt.fellows
2020-09-14 08:05
And it sure is. I'm just popping out for a bit but would love to chat and hear how it goes and of course if you need anything we're all here to help!

me1276
2020-09-14 08:06
Sure thing, I?ll share some updates

uglyog
2020-09-14 08:11
@marco.dallagiacoma Rust Pact verifier CLI has been updated to support verifying message pacts.

marco.dallagiacoma
2020-09-14 08:24
@uglyog thanks a lot, you people (and the person who made the PR) rock! :smile:

wesleythomaswilliams
2020-09-14 10:46
General question. My team are about to start integrating with a service which uses Kafka with Avro and a Schema Registry. I've been reading up on it and my immediate thought was that contract testing becomes less important or maybe even redundant when a schema registry is in play. Am I being stupid?

matt.fellows
2020-09-14 12:03
Not being stupid at all!

matt.fellows
2020-09-14 12:04
First, right now at least, you would need to create some form of adapter in your pact tests (similar to the one described in #protobufs ) to deal with Avro, albeit Avro is fairly simple

matt.fellows
2020-09-14 12:04
secondly, the schema registry does give you some guarantees that may alleviate Pact tests

matt.fellows
2020-09-14 12:08
The downsides: 1. You won?t catch integration issues until you deploy into a test environment (so no feedback on dev machine). There are settings as well that configure if it fails on deploy or on ?first contact?. So there may be further delays there also. 2. You have to ensure that your test environment matches the state of production, otherwise the schema version management will get out of sync (i.e. stateful environments) 3. You may not get the full picture in the pact broker of the architecture (or rather, you?ll lose out on the message details) 4. There may be something about the evolution capabilities of Pact that it doesn?t know about (e.g. removing a field that a consumer no longer needs that Pact can facilitate, I?m not sure if that scenario is covered by the schema registry) I?m not an expert though, and possibly

matt.fellows
2020-09-14 12:09
A lot of those tools are more ?backwards compatibility? detectors, but do it at the schema level. A contract encapsulates the conversations, so knows what parts of the schema are/aren?t used

psychopomp3x
2020-09-14 13:15
Lateral question: My team has started down the road of micro-frontends, where a larger application is split into multiple independently deployable applications deployed to different servers, but with facets that allow them to integrate shallowly at runtime. We are finding ourselves with a new need to test that a url is available / stable as those applications may hyperlink to stable and versioned urls in each other. It's not an API, but it is a provider / consumer construct. Is this the sort of thing we could use pact for via an off-label usage? We would essentially need to test that a provider application has a route at a url that accepts certain queryparams.

sklein
2020-09-14 13:17
I am very interested to hear stories/strategies for how others have promoted pact adoption in their organizations (i.e. custom packages, templates, etc). Anyone willing to share experiences and outcomes?

khazhak.vahanyan
2020-09-14 14:54
has joined #general

khazhak.vahanyan
2020-09-14 14:56
Hey there. One question about matching arrays. Is there a way to have anyLike instead of eachLike?

khazhak.vahanyan
2020-09-14 14:58
the problem is, my API has an array which contains elements of different types(I konw it's badly designed). Each element assumes different business logic, so one test case needs one of the elements

khazhak.vahanyan
2020-09-14 15:05
or maybe a functionality of "or". So match like `{ob: likeOr({id: "id but no name"}, {name: "name but no id"})}`


jonathanmorley
2020-09-14 16:58
has joined #general


matt.fellows
2020-09-14 21:07
Which language?

matt.fellows
2020-09-14 21:14
Interesting idea. Are the routes a DAG or can a consumer and provider both link to each other? (I.e. are there cyclic dependencies?)

matt.fellows
2020-09-14 21:14
I think Pact supports it but suspect if there is a lot of it going on it might get messy/confusing

matt.fellows
2020-09-14 22:38
Cc @sayboras @bheemreddy181 @franklin.huynh @antonello

matt.fellows
2020-09-14 22:39
We're also looking for a customer to talk to their experiences using pact at a Rabobank (Netherlands) internal conference. They have a contract testing guild internally and are looking to scale the practice bank wide

matt.fellows
2020-09-14 22:39
I'll be casting the net a little wider so will connect you if I can

bheemreddy181
2020-09-15 03:14
Pact adoption is still in progress at our org and it?s not quite easy to get a buy in directly I am trying to pair with each team and look at new API?s rather than tweaking around the existing ones which already has lot of end to end tests

bheemreddy181
2020-09-15 03:16
And pact adoption is not quite straight forward as writing an end to end test - one team really started seeing value from it and they wanted to do more and another team gave a try and they felt like a overhead because they don?t look at this option as longer term value and they face lot of challenges with existing library comparability

bheemreddy181
2020-09-15 03:18
And this story continues I feel people need more understanding around advantages from this approach

bheemreddy181
2020-09-15 03:19
So I am working on a documentation to make things really easier for people to adopt as we are doing this for the first time we are not quite at there to make it really easy for entire org and the each service has its own challenges for making templates more generic

matt.fellows
2020-09-15 07:16
Thanks for your input Bheem

matt.fellows
2020-09-15 07:18
Looks like things have moved on a little slowly there. As an FYI, we think our work around provider-driven contract testing might be useful to your team - our guess is that the consumers are finding it easier to write the tests, but the provider teams are having a harder time of buying into it. If you?re interested, let me know and we can see if it would be helpful

khazhak.vahanyan
2020-09-15 07:53
JS, Java and swift

khazhak.vahanyan
2020-09-15 07:54
when is the planned release?

matt.fellows
2020-09-15 07:59
JS/Java ~1 month I?d say

matt.fellows
2020-09-15 07:59
Swift is not currently on the near term roadmap, but if you could give that a comment on the canny post that would help

khazhak.vahanyan
2020-09-15 08:00
that's cool. it would probably take more to convince my company to use Pact haha

khazhak.vahanyan
2020-09-15 08:06
A few uncomfortable issues I had while trying the full integration. CLI tool is a bit buggy. Tried the standalone Ruby version on mac, it was pain, as I had to allow permissions for ~20 libs it uses seperately(maybe a brew package would fix this). Error messaging is kinda lacking too. Even with debug mode, I had to guess why some stuff isn't working (1. missed https in front of broker url, it said it succeeded but it didn't, 2. By defualt it searched by tag "dev". For a newbie, it's hard to understand why no contract was being tested).

khazhak.vahanyan
2020-09-15 08:10
Documentation on publishing pacts is also lacking, I think. I persionally think, CLI tool is the best way to publish, as it can be easily integrated with every CI tool out there, so I think docs should state that.

matt.fellows
2020-09-15 08:23
what do you mean by ?allow permissions? for the 20 libs?

matt.fellows
2020-09-15 08:23
do you have a security tool or something picking that up?

matt.fellows
2020-09-15 08:23
it should be an unzip, chmod and go

matt.fellows
2020-09-15 08:23
that protocol thing sounds like a bug though

matt.fellows
2020-09-15 08:24
We agree, but most people say ?why can?t I publish in `<insert my language/framework/build tool here>` (looking at you Maven users)

khazhak.vahanyan
2020-09-15 08:24
Macos Catalina requires manual allowance from "unidentified developers". It's a non issue usually but for some reason pact's cli required for each lib

matt.fellows
2020-09-15 08:24
we recently made some changes on this (to push CLI usage), perhaps we need to do more - thanks!

matt.fellows
2020-09-15 08:25
strange, I?m on catalina and don?t have that issue

matt.fellows
2020-09-15 08:25
That would render any scripting language basically useless!

khazhak.vahanyan
2020-09-15 08:25
I will try to reproduce

abubics
2020-09-15 08:26
idk, if I google "publish pact", https://docs.pact.io/pact_broker/publishing_and_retrieving_pacts/ is the first hit, and it's all CLI instructions (until after the curl section where it says you probably don't need it :P)

khazhak.vahanyan
2020-09-15 08:39
that is correct :smile:

khazhak.vahanyan
2020-09-15 08:45
There it is

khazhak.vahanyan
2020-09-15 08:46
@matt.fellows

bheemreddy181
2020-09-15 10:43
I would like to adopt more Consumer Driven contracts than provider driven for known consumers based services I am fairly confident that we will get there and for services with unknown consumer provider based contract testing makes more sense

lukorovina
2020-09-15 11:20
has joined #general

francislainy.campos
2020-09-15 11:56
Hi, just signed up for pact flow to check it out but am a bit confused on how to publish a contract into it if anyone could guide me on this please? I do Java, so initially assumed I'd need to point my pact plugin on the pom file to url that has been emailed me, but maybe need some more configs? Thanks a lot.

wesleythomaswilliams
2020-09-15 11:57
Happy to help

francislainy.campos
2020-09-15 11:58
Awesome, thanks a million.

francislainy.campos
2020-09-15 11:58
Okay, so trying to publish my contract if you know how to do that please?

wesleythomaswilliams
2020-09-15 11:59
Sure, let me just dig up the details.

francislainy.campos
2020-09-15 11:59
Thank you.

wesleythomaswilliams
2020-09-15 12:01
Ok, so we have a dedicated stage in our pipeline for it. We use Maven & Jenkins. ```/* ******** Pact Publish ******** */ stage("Pact Publish") { // Stage is only executed if the service is a consumer. when { expression { isTestStageRequired() && pipelineParams.pact_publish } } steps { script { currentStage=env.STAGE_NAME try { sh 'docker run -v $PWD:$PWD -w $PWD -v /var/run/docker.sock:/var/run/docker.sock ' + env.BUILD_CONTAINER_NAME + ' mvn -B -f pom.xml pact:publish' + ' -Dpact.consumer.version=' + env.GIT_COMMIT + ' -Dpact.tag=' + env.GIT_BRANCH } catch (Exception ex) { echo "Exception in \"Publish Pact File\" stage, see logs for details." throw ex } } } }```

francislainy.campos
2020-09-15 12:02
I'm trying to do the manual publishing so not hooked up to jenkins but directly through a maven command.

wesleythomaswilliams
2020-09-15 12:02
Our pom for consumers contains this: ```<!-- Pact --> <plugin> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-provider-maven</artifactId> <version>${pact.version}</version> <configuration> <projectVersion>${pact.consumer.version}</projectVersion> <pactDirectory>${project.build.directory}/pacts</pactDirectory> <pactBrokerUrl>https://pde.pact.dius.com.au</pactBrokerUrl> <pactBrokerToken>SHHITSASECRET</pactBrokerToken> <pactBrokerAuthenticationScheme>Bearer</pactBrokerAuthenticationScheme> <skipPactPublish>false</skipPactPublish> <tags> <!--suppress UnresolvedMavenProperty --> <tag>${pact.tag}</tag> </tags> </configuration> </plugin>```

francislainy.campos
2020-09-15 12:02
Ah okay, so maybe this line:

francislainy.campos
2020-09-15 12:02
``` <pactBrokerToken>SHHITSASECRET</pactBrokerToken>```

francislainy.campos
2020-09-15 12:03
I'll try that.

francislainy.campos
2020-09-15 12:03
Thank you.

wesleythomaswilliams
2020-09-15 12:03
You can also use username/password

francislainy.campos
2020-09-15 12:03
Really?

wesleythomaswilliams
2020-09-15 12:03
I think so, unless they've removed that (which is possible)

francislainy.campos
2020-09-15 12:04
like <pactUsername>username</pactUsername>

wesleythomaswilliams
2020-09-15 12:04
Yeah, let me check


wesleythomaswilliams
2020-09-15 12:09
Also, I'm using v4.0.4 so some other things may have changed. I notice in the docs the artifactId = maven, whereas mine is pact-jvm-provider-maven

francislainy.campos
2020-09-15 12:11
The pom is rejecting me publishing into the broker whereas it works fine when I point to our own broker url

francislainy.campos
2020-09-15 12:11
I'll see if maybe something else described on the documentation

francislainy.campos
2020-09-15 12:14
```<plugin> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-provider-maven</artifactId> <version>${pact.version}</version> <configuration> <pactDirectory>target/pacts</pactDirectory> <pactBrokerUrl>https://mypflow.pactflow.io/</pactBrokerUrl> <pactBrokerUsername>myusername</pactBrokerUsername> <pactBrokerPassword>mypass$</pactBrokerPassword> <projectVersion>${project.version}</projectVersion> <trimSnapshot>true</trimSnapshot> </configuration> </plugin>```

francislainy.campos
2020-09-15 12:14
This is what I have.

sklein
2020-09-15 12:56
@matt.fellows I'm eagerly awaiting the provider driven contract features you have in store, especially the stuff around openapi spec generated contracts! I know it's on the road map for q3!

psychopomp3x
2020-09-15 13:34
I believe they will be p2p / cyclic for most runtime integrations, which will place a burden on crafting shallow integrations and version stability. For example, there may be a "launchpad" app that provides a user a list of prioritized concerns, and then when they click on a concern, it will switch to a "member" summary app, which may link to a "member contact history" app, and then back to the original "launchpad" app when they complete the workflow. The entry point routes would look something like: http://memberContacts.foo.com/publicStableRoutes/memberSummary/v1 The plan is to make breaking changes immutably via new version numbers, and keep the old one around until all downstream clients are upgraded and tested against the new interfaces. In order to build trust with the consumer apps, we want to have some sort of backwards compatibility test to prove that the v1 isn't broken when v2 is published. We have also toyed with the idea of hosting multiple versioned web components from each of the apps with a similar versioning and bct structure. In that case, it would be something like "http://member.foo.com/publicSmartWidgets/v1/memberDemographics/main.js" They would be loaded at runtime via something like in-browser ES modules or via systemjs. This is similar to how single-spa based apps perform runtime integrations of angular elements / web components.

matt.fellows
2020-09-15 13:37
@francislainy.campos you can?t user username/password for Pactflow. We only support bearer token authentication

matt.fellows
2020-09-15 13:37
your username and password are for access to the UI only

matt.fellows
2020-09-15 13:37
Bearer token is for API Tokens


matt.fellows
2020-09-15 13:38
@wesleythomaswilliams have a :taco: because you?re so helpful.

francislainy.campos
2020-09-15 13:38
Cool, alright. Thanks. I'll try with the token then.

matt.fellows
2020-09-15 13:38
A second :taco: for @wesleythomaswilliams for previously helpfulness

matt.fellows
2020-09-15 13:39
Make sure to get the read/write token, not the read-only one

louisallenfrank
2020-09-15 13:42
has joined #general

matt.fellows
2020-09-15 13:42
You?re now officially on a list, congratulations :stuck_out_tongue:

wesleythomaswilliams
2020-09-15 13:45
Apologies @francislainy.campos I ducked out for lunch. Thanks for the Taco's @matt.fellows

jonathanmorley
2020-09-15 13:45
hey :wave: maybe one for the #pact-js channel but are there any plans to support requiring multiple states in the setup for my consumer test? (maybe this is already possible) i'd like to be able to compose various states together to use in my consumers, to avoid creating further niche states on the provider.

francislainy.campos
2020-09-15 13:47
Cool, yeah. That worked. And no worries Wes, you've been great helping me with this one.

jonathanmorley
2020-09-15 13:47
conceptually looking for something like: ```return provider.addInteraction({ state: ['there is a burger order', 'there is a fries order'], uponReceiving: 'a request for orders', withRequest: { path: '/orders', method: 'GET', }, willRespondWith: { body: eachLike({ id: 1, items: eachLike({ name: 'burger', quantity: 2, value: 100, }), }), status: 200, headers: { 'Content-Type': 'application/json; charset=utf-8', }, }, })```

francislainy.campos
2020-09-15 13:47
I'm now just going to the verification bit.

francislainy.campos
2020-09-15 13:48
And I have this:

francislainy.campos
2020-09-15 13:48
```@Provider(VC) /** Uncomment this and comment @PactBroker instead to test locally by pasting a .json file for the contract under the target/pacts folder */ //@PactFolder("target/pacts") @PactBroker(host = "http://mypact.pactflow.io", consumers = {ED_UI}) public class PactProviderTest { @TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) void pactTestTemplate(PactVerificationContext context, HttpRequest request) { request.addHeader("Authorization", AUTHORIZATION_TOKEN); context.verifyInteraction(); } @BeforeEach void before(PactVerificationContext context) { context.setTarget(new HttpsTestTarget(getBasePactEndpoint(), 443, "/")); getAuthorizationToken(UserType.TEACHER); } @State("A request to store/create a Zoom meeting") public void sampleState() { } }```

francislainy.campos
2020-09-15 13:48
But am getting a 401 error.

wesleythomaswilliams
2020-09-15 13:49
So we have: ```@PactBroker( host = "${pact.broker.host}", scheme = "https", port = "443", authentication = @PactBrokerAuth(token = "${pact.broker.token}"))```

francislainy.campos
2020-09-15 13:50
Cool, let me try that. Thank you.

psychopomp3x
2020-09-15 13:52
The exported bits would need to be self-contained except for the dom based public interface. We would not, for example, export any types in this mode of operation.

francislainy.campos
2020-09-15 13:53
Yes, I'm in now but then, sorry, another question.

francislainy.campos
2020-09-15 13:54
It's not finding my pact even though I can see it there on the UI.

francislainy.campos
2020-09-15 13:59
Actually, no, sorry, there was an error on the path and once fixed it did connect and verified the contract but I was expecting to see the results from the ui rather than the local terminal?

wesleythomaswilliams
2020-09-15 14:02
If you publish the verification results, you should see that in the UI

wesleythomaswilliams
2020-09-15 14:02
But the verification alone won't show anything.

francislainy.campos
2020-09-15 14:03
I'm just trying a way to see the stack trace with some better formatting since what is logged on the terminal is hard to read.

wesleythomaswilliams
2020-09-15 14:03
We do this in our pipeline: ```sh 'docker run -v $PWD:$PWD -w $PWD -v /var/run/docker.sock:/var/run/docker.sock ' + env.BUILD_CONTAINER_NAME + ' mvn -B -f pom.xml jacoco:prepare-agent jacoco:report test -Pcore-tests' + ' -Dpact.provider.version=' + env.GIT_COMMIT + ' -Dpact.verifier.publishResults=true' + ' -Dpact.provider.tag=' + env.GIT_BRANCH```

wesleythomaswilliams
2020-09-15 14:04
That executes provider tests and publishes the results to Pact Flow

matt.fellows
2020-09-15 14:04
Yes, checkout the v3 version on the readme.

francislainy.campos
2020-09-15 14:04
Okay, so maybe this would be another config on the pom I suppose.

matt.fellows
2020-09-15 14:04
It's beta, but does support that

francislainy.campos
2020-09-15 14:05
Or maybe just to append this to the maven command we use to run it.

wesleythomaswilliams
2020-09-15 14:05
We took the stance that we only want results published as part of the build process, so that Pact Flow isn't full of local build results.

francislainy.campos
2020-09-15 14:05
I'd run it through the ui button on intellij but let me try through the terminal with the maven instead.

jonathanmorley
2020-09-15 14:15
thanks @matt.fellows which bit specifically? The examples seem to 404

francislainy.campos
2020-09-15 14:40
It's working now that I see whether it passed or failed through the flow, but I guess as you're saying it doesn't seem to show much more than that.

francislainy.campos
2020-09-15 14:43
I guess what I need is a better way to debug issues as the terminal is not very friendly with the pact stack trace.

wesleythomaswilliams
2020-09-15 14:44
You might be out of luck there. I think everything I do from a debug perspective is via the terminal.

francislainy.campos
2020-09-15 14:45
~Do you know~

francislainy.campos
2020-09-15 14:45
You see, this is what I mean.

francislainy.campos
2020-09-15 14:46
I was trying to find a way to get the curl that generated that call or pieces of the request that I could put together and maybe check why this is coming up this way.

francislainy.campos
2020-09-15 14:47
There may be something that comes from this bit:

francislainy.campos
2020-09-15 14:47
```@TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) void pactTestTemplate(PactVerificationContext context, HttpRequest request) { request.addHeader("Authorization", AUTHORIZATION_TOKEN); context.verifyInteraction(); }```

wesleythomaswilliams
2020-09-15 14:47
Yeah, it's not pretty and does make it challenging at times to debug.

francislainy.campos
2020-09-15 14:47
So was trying to debug the httpRequest class

francislainy.campos
2020-09-15 14:48
Yeah, I'm around 4 to 5 hours now trying to see why my pact is failing I'm afraid.

wesleythomaswilliams
2020-09-15 14:48
As it's referring to the body comparison, I'd be looking at how my contract is defined.

wesleythomaswilliams
2020-09-15 14:48
Can you share it?

francislainy.campos
2020-09-15 14:49
I've removed all fields from my contract so that it has only one key but still getting the same thing. All my others work fine.

francislainy.campos
2020-09-15 14:50
I can clean up a bit here and share, thank you. But yeah, ideally if I knew a way to go inside the request and which payload is coming up.

francislainy.campos
2020-09-15 14:52
Before sharing, I'll delete some more things to see if can debug this way in case can find the solution perhaps.

wesleythomaswilliams
2020-09-15 14:57
FYI our bit of the same code looks like: ```@TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) void pactVerificationTestTemplate(PactVerificationContext context) { context.verifyInteraction(); }``` We don't add an auth token into the header

francislainy.campos
2020-09-15 14:58
Yeah, we need this bit otherwise we get a 403 here from our side.

francislainy.campos
2020-09-15 14:59
I think the issue we're facing with our calls is to do with date formatting.

francislainy.campos
2020-09-15 15:01
But changed another field now just for debugging purposes and I see this on the terminal.

francislainy.campos
2020-09-15 15:01
But this on Pact flow

francislainy.campos
2020-09-15 15:03
May want to double check with @matt.fellows again on whether there's any way to have the errors showing there please since this would probably be the feature that we'd be in need of the most here from our side to sign up to it I think.

wesleythomaswilliams
2020-09-15 15:05
What does your Pact DSL look like for this contract definition in the consumer test?

francislainy.campos
2020-09-15 15:06
```@ExtendWith(PactConsumerTestExt.class) public class PactConsumerTest { Map<String, String> headers = new HashMap<>(); String storeMeeting = "/vcservice/store/meeting"; DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); String nowAsISO = df.format(new Date()); @Pact(provider = VC, consumer = ED_UI) public RequestResponsePact createPact(PactDslWithProvider builder) { headers.put("Content-Type", "application/json"); headers.put("Accept", "application/json"); DslPart bodyStoreMeetingWithNoParticipants = new PactDslJsonBody() .numberType("id", 3) .stringType("title", "string") .integerType("duration", 0) .stringType("startDateTime", "2020-09-15T11:46:52Z") // .date("startDateTime", "yyyy-MM-dd'T'HH:mm:ss'Z'", new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(nowAsISO)); return builder .uponReceiving("A request to store/create a Zoom meeting") .path(storeMeeting) .method("POST") .headers(headers) .body( "{\n" + " \"title\":\"My title 2020-09-15T11:46:52Z\",\n" + " \"startDateTime\":\"2020-09-15T11:46:52Z\",\n" + " \"duration\":30,\n" + " \"provider\":\"ZOOM\",\n" + " \"participants\":[]\n" + "}" ) .willRespondWith() .body(bodyStoreMeetingWithNoParticipants) .toPact(); } @Test @PactTestFor(providerName = VC, port = "8080") public void runTest() { //Mock url RestAssured.baseURI = "http://localhost:8080"; RequestSpecification rq = RestAssured .given() .headers(headers) .when(); Response response5 = rq.body( "{\n" + " \"title\":\"My title 2020-09-15T11:46:52Z\",\n" + " \"startDateTime\":\"2020-09-15T11:46:52Z\",\n" + " \"duration\":30,\n" + " \"provider\":\"ZOOM\",\n" + " \"participants\":[]\n" + "}" ).post(storeMeeting); assert (response5.getStatusCode() == 200); } }```

francislainy.campos
2020-09-15 15:07
This is the most current debugging version.

francislainy.campos
2020-09-15 15:07
I'm commenting out and deleting fields but the structure is this one.

wesleythomaswilliams
2020-09-15 15:08
Although I can't see the problem. I'm wondering if you might get more joy switching to using the Pact matchers, so that you're not comparing json or data values directly.

wesleythomaswilliams
2020-09-15 15:09
Sorry I'm looking at the wrong bit

francislainy.campos
2020-09-15 15:09
I'm using the matchers for the body response, json only on the body params.

francislainy.campos
2020-09-15 15:10
No worries.

wesleythomaswilliams
2020-09-15 15:12
I'm confused by this part: ``` return builder .uponReceiving("A request to store/create a Zoom meeting") .path(storeMeeting) .method("POST") .headers(headers) .body( "{\n" + " \"title\":\"My title 2020-09-15T11:46:52Z\",\n" + " \"startDateTime\":\"2020-09-15T11:46:52Z\",\n" + " \"duration\":30,\n" + " \"provider\":\"ZOOM\",\n" + " \"participants\":[]\n" + "}" ) .willRespondWith() .body(bodyStoreMeetingWithNoParticipants) .toPact();``` You have two body entries

francislainy.campos
2020-09-15 15:13
It's a post call which receives a body with params to trigger the request (json fields) but responds with another body (bodyStoreMeeting), which is the DSL with the matchers.

wesleythomaswilliams
2020-09-15 15:15
Does it treat the two body statements differently, so that it knows one are params are one is the actual body of the post request? I've not had to handle a request like this, our params were query based.

francislainy.campos
2020-09-15 15:16
Yes, because one is part of the `uponReceiving` bit

wesleythomaswilliams
2020-09-15 15:16
Also, I notice there's no .status(XYZ), which may be intentional, but something you may want to be checking.

francislainy.campos
2020-09-15 15:16
And the other comes from the `willRespondWith`

wesleythomaswilliams
2020-09-15 15:17
You're teaching me something here, as I had no idea those two things were treated as parents and could each have body as a child.

francislainy.campos
2020-09-15 15:18
Yeah, learned this recently when the need to test this post api came up.

wesleythomaswilliams
2020-09-15 15:18
Our rest testing is all GET, most of the pact work we've done was messaging based.

francislainy.campos
2020-09-15 15:19
Also, about the status you mean the `given` bit that would connect to a `state`

francislainy.campos
2020-09-15 15:19
Or the status code?

francislainy.campos
2020-09-15 15:19
This is being handled on the assert part.

wesleythomaswilliams
2020-09-15 15:20
Ah yeah, I see, we've used .status(200) in the willRespondWith()

wesleythomaswilliams
2020-09-15 15:21
Just checking our matchers to see if there's something obviously different

francislainy.campos
2020-09-15 15:22
No worries, thanks. I can see my issue is on the date type and I'm looking into it now.

francislainy.campos
2020-09-15 15:22
expected="2020-09-15T16:20:39Z", actual="2020-09-15T11:46:52+0000",

wesleythomaswilliams
2020-09-15 15:22
Things we've done differently for date: ```.datetimeExpression("dateCreated", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")```

francislainy.campos
2020-09-15 15:23
My date is dynamic, so need to create it every day and then I parse it.

wesleythomaswilliams
2020-09-15 15:24
Ok, but it should always adhere to a format right and the actual value isn't important

francislainy.campos
2020-09-15 15:25
Yeah, I'm looking into the correct format. I'm sure I'll find it.

francislainy.campos
2020-09-15 15:26
Just this api is different to the other ones we had so not very consistent and then that's why the tests started to fail.

francislainy.campos
2020-09-15 15:26
At least know it now.

wesleythomaswilliams
2020-09-15 15:26
This is the first time I've looked at a pact test in about four months, so it's been useful to get my brain back in the space. :smile:

khazhak.vahanyan
2020-09-15 15:43
hello again. Is there a way to provide a custom "matching rule". I.e. modifying this directly. From the Java/JS APIs ```{ "body": { "$.key": { "matchers": [ { "match": "type" } ], "combine": "AND" } }```

giuseppe.salvatore
2020-09-15 18:37
Hi all

giuseppe.salvatore
2020-09-15 18:37
has anybody ever done contract testing with apigee as a proxy between providers and consumers?

giuseppe.salvatore
2020-09-15 18:37
I am not sure this scenario makes sense

vidya.garimella
2020-09-15 19:45
has joined #general


matt.fellows
2020-09-15 23:52
I?d be keen to hear. In my previous experience with Apigee, you can?t really unit test it, so that makes pact testing very hard already

matt.fellows
2020-09-15 23:53
Hopefully you?re not using all of the nasty transformation/orchestration stuff it can do - and if that?s the case, you could just ignore the proxy really and go straight to the target

matt.fellows
2020-09-15 23:53
what are you trying to achieve by adding a custom matching rule? as in, what would it do?

abubics
2020-09-15 23:54
Just in case it hasn't come up before . . . on the consumer side, the stdout logs are ok for telling you which tests failed, and usually the diff is ok ish . . . but the stacktrace is more of a side effect than an intentional or helpful debugging tool. There is usually a separate log file that has detailed interactions (e.g. requests and responses), but depending on the version, you may need to manually configure an output location before they're findable.


matt.fellows
2020-09-15 23:58
I see the 2 karma examples are 404, I?ll fix that now

bheemreddy181
2020-09-16 01:39
Do you have any documentation which will explain how openapi provider driven contract testing is used in what all use cases ?



bheemreddy181
2020-09-16 02:12
Looks like I need more reading around this probably a better use case where there several unknown consumers and users outside the org ?

young
2020-09-16 02:18
has joined #general

bheemreddy181
2020-09-16 03:14
@matt.fellows if you are doing any workshop for this please do let me know I am very much interested to understand this more

francislainy.campos
2020-09-16 04:05
Thank you. Is this log file autogenerated or do I create it myself under the resources folder? Would you have a sample for it perhaps?


stanleyawang
2020-09-16 06:10
has joined #general

stanleyawang
2020-09-16 06:22
hi all

stanleyawang
2020-09-16 06:22
I was looking through the documentation and I am trying to incorporate can-i-deploy as a tool for deploying to production ...

stanleyawang
2020-09-16 06:24
from the documentation it seems that we are supposed to deploy new provider version to prod that is compatible with current prod consumer version and new consumer version before deploying new consumer version to prod ...

stanleyawang
2020-09-16 06:24
what about a situation where my new provider version is not compatible with the current prod consumer version ?

tjones
2020-09-16 06:25
deploying this would break the consumers in production

tjones
2020-09-16 06:25
This is the kind of situation that `can-i-deploy` is designed to protect against

bethskurrie
2020-09-16 06:26
pact + can-i-deploy is intended to ensure that you are always backwards compatible with every integration every time you deploy.

stanleyawang
2020-09-16 06:27
thanks for the response ... how should i allow for a situation where i have new provider and new consumer that i want to deploy together where they are compatible with each other but either are not compatible with the old versions in prod ..

bethskurrie
2020-09-16 06:28
that's a coupled deployment that we suggest never doing.

bethskurrie
2020-09-16 06:28
a "distributed monolith"

bethskurrie
2020-09-16 06:29
but if you're going to do it, then turn off can-i-deploy

bethskurrie
2020-09-16 06:29
you won't be able to use it

tjones
2020-09-16 06:29
we recommend having at least one side able to speak to both of the other (eg the new consumer can speak to the old provider and the new provider, or vice versa)

stanleyawang
2020-09-16 06:30
ah ok that's a good tip .... ill bear that in mind ... thanks!

tjones
2020-09-16 06:30
but if you can't do this for practical reasons, then as beth says, disable can-i-deploy. It is designed to protect you from deployments where there might be broken contracts (even if only for the few minutes while you're deploying)

stanleyawang
2020-09-16 06:32
ok i guess that means for the first deployment ... it should be done without can-i-deploy... and only incorporate it in subsequent deployments ..

bethskurrie
2020-09-16 06:32
it's not ideal, but it's the only workable solution for your situation.

bethskurrie
2020-09-16 06:32
gotta be pragmatic!

tjones
2020-09-16 06:32
If appropriate, you might be able to treat it as a new consumer and new provider

stanleyawang
2020-09-16 06:33
ok noted thanks!

tjones
2020-09-16 06:33
because you can deploy a new provider without any currently deployed consumers

tjones
2020-09-16 06:35
can-i-deploy says "can I deploy this against what is in prod", and for the first provider deploy of a new provider, nothing will be in prod, so the answer is yes.

tjones
2020-09-16 06:36
this would only be appropriate if your new providers and new consumers were being stood up next to the existing ones

tjones
2020-09-16 06:36
if your situation is that you'll be replacing the old provider with the new one, then it's not appropriate.

tjones
2020-09-16 06:38
Even then, I still like Beth's pragmatic solution. If you know you are safe to live with a broken contract for the time the deploys take to both complete, then just turn it off.

francisco.moreno
2020-09-16 07:50
has joined #general

francisco.moreno
2020-09-16 07:52
Hi all from Spain!

abubics
2020-09-16 08:01
From memory, they come out in a `logs` directory, but I haven't been near pact on the JVM in a while . . .

abubics
2020-09-16 08:08
I can find an example from a JS consumer . . . the logs ended up in `pact/logs`. Perhaps I misremembered, but I was expecting to see logs like this . . .

francislainy.campos
2020-09-16 08:15
Thank you! Your answer and the docs sent by @matt.fellows worked for me. I have this now. :slightly_smiling_face:

francislainy.campos
2020-09-16 08:15
Super happy!

francislainy.campos
2020-09-16 08:16
```@VerificationReports(value = {"markdown"}, reportDir = "target/pacts/myreports")```

francislainy.campos
2020-09-16 08:16
Adding this line on top of my provider class worked did the trick for me.

francislainy.campos
2020-09-16 08:16
Thank you really very much.

matt.fellows
2020-09-16 08:18
That is really nice, I had no idea it existed!!

matt.fellows
2020-09-16 08:18
I?m going to add that to the examples, because it should be ?by default? I reckon!

francislainy.campos
2020-09-16 08:18
:slightly_smiling_face:

francislainy.campos
2020-09-16 08:19
Yeah, I think will save us soooo much time debugging issues. Game changer it feels.

francislainy.campos
2020-09-16 08:19
Great start for the day. :slightly_smiling_face:

matt.fellows
2020-09-16 08:19
I'm so glad to hear that!

matt.fellows
2020-09-16 08:20
Sorry for the pain, we are working on docs but it's a slow burn

francislainy.campos
2020-09-16 08:21
Not at all. You guys have been always great trying and helping through here and I appreciate the great work you've been doing putting this tool together.

francislainy.campos
2020-09-16 08:21
Well done you all.

giuseppe.salvatore
2020-09-16 08:23
Thanks @matt.fellows that helps. To be honest with you I was of the same opinion as there is no easy way to unit test the apigee proxy (which is kind of annoying on its own)

abubics
2020-09-16 08:31
Glad it's working for you now :confetti_ball: and you can get on with the real work~*:bananadance:

khazhak.vahanyan
2020-09-16 09:27
@matt.fellows I was thinking of hacking the anyArray functionality with `OR` combine rule(not sure if it's even possible). Read some of the code of the API, didn't notice any use of OR at the moment

khazhak.vahanyan
2020-09-16 09:35
but to be honest, I am just messing around at this point :smile:, as I like the project

christopher.lampert
2020-09-16 12:22
has joined #general

matt.fellows
2020-09-16 13:25
Give it a go, see what happens

matt.fellows
2020-09-16 13:25
It might work

matt.fellows
2020-09-16 13:26
Albeit, an "or" matcher is something we've discouraged. It was created for a use case but is generally regarded as unsafe

alvaro.gonzalezc
2020-09-16 14:29
has joined #general

jarmy
2020-09-16 22:07
Hi. Where can I find `http://au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient` from the example here? https://docs.pact.io/implementation_guides/jvm/consumer/junit/ I?ve got `au.com.dius.pact.consumer:junit:4.1.7` defined in my build.gradle but I?m not finding the above class

uglyog
2020-09-16 22:46
That is an example consumer client only, it is not exported in any JAR.



achuljyan
2020-09-17 10:47
has joined #general

mmotornyi.consultant
2020-09-17 11:40
has joined #general

mmotornyi.consultant
2020-09-17 11:42
Does anybody have an example of Koltin + Gradle project with contract tests?

mmotornyi.consultant
2020-09-17 11:45
Ok, I'll ask in JVM channel

saurabhapd
2020-09-17 15:20
has joined #general

saurabhapd
2020-09-17 15:26
Hi All, I am lookin to deploy dockerized pact broker with oauth2 support in my own ec2. I have deployed with basic auth, But now I want to do the same with oauth2 bearer token. I am thinking of using aws cognito. Any idea how to implement that?

chaitasi.patel
2020-09-17 23:05
has joined #general

matt.fellows
2020-09-17 23:29
Answered in #pact-broker

ravi.mijar
2020-09-18 00:59
hello General - https://docs.pact.io/documentation/provider_states.html is giving a 404. I landed on it from https://github.com/pact-foundation/pact-provider-verifier -> Features -> provider states.


matt.fellows
2020-09-18 02:28
thanks

sambitkumar.pal
2020-09-18 05:55
has joined #general

stelios.arakliotis
2020-09-18 10:14
has joined #general

thomas.hibbard
2020-09-18 15:30
has joined #general

sambitkumar.pal
2020-09-19 07:20
Can I trigger a webhook in local without using any CI server? In local provider and consumer contract test working fine. Please suggest.


bethskurrie
2020-09-19 07:21
I'm not sure what you mean by "in local"

bethskurrie
2020-09-19 07:22
If you mean, can you make your Jenkins server trigger a webhook in a Pact Broker instance that is running on your local development machine, then the answer is "not unless you really know what you're doing".

bethskurrie
2020-09-19 07:23
You'd need to make sure your broker IP was accessible to the Jenkins machine, and that the pact broker was mounted on port `0.0.0.0` so that is externally accessable.

sambitkumar.pal
2020-09-19 07:23
Ys local means my development machine where I have pack broker and postgress

bethskurrie
2020-09-19 07:23
However, there are generally a bunch of internal firewalls and security software running that make this difficult.

bethskurrie
2020-09-19 07:24
You need to be very specific when you ask questions to get the most helpful answer.

bethskurrie
2020-09-19 07:24
I was able to guess what you meant, but it is not at all clear from your question what you meant.

sambitkumar.pal
2020-09-19 07:25
Is there any way to verify consumer and provider with webhook without using jekin or CI server?

bethskurrie
2020-09-19 07:25
Yes.

bethskurrie
2020-09-19 07:26
it's just more complex

bethskurrie
2020-09-19 07:26
let me see if I can find the docs

sambitkumar.pal
2020-09-19 07:26
Plz let me know ...I am trying the same


bethskurrie
2020-09-19 07:27
You need to run the provider verification tests from within the consumer pipeline.

bethskurrie
2020-09-19 07:29
consumer pact tests -> publish pact -> provider verification tests -> can-i-deploy -> deploy

bethskurrie
2020-09-19 07:30
It sounds like you're doing a proof of concept. You can always use a free Pactflow account for your experiment, as Jenkins should be able to contact the Pactflow host.

sambitkumar.pal
2020-09-19 07:31
Ys. Doing a POC.

sambitkumar.pal
2020-09-19 07:34
But need in my development machine where I have already pact broker

sambitkumar.pal
2020-09-19 07:38
In this case what should be my URL in request?

bethskurrie
2020-09-19 07:39
In which case, and what URL request?

bethskurrie
2020-09-19 07:39
You need to be very specific with your questions to get a helpful answer.

bethskurrie
2020-09-19 07:41
Can I suggest you do the CI/CD workshop? https://docs.pactflow.io/docs/workshops/ci-cd/

sambitkumar.pal
2020-09-19 07:41
The scenario I am discussing here is " Is there any way to verify consumer and provider with webhook without using jekin or CI server"

bethskurrie
2020-09-19 07:42
You can run the tests from your local machine

bethskurrie
2020-09-19 07:42
but you can't do the webhook part

sambitkumar.pal
2020-09-19 07:43
So I trigger a code snippet from library where provider, event, request , body I passed

matt.fellows
2020-09-19 07:43
Sambit maybe if you can explain what you're trying to achieve? You seem to be focussed on webhooks, but if you explain what you're trying to achieve that would help in answering

matt.fellows
2020-09-19 07:44
Howtolearn

2020-09-19 07:44
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

matt.fellows
2020-09-19 07:44
You might find these workshops helpful for learning the full proxess

sambitkumar.pal
2020-09-19 07:44
I need webhook with pact broker

bethskurrie
2020-09-19 07:46
Please go through one of the workshops and come back to us if you have any more questions after that. I recommend getting a free Pactflow (which is a Pact Broker) account and doing the CI/CD workshop.

sambitkumar.pal
2020-09-19 07:46
I already wrote provider and consumer contract test which is working fine and passes showing in pack broker.. Now I want use webhook

bethskurrie
2020-09-19 07:47
In this step of the workshop I mentioned, it explains how to set up a webhook https://docs.pactflow.io/docs/workshops/ci-cd/set-up-ci/configure-webhook/

bethskurrie
2020-09-19 07:48
In the instructions, Travis is similar to Jenkins

sambitkumar.pal
2020-09-19 07:49
Ok. Let me check the workshops.

sambitkumar.pal
2020-09-19 07:56
One doubt... Can I use webhook in Codefresh ?

sambitkumar.pal
2020-09-19 07:58
As u suggested jenkin, Travis... Can I use pact broker webhook in CodeFresh?

sambitkumar.pal
2020-09-19 08:21
How to configure webhook in Codefresh?

matt.fellows
2020-09-19 08:28
I don't know code fresh that well, you'd have to see if code fresh has an API. If it does then yes

sambitkumar.pal
2020-09-19 08:46
Yes..codefresh has API to integrate other applications

matt.fellows
2020-09-19 08:56
I haven't seen any code fresh examples, you'll have to find an example from another ci and adapt to codefresh's API

sambitkumar.pal
2020-09-20 05:03
How to integrate webhook with codeFresh?

sambitkumar.pal
2020-09-20 05:04
Is there any plugin to add or any other process ?

matt.fellows
2020-09-20 05:07
We already answered this yesterday. There is no plugin or native integration I'm sorry

matt.fellows
2020-09-20 05:08
The webhook is just an http request. find out what http request needs to be sent to codefresh to trigger a build and that's what goes into your webhook

matt.fellows
2020-09-20 05:14
See also howtoask

2020-09-20 05:14
Please see this page for some tips on how to ask for help to get the best response from the community https://docs.pact.io/help/how_to_ask_for_help

bethskurrie
2020-09-20 07:33
I've created an example consumer that uses a "webhookless pipeline". It does this by checking out the provider codebase and running the verifications as part of the provider build. This can be handy if you are unable to use webhooks because of firewalls. https://github.com/pactflow/example-consumer-webhookless

bethskurrie
2020-09-20 07:33
@antonello perhaps you could give us some background on why this flow was preferable for your teams?

amicicristiano
2020-09-20 14:16
has joined #general

bethskurrie
2020-09-20 20:41
Ugh, that was supposed to be "as part of the consumer build" :man-facepalming:

antonello
2020-09-20 20:54
Just seems this. I?ll reply tomorrow :)

christiaan
2020-09-21 08:42
has joined #general

antonello
2020-09-21 11:34
The main driver for us was that we wanted to have a way to get fast feedback and completely prevent a consumer team from breaking the pipelines of the providers by publishing a pact that would lead to provider tests failing. Our approach at the moment is very similar to what @bethskurrie has outlined: ? Consumer publishes pact to the pact broker in its pipeline ? We find that latest `master` and `prod` tagged versions of the providers ? We check if the the new pact is already pre-verified by those versions ? If it?s not pre-verified, we clone the providers and checkout the commit pointing to latest `master` and/or `prod` tagged provider versions. ? We run the required provider tests against the published pact We also do a cross branch verification based on convention, i.e. if there is a provider branch that matches the feature branch of the consumer, we run the provider verification tests for the matching provider branch. We do this both for consumers that are built in GitlabCI (using their multi-project triggers) and in Jenkins. I realise that some of these things could be achieved with a mix of using webhooks and other CI hooks + the new Pending Pacts and WIP Pact functionalities. However, we?ve found the management of webhooks a bit cumbersome. Moreover, being able to see failing provider tests in the consumer?s pipeline has led to an increase in collaboration between consumer and provider developers and a better awareness of how to handle sequencing of merges to master and releases to production. The end game - if we get there - is to let providers publish small test artifacts that consumers can use to run the the provider tests without having to clone, checkout and compile.

christopher.lampert
2020-09-21 11:35
Hi all, I am working on a team who are a provider and we are looking at setting up a webhook to trigger a verification when the content of contracts change. Based on the documentation I know this verification should sit outside the teams usual build pipeline as a task to verify the specific contract. The question I have is, what version of the provider should I be verifying this contract against? The reason I ask is because the we (the provider team) are doing mainline development so sometimes the code in our master branch might be ahead of what is for example in our production environment and therefore verifying against non-production code could lead to giving the consumer team false confidence that their changes are compatible with what is in production with any verifications we do. The documentation (at least from what I can tell) doesnt give any clear guidance as to what version I should be verifying against at this point

antonello
2020-09-21 11:54
Something that I would like to add is around this point you made in the readme, @bethskurrie > The downside of this flow is that it requires the consumer to have access to the provider code, and understand how to execute the tests. In our case, we have addressed this issue by creating a generic script that all providers need to implement. The script invokes `describe-version` and `can-i-deploy` , does the clone and checkout, and runs the require `maven command`. The script takes some environment variables like `CONSUMER_TAGS`, `PROVIDER_TAG` , etc. Now, the beauty is that the core logic is in a shared, published script, so the individual providers just ned to import it and implement a very lightweight wrapper.

matt.fellows
2020-09-21 14:28
I normally run it against the master branch of my code because if you're doing CD it almost always == production. if you're advanced enough and there is a delay, you could run against the prod version also

matt.fellows
2020-09-21 14:30
You want the webhook to give you confidence to merge your consumer code into mainline at which point you'll eventually run a can-i-deploy check to deploy to prod. So whatever the mainline is of the provider is a good start

christopher.lampert
2020-09-21 14:31
Yeah, so there is a delay, which was was my concern but yes production version was my thought process too. Appreciate the guidance, sounds obvious but people like to be sure this is the best practice so wanted to reach out to the community.

christopher.lampert
2020-09-21 14:32
Thanks for getting back to me! :slightly_smiling_face:.

ctelles
2020-09-21 18:59
has joined #general

brian.jin
2020-09-21 19:31
has joined #general

richardwb
2020-09-21 20:06
has joined #general

bethskurrie
2020-09-21 22:08
@christopher.lampert you can read the docs about that situation here: https://docs.pact.io/pact_nirvana/step_8

abubics
2020-09-21 23:55
:taco: for @matt.fellows

abubics
2020-09-21 23:55
and :taco: for @bethskurrie

abubics
2020-09-21 23:56
for just always being there :innocent:

kflo
2020-09-22 01:08
has joined #general

aaron.ramirez
2020-09-22 03:35
has joined #general

antonello
2020-09-22 06:19
@bethskurrie Any reason why in your example you?re only verifying against provider master?

matt.fellows
2020-09-22 07:03
I like the idea of a _contract_ for a build. It?s one of the main reasons why having a consistent interface to executing a CI pipeline is so powerful, and why Docker is so bloody useful

antonello
2020-09-22 07:26
Would a blog post on this be useful? I keep promising myself that I would like to write some blog posts, but then never do... this could be the first one in ages...

matt.fellows
2020-09-22 07:40
I think so

matt.fellows
2020-09-22 07:41
I mean, it would be great

matt.fellows
2020-09-22 07:41
I?ve been thinking of creating a ?recipes? page on our docs for a while, I think this would be a good example recipe

ajayarooon
2020-09-22 07:54
has joined #general

christopher.lampert
2020-09-22 08:50
Thank you both! :smile:

christiaan
2020-09-22 11:58
Hi all, newbie here, still in the grasping the concepts phase. I have a question about "provider states" after reading this page: https://docs.pact.io/implementation_guides/ruby/provider_states/. That page suggests that I should in the "setup phase" on provider side "create a thing here" using a framework of choice and I quote (" # eg. Sequel.sqlite[:somethings].insert(name: "A small something")" Do I understand that it is expected of me to inject data directly in the actual backend where my provider api is connecting to? If this is indeed the case how do I know that this backend is not being "updated/changed" by another test at the same time? Does this not defeat the idea to run tests in isolation? Do I understand correctly that I have to take measures to make sure that the provider pact test currently run is the only one running at the moment against the backend?

2020-09-22 14:19
A new post has been created in *Feature Requests*

jan.krejci
2020-09-22 14:21
Hi guys, I have been struggling to get more and more adopter for using PACT because we really see a cost benefit by using it. However, there is certain scenarios as *External integrations* (Providers) that it ends up to be a challenging because of all considerations described https://docs.pact.io/getting_started/what_is_pact_good_for/#what-is-it-not-good-for . So, my question is more to understand how you guys are solving this issue mostly. Like using VCR, mock server or even using Pact itself.

skarki
2020-09-22 14:48
has joined #general

tyler.mehr
2020-09-22 16:56
has joined #general

tyler.mehr
2020-09-22 18:21
Hello, I'm getting the following error on Windows 10. There doesn't seem to be any other log info for this. I have attempted to fix it by shortening the path, but it did not fix the issue: [2020-09-22T17:03:19.295Z] INFO: pact-node@10.10.1/13152 on <computer_name>:     Creating Pact Server with options:     {"consumer":"MobileApp","cors":false,"dir":"C:\\app_dir\\app_proj\\app\\pacts","host":"localhost","log":"C:\\<app_dir>\\app_proj\\app\\logs\\pact.log","pactFileWriteMode":"overwrite","provider":"AppProvider","spec":2,"ssl":false} [2020-09-22T17:03:19.317Z] INFO: pact-node@10.10.1/13152 on <computer_name>: Publishing Pacts to Broker [2020-09-22T17:03:19.317Z] INFO: pact-node@10.10.1/13152 on <computer_name>: Publishing pacts to broker at: http://localhost:8500 [2020-09-22T17:03:25.263Z] WARN: pact-node@10.10.1/13152 on <computer_name>: Pact exited with code 1. [2020-09-22T17:03:25.264Z] ERROR: pact-node@10.10.1/13152 on <computer_name>:     Could not publish pact:    PactBroker::Client::Error - No pact files found     [2020-09-22T17:03:26.262Z] INFO: pact-node@10.10.1/13152 on <computer_name>: Pact running on port 64710   Error: Couldn't start Pact with PID: 4320      at Timeout._onTimeout (C:\app_dir\app_proj\app\node_modules\q\q.js:1846:21)    at listOnTimeout (internal/timers.js:551:17)    at processTimers (internal/timers.js:494:7) Error: Couldn't start Pact with PID: 4320      at Timeout._onTimeout (C:\app_dir\app_proj\app\node_modules\q\q.js:1846:21)    at listOnTimeout (internal/timers.js:551:17)    at processTimers (internal/timers.js:494:7)

francislainy.campos
2020-09-22 18:22
Hi, I think ideally you'd have control of your data, with your own pact users or something like this so that other tests wouldn't affect the response you're getting. You could also do some clean up wiping out data that you don't need before the pact test is executed.

matt.fellows
2020-09-23 01:47
:wave: looks like you?re using #pact-js ? Maybe jump in there to see

matt.fellows
2020-09-23 01:47
Are you trying to publish a pact or run a consumer test?

matt.fellows
2020-09-23 01:47
Are there files in the pact dir?

aforeman
2020-09-23 05:01
:wave: Hi *Got a spare 15 minutes :watch: to complete a survey about Pact?  If you need a little sweetener :lollipop: read on!* Alicia here, Pactflow?s new Product Marketing Manager :woman-raising-hand: to ask you to complete a max 15 minute survey to share how you use Pact and the difference it has made to how you test and deploy. In return, you can score a *free lifetime upgrade of users and contracts on all Pactflow plans* :ok_hand: I?m also able to disclose that there?s a Pact Community Day in the works  :tada: and that the survey will also capture feedback about what you want to hear and from who! See more about the Pactflow lifetime upgrade and complete the survey here: https://forms.gle/xXmwf4SpAVPTKAtB7  The survey closes midnight Sunday 4 October AEST. Thank you in advance!

florian.nagel
2020-09-23 06:16
The survey had a good flow to it! Good job @aforeman Here's a taco :taco:

aforeman
2020-09-23 06:18
Thanks for the feedback @florian845! Looking forward to reading your responses :smile: I appreciate the taco, thanks :raised_hands:

jeanlucc
2020-09-23 06:22
Personally I run dedicated fixtures for this state, the instance on which tests run is a dedicated docker so there are no other interactions and I run the ?whole? HTTP request in a DB transaction that is rolledback between requests so that tests do not influence each other?s. I borrowed the idea and code for transaction to my integration tests. Since it?s a PHP backend I use the dama doctrine test bundle https://packagist.org/packages/dama/doctrine-test-bundle I?m not sure if what I describe here is a good solution though.

yann.courtel
2020-09-23 07:05
has joined #general

de_breno
2020-09-23 07:52
has joined #general

a.smith
2020-09-23 08:42
Welcome @aforeman! :wave:

alexle
2020-09-23 10:59
has joined #general

matt.fellows
2020-09-23 11:34
@christiaan just in case it?s not clear in the docs, provider states are to deal with the situation where you might normally first perform a series of setup actions in order to actually run your test. Classic example: Getting a user. In an end-to-end integrated test you?d do this: 1. Post to `POST /users {?}` and get a `20x` 2. The run `GET /users/1` and expect a `200` We don?t like these kinds of tests, because the _consumer_ is trying to set things up. But if user 1 already exists and you ran step (1), it would cause a failure in your test run. So now you put a gaurd in to protect that situation. But what if the data doesn?t match? This is the whole mess of integrated tests. Your integrated test suite becomes as complex as your actual app. Pact does it this way: 1. Consumer writes a test, and put?s an annotation against it stating its expectations for the provider to be able to run the test e.g. `where user ID 1 exists` . This is the ?provider state? 2. Consumer writes a test for the `GET /users/1` endpoint with its own local mock data and it should always pass, because it?s a unit test Later on, when the provider test runs: 1. Pact will see the state annotation and pass it to the provider test to say ?please get yourself into a state such that you can respond with user id 1`. This is where you would either a) dynamically setup the state or b) use a pre-canned fixture known to support all states 2. Pact runs the `GET /user/1` against the provider Everyone is happy, because you didn?t need to manage an end-to-end test environment to do it

aforeman
2020-09-23 11:51
Thanks @a.smith :slightly_smiling_face:

adrianojedabenitez
2020-09-23 12:47
has joined #general

begovic.malik
2020-09-23 13:03
has joined #general

joel.whalen
2020-09-23 14:01
some feedback: The definition of ?Before pact? and ?after pact? isn?t very clear. Like we have been working on pact for months now, but haven?t seen a difference in how we work yet due to the whole process taking a long time to implement

sambitkumar.pal
2020-09-23 16:32
Hi, I have triggered webhook which is building the provider contract and build is successful. Pact contract passed but the webhook is going on retrying. When I checked webhook error log, its showing " *Error executing webhook Xw_2o3EfCQ5BSbB4wfs3uQ Net::ReadTimeout -Net : : ReadTimeout with #<TCPSocket:(closed)>* Please let me know on this. It will really helpful if someone help me on this. Thanks in advance.

phillip.lo
2020-09-23 16:39
Hey, not sure if anyone else came across this issue when trying to run the broker locally without docker but I was getting errors trying to install thin ```Building native extensions. This could take a while... ERROR: Error installing thin: ERROR: Failed to build gem native extension.``` Apparently this is a known issue https://github.com/macournoyer/thin/issues/370 This worked ```gem install thin -- --with-cflags="-Wno-error=implicit-function-declaration"``` Not sure if its worth adding to the docs but just thought I'd give people a heads up Edit: realized I should have posted this in the pact-broker channel but I can't delete messages here so I'll just leave it to the pact team to decide what to do :grinning:

phil.endsley
2020-09-23 16:42
The error seems pretty self explanatory. Looks like your webhook is timing out when trying to execute

sambitkumar.pal
2020-09-23 17:29
Ys. That is clear. But that is coming because Failed to open TCP connection to host url.. That I found now. Can you please let me know what should be host URL when pact broker is running through docker compose file. And I am triggering from local system.

phil.endsley
2020-09-23 17:32
Is this a webhook defined in pact broker? Or a webhook in a CI pipeline?

sambitkumar.pal
2020-09-23 17:34
Webhook defined in pact broker

phil.endsley
2020-09-23 17:42
Is the thing your webhook is calling also running on your local machine?

phil.endsley
2020-09-23 17:44
And if so, are you using localhost for the webhook definition? Trying to understand what the actual problem is, since none of those details are provided

sambitkumar.pal
2020-09-23 17:49
Ys locally I have a small rest controller application which will trigger provider build when webhook will trigger. The request URL is working to call that application and provider build successful with respect to the consumer. Contract pass I can see in Last verify column of pact broker. Then webhook status is going on retrying.

phil.endsley
2020-09-23 17:55
Just to re-iterate, this is not a pact issue. This is a common thing to be aware of when using containers. If you reference localhost within a container (which is what you're doing since pact broker is running in a container), that's referring to the container itself. You need to point to your machine's ip address instead if everything is running locally. 127.0.0.1 will _probably_ work (So if your webhook is http://localhost:8080/some/url, try http://127.0.0.1:8080/some/url). If not, I would suggest reading up on docker containers and networking with them, and reaching out to a docker community if you're still looking for help.

sambitkumar.pal
2020-09-23 18:02
If you will see the log I gave its not local host. Its to pass through the docker. And its passing and running the build for provider. But again same URL is failing. My question is , if its allowing in webhook request URL to trigger the build then why after successful build its failing. Plz let know.

christiaan
2020-09-23 18:06
First, thanks all for your clarification and suggestions. This is becoming much clearer now.

sambitkumar.pal
2020-09-23 18:20
My webhook request which is working fine with the given url and making provider build successful . post build webhook is showing same URL as issue.

phil.endsley
2020-09-23 18:29
> If you will see the log I gave its not local host. My mistake...I saw the webhook context base url Your contract_content_changed webhook is using the same url? Is it correctly triggering a build, and the webhook status shows failed?

phil.endsley
2020-09-23 18:39
> My question is , if its allowing in webhook request URL to trigger the build then why after successful build its failing. Sorry, I think there's a slight language barrier :slightly_smiling_face: Your webhook is running, and triggering a build as you would expect, but it shows as failed. Is that correct?

phil.endsley
2020-09-23 19:16
If this is the case, I would guess that the service you're calling in your webhook is taking longer than the timeout

adrianojedabenitez
2020-09-23 19:29
hey guys, thanks a lot in advance :grimacing: Sorry to bother you, but not finding any documentation about this. I have created a POC with gitlab, Java (spring) as provider and a pact-js consumer. I?m triggering a webhook when the contract changes (as per ci/cd workshop) but I?m facing with the next issue. Let?s say backend side has 7 different classes in charge of verification tests. If I configure the webhook to be triggered when, i.e ?dogs? pact changes, considering I?m using junit it makes sense that the webhook call a job that runs `mvn test` command. The issue is, since I already have the pact url, I want to run *only* on the class that contains the ?dogs? states, but mvn clean test will run all the contracts and will fail with the contracts states that don?t match with the pact url. What I?m doing now is parsing the pact url to retrieve the provider name, , i.e dogs_service_provider, I get the dogs name and same to retrieve the consumer. I do something like this `mvn -Dpactbroker.enablePending=true -Dpact.verifier.publishResults=true -Dpact.filter.pacturl=$CONTRACT_URL -Dpact.filter.consumers=$CONSUMER -Pcicdprofile -Dtest=?$CLASS_NAME*ContractVerificationTest? -DfailIfNoTests=false clean test` but is making me noise, is there a better way to handle the scenario described above? this tool looks promising for my company!

antonello
2020-09-23 20:08
Hi Adrian. Just to clarify. Is this one consumer / one provider? What is ?dogs? in this case?

adrianojedabenitez
2020-09-23 20:24
yup, one consumer and one provider, I used dog just as example. The provider name could be dogs_service_provider and the consumer dogs_consumer. I have the pact url but when I run mvn test will run CatsContractTest, RabbitContractTest and so on, I would like to run only DogsContractTest class since that is the class with the states and the pact between dogs_service_provider and dogs_consumer

antonello
2020-09-23 20:27
But you have only one provider and one consumer you said.

adrianojedabenitez
2020-09-23 20:44
no no sorry, I didn?t get it, what I wanted to say is that I want to handle only one provider and one consumer (the provider that was triggered by the web-hook) but on the backend for sure I have multiple providers and all of them are being executed when I call ?mvn test? and that is what I want to avoid

adrianojedabenitez
2020-09-23 20:45
in fact I need to avoid it because I?m getting errors when the others providers are executed

antonello
2020-09-23 20:48
So you have one big Java application with multiple providers. Correct?

adrianojedabenitez
2020-09-23 20:48
exactly!

antonello
2020-09-23 20:49
Do the different providers live inside the same module or different modules?

adrianojedabenitez
2020-09-23 20:50
same module, in fact same folder but each provider has a different business rules.

antonello
2020-09-23 20:51
Are you sure you want different providers? It sounds like it should be one provider. It?s the same service.

adrianojedabenitez
2020-09-23 20:53
do you think is a good practice have only one provider for everything? I spitted in different classes because they handle different business rules and I don?t want to mix it the class will grow a lot

antonello
2020-09-23 20:56
I can?t say without understanding the details, but I think you might be making things difficult for yourself by introducing multiple providers for what seems to be just one service.

adrianojedabenitez
2020-09-23 20:57
I see, but do you have some example link or doc to see how multiple providers should work?

antonello
2020-09-23 20:59
Anyway, that said, imho you have two routes: ? the one you identified already ? use a test filter based on some kind of naming convention

antonello
2020-09-23 21:00
I don?t think you?d find examples, as I don?t think that?s how it?s meant to be used.

adrianojedabenitez
2020-09-23 21:02
I see, thanks a lot for your time! really appreciate it!

antonello
2020-09-23 21:05
My pleasure!

phil.endsley
2020-09-23 21:55
If you need to stick with that structure, maybe custom maven targets (goals? I know maven has its own word for it) that do the filtering for you? Then configure your webhook to call the appropriate target.

mbbush
2020-09-23 22:16
has joined #general

adrianojedabenitez
2020-09-23 22:56
wow! to be honest I haven?t used this before, but will take a look, awesome tip @phil.endsley thanks a lot!!


adrianojedabenitez
2020-09-23 23:01
for some reason I was using https://docs.pact.io/implementation_guides/jvm/provider/junit5spring but will take a look it! :man_dancing:

uglyog
2020-09-23 23:03
Oh, with Junit. Let me check. I think it should still work, but might need an annotation


uglyog
2020-09-23 23:05
I think that will also work with JUnit 5. Let me know if it doesn't

matt.fellows
2020-09-23 23:56
:taco: for @uglyog

matt.fellows
2020-09-23 23:56
:taco: for @phil.endsley

aforeman
2020-09-24 00:24
Good feedback, thanks @joel.whalen - for the purpose of the survey, if you are yet to see changes, you can log the same response to before and after Pact - in the final 'anything else' question at the end of the 'with Pact' section, you can make note of the time to see results. Hope this helps.

wilkinsweiqiangliang
2020-09-24 01:12
has joined #general

wilkinsweiqiangliang
2020-09-24 01:13
Hey guys, does pact work with javascript consumer and java provider? I had experienced body mismatch issue

wilkinsweiqiangliang
2020-09-24 01:17
``` 1.1) BodyMismatch: $.data.0.id BodyMismatch: Type mismatch: Expected Map {"json_class":"Pact::SomethingLike","contents":"da16494a-303a-463c-919a-e29e03a5b1de"} but received String 'c6ef2915-75e8-4570-81be-cb45684eefb6' -{ - "json_class": "Pact::SomethingLike", - "contents": "da16494a-303a-463c-919a-e29e03a5b1de" -} +"c6ef2915-75e8-4570-81be-cb45684eefb6"```

uglyog
2020-09-24 01:26
`"json_class":"Pact::SomethingLike"` means your pact file is not correct. This is an issue with your consumer test.

wilkinsweiqiangliang
2020-09-24 01:27
um? i follow the documentation. let me share my test

uglyog
2020-09-24 01:27
@matt.fellows how does the Ruby matchers get resolved? They shouldn't be in the body

wilkinsweiqiangliang
2020-09-24 01:28
```describe("getting all products", () => { test("products exists", async () => { // set up Pact interactions await provider.addInteraction({ state: 'products exist', uponReceiving: 'get all products', withRequest: { method: 'GET', path: '/v1/products' }, willRespondWith: { status: 200, headers: { 'Content-Type': 'application/vnd.api+json' }, body: { data: eachLike({ id: like("da16494a-303a-463c-919a-e29e03a5b1de"), type: "product", ... }```

wilkinsweiqiangliang
2020-09-24 01:28
```import {Pact, Matchers} from "@pact-foundation/pact"; const { like, eachLike, integer, regex,string, boolean, rfc3339Timestamp } = Matchers```

matt.fellows
2020-09-24 01:28
can you please share the generated pact file?

wilkinsweiqiangliang
2020-09-24 01:28
sure

matt.fellows
2020-09-24 01:29
> @matt.fellows how does the Ruby matchers get resolved? They shouldn?t be in the body Ruby magic?

wilkinsweiqiangliang
2020-09-24 01:31
```{ "consumer": { "name": "TeamView" }, "provider": { "name": "ProductAPI" }, "interactions": [ { "description": "get all products", "providerState": "products exist", "request": { "method": "GET", "path": "/v1/products" }, "response": { "status": 200, "headers": { "Content-Type": "application/vnd.api+json" }, "body": { "data": { "json_class": "Pact::ArrayLike", "contents": { "id": { "json_class": "Pact::SomethingLike", "contents": "da16494a-303a-463c-919a-e29e03a5b1de" }, "type": "product" }, "min": 1 }, "meta": { "totalResourceCount": { "json_class": "Pact::SomethingLike", "contents": 0 } } } } }, { "description": "get all products", "providerState": "no products exist", "request": { "method": "GET", "path": "/v1/products" }, "response": { "status": 200, "headers": { "Content-Type": "application/vnd.api+json" }, "body": { "data": [ ], "meta": { "totalResourceCount": 0 } } } } ], "metadata": { "pactSpecification": { "version": "1.0.0" } } }```

matt.fellows
2020-09-24 01:32
Yeah that?s definitely wrong.

matt.fellows
2020-09-24 01:32
What version of pact are you on?

matt.fellows
2020-09-24 01:32
Looks like the spec is set to `1.0.0` . that?s probably a mistake

matt.fellows
2020-09-24 01:32
We have to use Ruby class-like structures to send to the mock service which generates the pact file. I?ve seen this before, but on very old versions of the library

wilkinsweiqiangliang
2020-09-24 01:32
``` "dependencies": { "@pact-foundation/pact": "^9.12.0",```

matt.fellows
2020-09-24 01:33
ok so that?s fairly new

matt.fellows
2020-09-24 01:33
what does your `Pact(..)` constructor look like?

matt.fellows
2020-09-24 01:33
just check that the specification is set to `2` or just omit it altogether

wilkinsweiqiangliang
2020-09-24 01:33
in java side is 4.1.2 ``` testCompile "au.com.dius.pact.provider:junit5:$pactVersion" testCompile "au.com.dius.pact.provider:spring:$pactVersion" testCompile "au.com.dius.pact.provider:junit5spring:$pactVersion"```

matt.fellows
2020-09-24 01:33
thx

matt.fellows
2020-09-24 01:33
this looks like a JS side issue, JVM is confused by the bad pact

wilkinsweiqiangliang
2020-09-24 01:34
ah from the constructor i set the spec to `1`

wilkinsweiqiangliang
2020-09-24 01:34
```const provider = new Pact({ consumer: 'TeamView', provider: 'ProductAPI', log: path.resolve(process.cwd(), 'logs', 'pact.log'), logLevel: "warn", dir: path.resolve(process.cwd(), 'pacts'), spec: 1 });```

wilkinsweiqiangliang
2020-09-24 01:34
which was 2 before

matt.fellows
2020-09-24 01:34
why did you do that?

wilkinsweiqiangliang
2020-09-24 01:36
i didnt find the definition from pact docs. playing around to see the difference

matt.fellows
2020-09-24 01:36
ah ok. For now, set it back to 2 and see where that gets you.

matt.fellows
2020-09-24 01:37
We may need to deprecate / prevent that from actually being set - because 1 clearly isn?t creating valid pacts (and to be honest, all pact libraries support 2+ anyway)

wilkinsweiqiangliang
2020-09-24 01:38
good to know

uglyog
2020-09-24 01:39
Now you know what version 1 does :smile:

wilkinsweiqiangliang
2020-09-24 01:42
yea now i know. Thanks. pact file looks more promising now.

sambitkumar.pal
2020-09-24 01:47
Sorry. The service is running successful. I mention in the log that its timeout bcz failed to open TCP the URL I passed in webhook. That is confusion. Where same URL hit I'd working and then post success the same URL timeout. Can you please let me know what its trying after provider successful build.

matt.fellows
2020-09-24 01:48
The error looks really clear to me. From the pact broker instance, it cannot open a connection to that host

matt.fellows
2020-09-24 01:49
shell into the docker container, and see if you can run something like a `telnet host.docker.internal 8080`

matt.fellows
2020-09-24 01:49
or even just do `host host.docker.internal`to see if it can resolve the domain

sambitkumar.pal
2020-09-24 01:52
Yes u r correct. But its triggering the build with same URL. How that is happening is a surprise for me.

sambitkumar.pal
2020-09-24 01:54
After provider build successful its showing contract passed and webhook status retrying (again triggering build)

francis.lobo
2020-09-24 01:55
Hello folks, I have a newbie question. I am puling the pact-broker docker image from https://hub.docker.com/r/dius/pact-broker/ looks like it does not have the latest PR. I specifically need this change : https://github.com/pact-foundation/pact_broker/pull/344 Do I need to build my own docker image to get this? or need to wait for someone to update the image on docker hub?

bethskurrie
2020-09-24 01:56
We recommend using the pact-foundation one @francis.lobo

francis.lobo
2020-09-24 01:58
Thanks for the reply @bethskurrie I double checked my configs. I am indeed pulling it from pactfoundation/pact-broker

bethskurrie
2020-09-24 01:58
Note that the base URL does not change where it's actually mounted within the container



bethskurrie
2020-09-24 02:00
But like I said, it won't change where it's mounted within the container. It's used when you mount the container at a particular URL externally.


francis.lobo
2020-09-24 02:10
ah! sorry I mixed up the commit I was looking for. I was looking for a docker image with this commit https://github.com/pact-foundation/pact_broker/commit/ecbac9a688e90b7385f1376b901951c2719baff8 will a `docker pull pactfoundation/pact-broker` get me a container with this change?

bethskurrie
2020-09-24 02:11
nope, I'm about to release it.

bethskurrie
2020-09-24 02:11
give me a minute

francis.lobo
2020-09-24 02:11
awesome thanks for that :thumbsup:

sambitkumar.pal
2020-09-24 02:37
One more update on this .after my webhook trigger the provider build, if build fail then webhook status is coming as success . but if provider build is scuess then webhook status retry where its failing to connect and timeout in log.

matt.fellows
2020-09-24 02:40
the webhook status has nothing to do with the build passing or failing - it is simply ?did the webhook get a success response from the target?. It?s obviously getting a `2xx` status when it triggers a build.

phil.endsley
2020-09-24 02:44
Does the service your webhook calls wait until the build finishes to return the status? If so, how long do your builds take? It still sounds like a timeout issue...but I think this is as far as I can help troubleshoot... If the webhook calls a "start the build and return immediately", I don't have any more suggestions

sambitkumar.pal
2020-09-24 02:47
Ys.. Webhook calls the service and wait until build return status. Build took 01.37 min. If build fails also same time.

matt.fellows
2020-09-24 02:48
ok so that makes sense

matt.fellows
2020-09-24 02:48
when the webhook executed correctly, the build finished in time.

matt.fellows
2020-09-24 02:48
when the webhook failed, the build is still running and maybe it passed

matt.fellows
2020-09-24 02:49
the red build probably didn?t take as long, because it didn?t get all of the way through

matt.fellows
2020-09-24 02:49
I would highly recommend not having the webhook ?wait?. That?s not what they?re for, really

matt.fellows
2020-09-24 02:49
verification results should be sent back to the broker from your build - that?s how you communicate a break in the contract. Not vvia a webhook

phil.endsley
2020-09-24 02:49
Right. The verification results are still published back to the broker, because that happens during the provider build process, and is not dependent on the actual webhook. Which is why you see one succeed and the other fail

matt.fellows
2020-09-24 02:50
good pickup Phil

sambitkumar.pal
2020-09-24 02:50
Fail build and success build nearly same time . that I saw now.

sambitkumar.pal
2020-09-24 02:52
We are sending back status 200

sambitkumar.pal
2020-09-24 02:53
Contract is passing between provider and consumer.

phil.endsley
2020-09-24 02:53
If you're exceeding the read timeout, it doesn't matter what the service sends back. The client will just cut the connection

sambitkumar.pal
2020-09-24 02:54
Anyway to increase the timeout.. Plz let me know

phil.endsley
2020-09-24 02:54
The contract verification results should be published back to pact broker as part of the provider build. It's not publishing the verifications from the webhook, it's doing it from the build. At least, it should be

sambitkumar.pal
2020-09-24 02:56
Ys.. Its send back the verification status due to that contract is pass showing in pact broker.

sambitkumar.pal
2020-09-24 02:58
Can u plz let me know any specific way contract verification need to send back..just a doubt if verification I am sending in wrong way.

phil.endsley
2020-09-24 03:04
I'm pretty sure it depends on what language you're using for your provider. The provider implementation should have documentation on how to do it I'm fairly certain you're doing it right though. If you're running a build, and your contract is updated to show as verified, it's working. That is not happening because of the webhook (directly). The webhook is just making some http call. The response code the webhook gets back will only impact the status of the webhook itself.

phil.endsley
2020-09-24 03:06
Your webhook kicks off a build, which runs a provider build and asynchronously sends that verification result back. Like Matt was saying, ideally, your webhook just invokes a call to start the build and immediately returns. It shouldn't have to wait until the build completes

phil.endsley
2020-09-24 03:06
The build will continue to run, and publish the results on completion

sambitkumar.pal
2020-09-24 03:13
OK.. So as I understood.. Immediately webhook needs a response back..so that it will success ...and it mean time let the provider build run to make the contract pass. There is nothing with build success or failure for webhook. Am I right? Plz correct me if I am wrong.

phil.endsley
2020-09-24 03:13
You got it

sambitkumar.pal
2020-09-24 03:15
Thank u. But please let me know how I will return back immediately to webhook. I am using java code for provider build.

phil.endsley
2020-09-24 03:18
What is the service you're calling now? Did you write it, or is it a build server? Do you just mean the provider is written in java, or you're starting the provider build from a java application?

sambitkumar.pal
2020-09-24 03:20
Ys I wrote a java code to call the build . maven command running to trigger the build. Which I am calling from java code.

sambitkumar.pal
2020-09-24 03:20
Provider is a separate java file for contract verification.

phil.endsley
2020-09-24 03:22
Use an ExecutorService or something similar to start the build in a new thread so it runs asynchronously

sambitkumar.pal
2020-09-24 03:23
Please look into the code I wrote for build.

sambitkumar.pal
2020-09-24 03:24
And its running separately.

sambitkumar.pal
2020-09-24 03:26
So in this class , what need to send back to webhook so that it will success ..plz let me kow

phil.endsley
2020-09-24 03:33
I'm actually heading off to bed, but these are easily searchable problems. Just lookup how to run something asynchronously in java, and do that for what you have. Just return after that, and it will send a 200 back

phil.endsley
2020-09-24 03:33
I don't want to sound too harsh, but after spending a lot of effort helping you, this kind of comes across as you just wanting someone else to do it for you. I think there's enough info here to figure the next part out

sambitkumar.pal
2020-09-24 03:35
Apologies. I will try. Thank you very much .

matt.fellows
2020-09-24 03:35
thanks for your help Phil

matt.fellows
2020-09-24 03:35
I think you?ve got it from here Sambit

matt.fellows
2020-09-24 03:36
also just check if you can?t call your build system directly rather than have a custom API you?re building. Most CI systems have an API you can call

sambitkumar.pal
2020-09-24 03:37
I am doing the POC in local system to call a build via rest controller.

sambitkumar.pal
2020-09-24 03:39
Thank you Phil and Matt.. Appreciate your help on this. I will try to find out something to return to webhook .

wilkinsweiqiangliang
2020-09-24 03:44
Hey guys, and example for testing kafka application? doesnt seems to have one in java repo


matt.fellows
2020-09-24 03:44
see how that goes (there should be a consnumer one there somewhere too)

2020-09-24 05:18
A new post has been created in *Feature Requests*

artur
2020-09-24 05:53
has joined #general

aforeman
2020-09-24 05:58
** BTW - account upgrades will be actioned within one week of survey completion - we will email you once it's done :sunglasses: **

wilkinsweiqiangliang
2020-09-24 06:29
I had check both `java-kafka` and `js-kafka` for consumer part. Doesnt seems to be any pact file that generated by consumer? https://github.com/pactflow/example-consumer-js-kafka

artur
2020-09-24 06:32
Is there a way to create an interaction that only matches when a header DOES NOT exist? in my case I want to have 3 interactions: ? auth header set and correct ? auth header set and incorrect ? auth header not present If I don't mention the auth header for the third interaction I get multiple interactions that match a requests with correct and wrong password. Any ideas?

abubics
2020-09-24 06:54
I think the https://docs.pact.io/faq/#how-do-i-test-oauth-or-other-security-headers is that's a separate layer to the contract interaction testing, and pact isn't a great fit for that . . .

abubics
2020-09-24 06:57
But I would also expect it to be easy to match a request without a header (not explicitly, but still unambiguously).

abubics
2020-09-24 06:57
What language/platform are you using?


artur
2020-09-24 06:59
I'm not using OAuth, simple basic auth

abubics
2020-09-24 07:00
Are you having trouble on the consumer side, or provider side, or both?

artur
2020-09-24 07:00
the client can send any username:password combination (or leave the header empty) and the server replies with 20x or 401, so in the first step I want to test the consumer that it reacts correctly on those responses

abubics
2020-09-24 07:02
On the consumer side, when I write pact interactions, I only have 1 valid matcher at a time, so the request either matches correctly, or finds no match (rather than finding a partial match)

abubics
2020-09-24 07:03
Is your stuff set up in a different way, where multiple interactions can match at once?

artur
2020-09-24 07:04
I have to use karma, and I could not find a way to attach the interactions to the single test because karma seems not to have a way, to have a super-global variable `provider = new Pact.PactWeb()` so I dump all interactions in one file

wilkinsweiqiangliang
2020-09-24 07:08
Hi guys, im writing a pact test with java and kafka. getting error with `Only request/response interactions can be used with an HTTP test target` . Does it mean i used a wrong annotation?

abubics
2020-09-24 07:14
ah, I haven't used karma . . . it's browser testing, right? Sounds tricky :confused: I know there's a https://github.com/pact-foundation/karma-pact lib, but I don't know anything about it either

abubics
2020-09-24 07:14
Sorry I can't be more help in your situation :<

abubics
2020-09-24 07:15
Having fewer interactions defined at once would be my recommended approach, if it's at all possible

christiaan
2020-09-24 07:28
Hi all. Two newbie questions: 1) Can somebody explain me the actual reason/rational about why when you use maven that, after running your unit tests, the producer needs to verify the pact in a seperate step "`mvn pact:verify"` against a running provider? 2 If my producer application already exdcutes junit in the "normal maven verify goal", which is also triggered during e.g mvn clean install, can I then skip this "`mvn pact:verify"` alltogether?

artur
2020-09-24 07:31
maybe I will open a feature request

stelios.arakliotis
2020-09-24 07:56
Hi guys, we are a team of backends(python) and frontends(react). Newbie concept questions : 1. Do we need to create Consumer tests both in python and in javascript in case of microservices connect to each other ? 2. If Pact Provider is written in Python how Consumer tests should be implemented in Javascript requiring access to mock service ?

matt.fellows
2020-09-24 08:02
did you run the test?

matt.fellows
2020-09-24 08:03
ah. OK thanks for raising Artur. Makes sense now

matt.fellows
2020-09-24 08:11
`npm i && make test` will generate a contract

matt.fellows
2020-09-24 08:11
```{ "consumer": { "name": "pactflow-example-consumer-js-kafka" }, "provider": { "name": "pactflow-example-provider-java-kafka" }, "messages": [ { "description": "a product event update", "providerStates": [ ], "contents": { "id": "some-uuid-1234-5678", "type": "Product Range", "name": "Some Product", "version": "v1", "event": "UPDATED" }, "matchingRules": { "body": { "$.id": { "matchers": [ { "match": "type" } ] }, "$.type": { "matchers": [ { "match": "type" } ] }, "$.name": { "matchers": [ { "match": "type" } ] }, "$.version": { "matchers": [ { "match": "type" } ] }, "$.event": { "matchers": [ { "match": "regex", "regex": "^(CREATED|UPDATED|DELETED)$" } ] } } }, "metaData": { "content-type": "application/json", "kafka_topic": "products" } } ], "metadata": { "pactSpecification": { "version": "3.0.0" } } }```

matt.fellows
2020-09-24 08:11
produced that

abubics
2020-09-24 08:15
Not really sure about maven . . . might want to ask in #pact-jvm for more targeted help

jamie
2020-09-24 08:20
has joined #general

abubics
2020-09-24 08:28
1. "Need" is a strong word, but if you have APIs that talk to other APIs, that may indicate a consumer-provider relationship :thumbsup: Nothing fundamentally wrong with that. 2. Consumers and providers certainly don't need to be in the same language. I'm not sure what you mean about "requiring access to mock service", though.

wilkinsweiqiangliang
2020-09-24 09:17
Dont worry about this issue, solved

wilkinsweiqiangliang
2020-09-24 09:20
Seems with `messagePact` , we cannot provide `null` value in the `content` , exception is ```TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>)``` In consumer test, i define ``` describe("receive a product update", () => { it("accepts a product event", () => { return messagePact .expectsToReceive("a product event update") .withContent({ id: like("da16494a-303a-463c-919a-e29e03a5b1de"), description: null ...```

bethskurrie
2020-09-24 10:04
Peeps! Just want to remind you that there are separate channels for each of the languages. We don't want to be supporting 10+ languages in the one channel! @wilkinsweiqiangliang looks like you want #pact-js ,

artur
2020-09-24 10:22
@matt.fellows I'm trying to restructure my tests. When I have different tests that have similar requests and should have different response, I add an interaction for each test but have to remove all interactions after every test. Is that right? because I cannot "overwrite" an interaction

matt.fellows
2020-09-24 10:53
That?s correct. If you call `verify` after each test runs, that clears out the mock server state. when `finalize` is called, that?s when the actual contract is serialised, including all of the previous interactions that were successfully verified

matt.fellows
2020-09-24 11:00
could you please raise an issue with an example that reproduces the error?

matt.fellows
2020-09-24 11:00
(and the full logs/stack trace etc. as per the issue template)

matt.fellows
2020-09-24 11:01
we?ll get it fixed

artur
2020-09-24 11:19
but if I call `removeInteractions` then `finalize` will not serialize them I guess

matt.fellows
2020-09-24 11:28
that will work too, but I?d suggest you call verify. Verify is what checks that you did what you said you would (i.e. the _mock_ part of the server, it?s not a stub, it?s meant to verify behaviour)

matt.fellows
2020-09-24 11:53
How?d you go Yoni? Keen to hear any insights from the community!

matt.fellows
2020-09-24 12:00
LOL. I thought the idea (and your other one) sounded familiar. I remember not long after I first launched the beta pact broker platform (back in late 2016), what is now Pactflow. I started creating a flurry of ?pie in the sky ideas? on the private GH repo where the initial customised app/platform. This one has a few fun items in it :stuck_out_tongue:

matt.fellows
2020-09-24 12:00
Or put another way - great minds think alike?

matt.fellows
2020-09-24 12:00
Or put another way - developers like to whinge, let?s create a whinge-as-a-service

matt.fellows
2020-09-24 12:01
but i :heart: this idea so much: > Imagine a command could make an ?unhappy contract file?. Now you can see your API call side-by-side with the contract ? You can see the diff between them.

matt.fellows
2020-09-24 12:01
THAT is a very cool idea

matt.fellows
2020-09-24 12:03
It?s also very doable I think. One of the unique parts of Pactflow is that we version all of the things and have all of these interconnections, so we could potentially even say ?actually, this worked for you on version x.y.1 and is incompatible with x.y.2? type thing

matt.fellows
2020-09-24 12:05
retrospective :taco: :taco: for @armorsmith42

matt.fellows
2020-09-24 12:05
?and bed for me :stuck_out_tongue:

jan.krejci
2020-09-24 13:19
Hi guys. Just following up this question. I really appreciate your feedbacks.

phil.endsley
2020-09-24 13:38
> there is certain scenarios as *External integrations* (Providers) By this, do you mean third party APIs you are consuming? For the company I work at, we don't do any kind of contract testing with 3rd party APIs, or even 3rd parties that consume our APIs. We generally get heavy push back if we suggest it, and since we can't control anything from their side, it's not worth the churn on our teams to go back and forth. Instead, we make sure we have testing in place for all the other layers, and mock out the third party stuff with our understanding of how it works. On top of that, we usually test with the third party directly before the feature that interacts with it. We still have bugs come up every now and then, but nothing severe enough that our company has had to consider alternate approaches. I am curious if anyone has success stories. It doesn't seem like a common scenario where I am (even other companies in my area).

sklein
2020-09-24 13:41
Question... Is there a way to force the pact verifier to follow redirects?

armorsmith42
2020-09-24 16:20
> whinge-as-a-service Winging is severely underrated.

armorsmith42
2020-09-24 16:22
This is because the person doing the wingeing is probably next to someone who is also stressed. If they were instead wingeing to someone in problem-diagnosis mode, then the value of their wingeing would connect. There is a time and place for doing everything and for hearing everything. Wingeing does not have the same place for both....not without design https://youtu.be/W4ga_M5Zdn4

jan.krejci
2020-09-24 18:29
Thanks a lot for your answer. It is exactly I what I was asking. Like Pact is not driven to solve this kind of issue, something that might happen is the API producer changes the API after you already validated and tested your features. I don't see any way to prevent it except a good communication. Any thoughts?

kflo
2020-09-24 21:13
so one huge benefit of pact is that it will allow us to not have to maintain environments filled with all of our services for end to end functional testing. but i?m curious what this means for the frontend, more specifically tests which involve flows. i guess these could also be automated using the pact broker, but what about exploratory testing? for example if you run the UI locally and you want to go through some flows manually, what should the frontend be talking to?

kflo
2020-09-24 21:15
i see various articles about functional testing and the UI, but those seem mostly about automated testing

kflo
2020-09-24 21:16
this topic isn?t necessarily related to pact, more about testing practices in relation to contract testing? if anyone has any articles to share it would be appreciated

kflo
2020-09-24 22:39
i guess when i say ?exploratory? i mean any kind of manual testing

bethskurrie
2020-09-24 22:56
@sklein which language? Can you give us some more background on why there's a redirect?

bethskurrie
2020-09-24 22:59
@jan.krejci @phil.endsley this is a big problem for lots of people, and we're actually doing some brainstorming at the moment as to how we could help solve this problem. It would likely involve OAS. @jan.krejci one of the forms of contract testing suggested by the original contract testing thought leaders was to have a stub (that you build yourself using an off the shelf stub tool) and have a test suite that you run against both the stub, and at a regular cadence, against the real provider.

bethskurrie
2020-09-24 22:59
It's an alternative method of ensuring that your stub and the real service behave the same way.


kflo
2020-09-24 23:03
hm, yes i saw this? although it?s still kind of abstract to me without playing around with a stub server? which i should probably do

kflo
2020-09-24 23:03
does the stub server support provider states?

bethskurrie
2020-09-24 23:03
good question.

bethskurrie
2020-09-24 23:03
not yet.

kflo
2020-09-24 23:04
ok, so it?s more of a canned ?i get this request, i give this response? kind of thing?

bethskurrie
2020-09-24 23:04
depends on which impl you're using, but if there are multiple matches for a request, it gives the "most positive"

bethskurrie
2020-09-24 23:04
The ruby one, anyway. I'm not sure on the rust impl.

kflo
2020-09-24 23:04
ok, good to know


bethskurrie
2020-09-24 23:04
It's not a fully featured stub, so you might be best using your pact to seed a proper stub like mountebank.

bethskurrie
2020-09-24 23:05
Ah, create article.

kflo
2020-09-24 23:05
which may help answer some of my questions

kflo
2020-09-24 23:05
i was looking at mountebank as well

bethskurrie
2020-09-24 23:06
If I had all the time in the world, I'd like to write a nice converter to load a pact in automatically.

kflo
2020-09-24 23:06
and i would love to help contribute that as well? depends a little on the timeline we are given at work

matt.fellows
2020-09-25 01:02
mountebank is a good tool, and the predicate matching is something I?d either a) like to bring into the stub server or b) enable a ?is this mountebank stub compatible with this pact contract?. That could give you the flexible stubbing you need for that sort of testing, whilst also giving you the guarantees that what you?re testing is indeed compatible with the provider

matt.fellows
2020-09-25 01:04
There?s a number of tools that can help with it. https://github.com/Netflix/pollyjs is a good one for JS

matt.fellows
2020-09-25 01:06
You could also use a tool like Pact Broker / Pactflow to manage the expectations. I talk about this in point (3) in this article: https://pactflow.io/blog/contract-testing-using-json-schemas-and-open-api-part-2/

matt.fellows
2020-09-25 01:07
Replace ?provider? with the external third party, and do what Beth said - periodically test the _real_ provider and use a form of approval-based testing to ensure things don?t drift

2020-09-25 01:37
A post in *Feature Requests* has been marked as *complete*

wilkinsweiqiangliang
2020-09-25 03:43
sure will do thanks

artur
2020-09-25 06:18
Thank you for your great help. I think I got it now. I've creating a new provider in every test file `provider = new Pact.PactWeb()` and interactions that I need in multiple tests I've moved to a helper function, that I can call with the provider as parameter. That system seems to work and enables me to add specific interactions for the tests :bananadance:

sambitkumar.pal
2020-09-25 13:55
Hi, I want to trigger a webhook programtically (java code) instead of directly from pact broker. Any reference/ example available ? Please let me know on this.

sambitkumar.pal
2020-09-25 15:44
Is anybody tried this ? Any suggestions?

raghanag
2020-09-25 18:56
has joined #general

phil.endsley
2020-09-25 19:41
What do you mean by this? Just trigger it artibrarily? Or still based on an event from pactbroker? If you want to invoke the webhook outside of the events from pactbroker, you just call that endpoint directly whenever you want If you want to invoke it based on the event in pactbroker, that's what the webhooks are doing already

collin.johnson
2020-09-25 21:19
has joined #general

sambitkumar.pal
2020-09-25 21:31
Want to invoke the webhook outside of the event from pactbroker. Is the endpoint http://localhost:8500/webhooks/ or anything else? I want to call it whenever any changes in content of consumer , I know the event for this. But how it will call only one time during consumer build ? Suppose 5 consumers are there and I have to prepare 5 requests to hit the endpoint one time. If it is inside the consumer build Pak. Then everytime the build trigger then it will also hit the endpoint. I think in every build of consumer it should not hit. Bcz only one time it should hit endpoint. Am I right in this? Plz let me know.

matt.fellows
2020-09-25 23:36
Why invoke the webhook, you could just call the API the webhook invokes directly

matt.fellows
2020-09-25 23:37
A webhook is designed to trigger based on specific platform events rather than requiring manual intervention. If your code had other logic you can just bypass the webhook altogether

matt.fellows
2020-09-25 23:39
Also, a webhook can already kick off based on the content changes in a contract so you don't need to explicitly call it anyway

matt.fellows
2020-09-25 23:39
Perhaps if you can explain the problem you have and why you think a webhook solves it that would help

sambitkumar.pal
2020-09-26 01:35
Instead of triggering inside pact broker 5 times for 5 consumers, I want to trigger it from my code which will trigger automatically. Webhook is a one time call and then it's retrying for every time to execute after any content change event.

matt.fellows
2020-09-26 01:42
I'm sorry I still don't follow why you want to do it this way and the problem it solves. If you have code to know when to do something (like trigger the webhook) why not just bypass the webhook altogether and perform the trigger from your java code?

matt.fellows
2020-09-26 01:44
It feels like you're trying to solve the wrong problem, which is why I'm asking. The webhooks are designed to decouple applications but it feels like you want to co-ordinate things introducing coupling

sambitkumar.pal
2020-09-26 01:50
Ok. I have 5 consumers and corresponding to those 5 providers as well. So instead of calling 5 times separately from code, I need to make one time call for all 5 consumers? Am I right? Plz correct me.

sambitkumar.pal
2020-09-26 02:00
If any example is available for such API call of webhook from code, please let me know.

viniciusribeirosp
2020-09-27 12:04
has joined #general

wilkinsweiqiangliang
2020-09-28 06:37
Hi team, any example with using pactflow and how it should setup with gradle as provider, and npm as consumer? any example for best practices?

wilkinsweiqiangliang
2020-09-28 06:59
By the way, where i can find this `pactBrokerUsername` ? doesnt seems to appear on the UI.

wilkinsweiqiangliang
2020-09-28 07:39
Other problem is trying to push pact to broker as example however has issue on `NameError`

wilkinsweiqiangliang
2020-09-28 07:40
```consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.27.0/lib/pact_broker/client/cli/broker.rb:59:in `rescue in publish': uninitialized constant PactBroker::Client::Error (NameError)```

wilkinsweiqiangliang
2020-09-28 07:40
```const child_process = require('child_process'); const exec = command => child_process .execSync(command) .toString() .trim() const path = require("path") const { Publisher } = require("@pact-foundation/pact") const branch = exec("git rev-parse --abbrev-ref HEAD") // publish to local docker // const opts = { // pactBroker: 'localhost:9292', // consumerVersion: '1', // pactFilesOrDirs: ['./pacts'], // }; const gitSha = exec("git rev-parse HEAD") const opts = { pactFilesOrDirs: [path.resolve(process.cwd(), "pacts")], pactBroker: "https://test.pact.dius.com.au", pactBrokerUsername: "dXfltyFMgNOFZAxr8io9wJ37iUpY42M", pactBrokerPassword: "O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1", consumerVersion: gitSha, tags: [branch], } new Publisher(opts).publishPacts().then(() => { console.log("Pact contract publishing complete!") console.log("") console.log("Head over to https://test.pact.dius.com.au/ and login with") console.log("=> Username: dXfltyFMgNOFZAxr8io9wJ37iUpY42M") console.log("=> Password: O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1") console.log("to see your published contracts.") }) .catch(e => { console.log("Pact contract publishing failed: ", e) })```

matt.fellows
2020-09-28 07:45
that property is not for pactflow


matt.fellows
2020-09-28 07:45

matt.fellows
2020-09-28 07:46
hmm, that looks like a bug, but the bug is being shown because of an error

matt.fellows
2020-09-28 07:48
what does your console have to say about it? Hopefully there is a stacktrack that explains what it was doing

matt.fellows
2020-09-28 07:48
at the least, set log level to DEBUG and print out what it was trying to do

wilkinsweiqiangliang
2020-09-28 08:39
let me get the debug message and post here

kristine.jetzke
2020-09-28 08:49
Yes. You can skip it then. If you run your contract tests during the regular maven build there?s no need for it. But sometimes you might have cases where you cannot run them as part of the regular build (eg legacy application) and then the verify goal can be used.

noamaanmohdkhan
2020-09-28 15:52
has joined #general

noamaanmohdkhan
2020-09-28 15:55
Hi. I have been trying to find an example code which uses `pathFromProviderState` , `valueFromProviderState` and `queryParameterFromProviderState` . I am working with JVM. And finding it difficult to find a proper documentation in one place or example which can help me understand how it works.

lo.voelsen
2020-09-28 17:02
has joined #general

aforeman
2020-09-28 21:07
Hello *Reminder* score your free lifetime upgrade on Pactflow when you complete our short survey. Submissions closing this weekend. See info and link below :point_down: For those who have already completed, we will be in touch with you today to confirm your account upgrade.  Thanks in advance! :raised_hands:

wilkinsweiqiangliang
2020-09-28 22:36
```yarn run v1.22.5 warning ../../../../../package.json: No license field $ node publish.ts [2020-09-28T22:29:12.217Z] INFO: pact-node@10.10.1/10867 on wilkinsliang: Publishing Pacts to Broker [2020-09-28T22:29:12.217Z] INFO: pact-node@10.10.1/10867 on wilkinsliang: Publishing pacts to broker at: https://test.pact.dius.com.au [2020-09-28T22:29:12.554Z] WARN: pact-node@10.10.1/10867 on wilkinsliang: Pact exited with code 1. [2020-09-28T22:29:12.555Z] ERROR: pact-node@10.10.1/10867 on wilkinsliang: Could not publish pact: /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.27.0/lib/pact_broker/client/cli/broker.rb:59:in `rescue in publish': uninitialized constant PactBroker::Client::Error (NameError) from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.27.0/lib/pact_broker/client/cli/broker.rb:55:in `publish' from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.27.0/lib/pact_broker/client/cli/custom_thor.rb:15:in `start' from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/app/pact-broker.rb:28:in `<main>' Pact contract publishing failed: Error: /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.27.0/lib/pact_broker/client/cli/broker.rb:59:in `rescue in publish': uninitialized constant PactBroker::Client::Error (NameError) from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.27.0/lib/pact_broker/client/cli/broker.rb:55:in `publish' from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.27.0/lib/pact_broker/client/cli/custom_thor.rb:15:in `start' from /home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.86.0/pact/lib/app/pact-broker.rb:28:in `<main>' at ChildProcess.<anonymous> (/home/wilkinsliang/work/lendi/decision-engine-team/e2e-testing/consumer/node_modules/@pact-foundation/pact-node/src/publisher.js:72:40) at Object.onceWrapper (events.js:421:26) at ChildProcess.emit (events.js:326:22) at maybeClose (internal/child_process.js:1051:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) Done in 0.86s.```

wilkinsweiqiangliang
2020-09-28 22:38
@matt.fellows i saw we are using pact_broker_client `1.27.0` its a bit old from the tags. https://github.com/pact-foundation/pact_broker-client/tags?after=v1.27.26

wilkinsweiqiangliang
2020-09-28 22:39
my consumer node dependency. ``` "dependencies": { "@pact-foundation/pact": "^9.12.0", "axios": "^0.19.0", "faker": "^5.1.0", "kafkajs": "^1.14.0", "uuid": "^8.3.0" },```

bgaundar
2020-09-28 22:43
has joined #general


wilkinsweiqiangliang
2020-09-29 04:15
Hi, i have been trying to find an example how ci/cd will automate the pact verification on both consumer and provider sides. Any resources to help me understand how it should work and setup?

wilkinsweiqiangliang
2020-09-29 04:16
is it a document?

matt.fellows
2020-09-29 04:16
Howtolearn

2020-09-29 04:16
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

matt.fellows
2020-09-29 04:16
CI/cd workshop there

matt.fellows
2020-09-29 04:16
Also look at the effective pact setup guide

wilkinsweiqiangliang
2020-09-29 04:17
okay sure

wilkinsweiqiangliang
2020-09-29 04:17
will do

wilkinsweiqiangliang
2020-09-29 06:10
following the cicd workshop docs and i had found some issue. Would you mind to help?

wilkinsweiqiangliang
2020-09-29 06:11
So im getting 403 when tagging a version to master. ```/home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish.rb:84:in `block in tag_versions': Error returned from tagging request 403 (Pact::Provider::VerificationResults::PublicationError)```

wilkinsweiqiangliang
2020-09-29 06:13
The other issue for the docs, is when we generate encrypted token for provider, it doesnt seems to have any `make` task to generate the encrypted token. From the docs, ```The environment variable must be encrypted in the context of the repository to which it will be added, so you can't just reuse the output of the encrypt step from the consumer project.``` I had to manually copy the `make` task `travis_encrypt_pact_broker_token` to generate one for provider.

robbert.van.der.zon
2020-09-29 06:24
has joined #general

matt.fellows
2020-09-29 06:29
Sorry I?m in a meeting for next few hours, but you can just skip all of that and pop your API token directly into your travis ci build


wilkinsweiqiangliang
2020-09-29 06:31
:+1:

matt.fellows
2020-09-29 06:32
awesome

matt.fellows
2020-09-29 06:32
`403` means forbidden, so it could be that you used the read-only token, just double check that

dabs1234
2020-09-29 07:02
Guys I trying to test the api which needs access tocken. Following is the code ```@TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) void pactVerificationTestTemplate(PactVerificationContext context, HttpRequest request) { request.addHeader("Authorization", "Bearer " + getClientOAuthToken()); context.verifyInteraction(); System.setProperty("pact.verifier.publishResults", "true"); }``` Getting following 400 error: 1.1) StatusMismatch: expected status of 200 but was 400 1.2) BodyMismatch: $ BodyMismatch: Expected name='name' but was missing { - "name": "name", - "id": 2000 + "timestamp": 1601355640376, + "status": 400, + "error": "Bad Request", + "message": "Missing request header 'Authorization' for method parameter of type String", + "path": "/portal/movie" } What might be wrong here? Any sample with JUnit5 would be a great help.

wilkinsweiqiangliang
2020-09-29 07:06
I had double check my token is the ci token

wilkinsweiqiangliang
2020-09-29 07:06
it pass on the pact verification test on provider but fail on taging

matt.fellows
2020-09-29 07:07
Might be best asking in #pact-jvm


mark.doppelfeld
2020-09-29 07:31
has joined #general

kristine.jetzke
2020-09-29 07:36
Hi everyone :wave: Is anyone planning to participate in https://hacktoberfest.digitalocean.com/ this year? To hack on some pact issues or as a maintainer?

florian.nagel
2020-09-29 07:41
I'm definitely gonna participate :smile: Not sure if I can give much to Pact bc it's quite a big project, but I'm definitely gonna contribute to open source!

matt.fellows
2020-09-29 08:33
We?d love to support this initiative. It would be great to get a show of hands on the above (using the :raised_hand: emoji) so we can gauge interest

matt.fellows
2020-09-29 08:34
Our job as maintainers is to curate and ensure our repositories are tagged/maintained so that we can help people get involvved

wilkinsweiqiangliang
2020-09-29 08:36
still have the issue, do i need any extra permission to do tagging?

wilkinsweiqiangliang
2020-09-29 08:37
@matt.fellows

matt.fellows
2020-09-29 08:38
There are so many ways to help us. Off the top of my head: 1. Help create demos/example projects 2. Update / identify areas we could improve documentation 3. Fix a bug 4. Report a bug 5. Pick up a new feature to contribute to 6. Help uplift a language to v3 (using our new?ish) rust library 7. Help / pair with somebody else 8. ?

matt.fellows
2020-09-29 08:39
Can you please share your log output? Failing on tagging is strange

tjones
2020-09-29 08:40
I'm definitely in!

wilkinsweiqiangliang
2020-09-29 08:41
``` 3 interactions, 0 failures /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish.rb:84:in `block in tag_versions': Error returned from tagging request 403 (Pact::Provider::VerificationResults::PublicationError) from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish.rb:80:in `each' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish.rb:80:in `tag_versions' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish.rb:68:in `tag_versions_if_configured' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish.rb:34:in `call' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish.rb:21:in `call' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish_all.rb:22:in `block in call' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish_all.rb:19:in `collect' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish_all.rb:19:in `call' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish_all.rb:10:in `call' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/rspec/pact_broker_formatter.rb:28:in `close' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:209:in `block in notify' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:208:in `each' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:208:in `notify' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:243:in `close' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:196:in `close_after' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:174:in `finish' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:76:in `report' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/runner.rb:115:in `run_specs' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/runner.rb:89:in `run' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/runner.rb:71:in `run' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/pact_spec_runner.rb:88:in `run_specs' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/pact_spec_runner.rb:34:in `run' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/cli/run_pact_verification.rb:69:in `run_with_pact_uri_object' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/cli/run_pact_verification.rb:50:in `run_specs' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/cli/run_pact_verification.rb:21:in `call' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/cli/run_pact_verification.rb:13:in `call' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:169:in `verify_pact' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:43:in `block in call' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:42:in `collect' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:42:in `call' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:34:in `call' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/cli/verify.rb:56:in `verify' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start' from /home/travis/build/wilkinsleung0712/example-provider/node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.85.0/pact/lib/app/pact-provider-verifier.rb:33:in `<main>' INFO: Tagging version 9abc843b5c2a91fcb6b0818c4383ba3c49532454 of pactflow-example-provider as "master" at ChildProcess.<anonymous> (node_modules/@pact-foundation/pact/node_modules/@pact-foundation/pact-node/src/verifier.ts:265:55)```

matt.fellows
2020-09-29 08:46
That error implies you?re using a *read-only* token

wilkinsweiqiangliang
2020-09-29 08:46
really?

matt.fellows
2020-09-29 08:46
I?ve checked our logs which confirms it, can you please triple check you?re using a read-write token?

wilkinsweiqiangliang
2020-09-29 08:47
no way, check multiple times

wilkinsweiqiangliang
2020-09-29 08:47
unless the copy button from UI doesnt work

wilkinsweiqiangliang
2020-09-29 08:47
haha

wilkinsweiqiangliang
2020-09-29 08:48
this is the one im using

matt.fellows
2020-09-29 08:48
That?s the right one!

matt.fellows
2020-09-29 08:48
you OK if I jump in to take a look?

wilkinsweiqiangliang
2020-09-29 08:49
yes please


mike.geeves
2020-09-29 09:24
Intending to, but I've been intending to take a look at #1 for a little while anyway. Ahem. Been busy :stuck_out_tongue:

bethskurrie
2020-09-29 09:28
Upgrade please @wilkinsweiqiangliang that's been fixed.

bethskurrie
2020-09-29 09:32
I still don't understand why. The webhook will fire automatically when you publish a pact or verification result.

bethskurrie
2020-09-29 09:33
The only reason you'd trigger a webhook manually is to test it.

bethskurrie
2020-09-29 09:34
It's not going to call all 5 consumers/providers at once for you.

bethskurrie
2020-09-29 09:34
For each pact or verification results publication, there is only one consumer and one provider.

kong
2020-09-29 10:21
I?m intending to ? just have to get back to the OSS codebase

matt.fellows
2020-09-29 10:51
Awesome. would people prefer an event format where we find a day/time where us maintainers are hanging out over a 24 hr period (we?re in all the places, so unlikely we?ll be able to line us all up) Or would people prefer us to just have some ?garden paths? available for people to be able to pick up at their own pace I also expect to be told ?both?

florian.nagel
2020-09-29 10:54
For me personally I'd think that the second approach is more convenient as I'm not sure how much time I can spend on Pact in one sitting of 24 hours. Thanks for making this offer! :smile:

mike.geeves
2020-09-29 11:33
Second option for me, although I still have a todo list from before :stuck_out_tongue: Because unreliability :stuck_out_tongue:

phil.endsley
2020-09-29 12:22
Ditto on second option. It's for all of October, and everyone is already super responsive on slack.

sambitkumar.pal
2020-09-29 13:34
Agree. But we need to call webhook manually once. Post which it will automatically. But I want that manual once/1st time to make it programmatically. Not manually.

phil.endsley
2020-09-29 13:52
There's a lot of red flags with the way you're going about implementing this, which is why everyone is trying to ask for more clarification on _why_ you're trying to do this. You said you were working on a proof of concept, so I'm assuming this first time would be for your consumer when you commit a change to modify the consumer pact? If so, the typical workflow would be to have your project setup in source control with a build server. Then, each time you make a commit, your build server would trigger a build. Is that the part you're trying to simulate? If you need to call it manually, for whatever reason, just call the endpoint directly. There's no api in Pact Broker that will fire off a webhook for you. So, if your webhook is setup to call http://localhost:8080, just call that directly instead of trying to make the webhook trigger. Again, if you're doing this for a real setup, you shouldn't have to do this

matt.fellows
2020-09-29 14:05
It's not clear why you need to call the webhook manually at all (and if you do, you don't need to trigger it via Pactflow you can just call it directly as Phil says)

matt.fellows
2020-09-29 14:05
I can't remember if I shared with you already, but I'd look at reading thru (if not doing it yourself) the CI/cd workshop

matt.fellows
2020-09-29 14:05
Howtolearn

2020-09-29 14:05
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

matt.fellows
2020-09-29 14:06
:point_up:ci/cd workshop there

matt.fellows
2020-09-29 14:07
Honestly it sounds like you're over complicating things so hopefully once it clicks it will be a lot less complexity to manage and easier to demonstrate the benefits!

ukrainian1991
2020-09-29 14:11
Hi, What is the proper approach if one of the microservices communicates with external 3rd party API? Should I stub it and write separate contracts tests between my microservice and this 3rd party?

ukrainian1991
2020-09-29 14:17
I am a bit messed up with statements here https://docs.pact.io/getting_started/what_is_pact_good_for#what-is-it-not-good-for and my case)


ukrainian1991
2020-09-29 14:43
Thanks!!! I think idea to use OpenApiSpec test for real 3rd party on regular basic is a good easy choice

ukrainian1991
2020-09-29 14:44
...while using stub in other tests with internal microservices


sambitkumar.pal
2020-09-29 15:23
Thanks Phil. You have valid point. I got it. Thank you all.

collin.johnson
2020-09-29 16:49
Hey everyone, I'm very new to pact trying to implement it in an existing project. When implementing pact in my own project I had to set the Cors flag to true to get my consumers pacts to work. It is working now but I'd like to understand what about my app makes it need this, I'm using axios to make the GET request and pact was claiming it only saw an OPTION request (cors preflight) and failed before I set the cors flag to true. Anyone have any insight into where to look to find out more about how this works? I thought maybe it had to do with some detail of how the pact mock server is implemented as other jest mocks don't have this kind of problem, which is why I'm asking here

collin.johnson
2020-09-29 17:11
Upon writing that out I am realizing it's probably something within the surrounding app I need to understand more than pact itself. The project is a dockerized gatsby frontend being served by nginx I didn't set up that part myself so I'm guessing that's where the cause is, and what I need to look into. The jest mocks I used before weren't setting up a mock server like pact is which is why I didn't see the problem before.

phil.endsley
2020-09-29 17:45
> I thought maybe it had to do with some detail of how the pact mock server is implemented as other jest mocks don't have this kind of problem The pact mock server is an actual server that's being started to host what is defined in the contracts. When you run your consumer tests with pact, it's making actual http calls to the mock server, and the mock server then returns what you defined in the contract.

florian.nagel
2020-09-29 20:42
No you didn't :joy: I thought my puns were bad... I stand corrected ^^

matt.fellows
2020-09-29 23:06
:taco: for @joel.whalen for the best pun of the day. Beth will be ~proud~ angry

sreid
2020-09-30 00:08
has joined #general

wilkinsweiqiangliang
2020-09-30 01:04
Hi guys, im working on the ci cd setup and a bit confused. Where does webhook fit in in a normal ci/cd process. ? when consumer publish pact file during build process, and webhook trigger provider verification and failed, would it also fail the consumer builds in ci? ? what is the best practices in ci/cd? Shall the pactverification test be executed in every build?

bethskurrie
2020-09-30 01:07
Have you read the effective pact set up guide?

bethskurrie
2020-09-30 01:07
In this step it describes the workflows https://docs.pact.io/pact_nirvana/step_4

bethskurrie
2020-09-30 01:08
> when consumer publish pact file during build process, and webhook trigger provider verification and failed, would it also fail the consumer builds in ci? you need to use can-i-deploy in the consumer pipeline to find out the verification results

wilkinsweiqiangliang
2020-09-30 01:08
cool i followed the workshop havent reach to this page yet, will read through and see

bethskurrie
2020-09-30 01:08
Heres's the CI/CD workshop, that should make things clear https://docs.pactflow.io/docs/workshops/ci-cd/

bethskurrie
2020-09-30 01:08
I'm in the middle of moving it from Travis CI to Github Actions.

bethskurrie
2020-09-30 01:09
The code works, but the docs still talk about Travis.

bethskurrie
2020-09-30 01:09
> what is the best practices in ci/cd? Shall the pactverification test be executed in every build? Yes, every build.

bethskurrie
2020-09-30 01:09
The consumer generates and publishes a pact with every build. Most of the time it will not change. The provider verifies the pacts every time it runs a build.

bethskurrie
2020-09-30 01:10
When the pact does change, the pact verification build runs on the provider.

wilkinsweiqiangliang
2020-09-30 01:10
and thats by webhook

bethskurrie
2020-09-30 01:10
yes

wilkinsweiqiangliang
2020-09-30 01:11
so i assume everything it start by consumer witting a pact file first, as consumer driven, otherwise without pact file, provider test will fail.

bethskurrie
2020-09-30 01:12
it depends on the Pact implementation for that language as to whether the provider build fails or not when there are no pacts.

wilkinsweiqiangliang
2020-09-30 01:12
thats a good tips

wilkinsweiqiangliang
2020-09-30 01:12
doesnt see it mention anywhere in docs

adrianojedabenitez
2020-09-30 04:40
hello! not sure if this is the correct place to ask, but maybe someone had the same issue as me. Basically, I?m using gitlab and pactflow. I?ve created a webhook to trigger a job in case a contract with my provider changed, following the gitlab webhook template library as per doc. The issue is I need to specify the branch as part of the url ref. But we work with `develop` as develop branch and `master` as stable branch and also with releases branches. The problem is that in case we are adding an intentional breaking contract change the webhook that will be in charge of verify that pact should be able to run in develop but also in master branch depending on the version that the consumer is releasing. how did you guys solve that?

bethskurrie
2020-09-30 04:41
> The issue is I need to specify the branch as part of the url ref The consumer branch or the provider branch?

bethskurrie
2020-09-30 04:41
#pact-broker is the best channel to ask, to keep things focussed.

bethskurrie
2020-09-30 04:44
If you need to do logic on which branch of the provider to do the verification against, I would put that logic into the build itself. eg. have the webhook trigger a build that fetches the info, and decides which branch to verify on.

wilkinsweiqiangliang
2020-09-30 05:42
Hey guys, any example or blog for using pact-broker with aws s3 instead of postgres or sql?

bethskurrie
2020-09-30 05:45
To back the application? Not possible.

bethskurrie
2020-09-30 05:45
It has to be a relational database.

bethskurrie
2020-09-30 05:45
The data is very relational.

bethskurrie
2020-09-30 05:45
Not the contracts themselves, the relationships between the versions - see the matrix page. It's a classic many to many relationship.

wilkinsweiqiangliang
2020-09-30 05:45
anysuggestion for the db instance? sz and performance wise?

bethskurrie
2020-09-30 05:46
You can use the same ones as the Pactflow On-Prem requirements https://docs.pactflow.io/docs/on-premises/system-requirements/

bethskurrie
2020-09-30 05:48
Pactflow On-Prem is the On-Prem version of Pactflow SaaS which is a hardened/improved version of the OSS Pact Broker On-Prem :laughing:

raghanag
2020-09-30 06:00
hi, i am reading https://docs.pact.io/faq/convinceme/ but couldn?t figure out what happens when you have tens of consumers and do you recommend everyone to generate pact files and let the provider run all the pact files at the provider end so that any changes dont break any consumer.

bethskurrie
2020-09-30 06:01
@raghanag you can try it, but you may find it difficult. We're working on a provider driven flow at the moment that will scale better for many consumers.


bethskurrie
2020-09-30 06:03
We're working on a way to allow a provider to define a contract using open api, and run one set of tests to verify that it meets it's contract, then allow consumers to generate their contracts as normal, then verify the consumer contract against the provider contract.

bethskurrie
2020-09-30 06:03
Statically comparing the consumer contracts against the provider contract will scale better than the current method of verifying pacts.

raghanag
2020-09-30 06:06
so you meant going forward it would be just find the delta across provider and consumer pact json files?

bethskurrie
2020-09-30 06:07
it would compare the provider's OAS to the consumers' pacts, and check they were compatible.

raghanag
2020-09-30 06:08
can i safely say that pact is a unit test fwk which provides mock server and generates a json file just like hoverfly which generates json file with its own schema but acts as a MITM proxy which reduces all the cluttering(code changes) you need if you use wiremock, but hoverfly you need to make changes in your browser proxy settings

bethskurrie
2020-09-30 06:09
I've never used hoverfly I'm afraid.

bethskurrie
2020-09-30 06:09
@matt.fellows?

raghanag
2020-09-30 06:09
why provider OAS instead of provider pact

bethskurrie
2020-09-30 06:09
We may end up supporting that as well, but the tool already exists for pact/oas comparison.

bethskurrie
2020-09-30 06:10
So that's where we're starting.

raghanag
2020-09-30 06:10
thanks for answering patiently

bethskurrie
2020-09-30 06:11
no worries. this feature isn't out yet, but it's next on our Pactflow priority list after we get user roles complete

mark.doppelfeld
2020-09-30 07:44
Hi

me1525
2020-09-30 07:57
has joined #general

namhuynhkien
2020-09-30 09:25
has joined #general

adrianojedabenitez
2020-09-30 13:07
thanks for reply Beth! yeah I was asking on the provider branch. I see, I wanted to avoid adding extra logic but that might work. Maybe using the consumer tag to decide which branch to verify on.

adrianojedabenitez
2020-09-30 13:07
thanks!

sklein
2020-09-30 15:10
Any thoughts on how people have effectively shared valid states between consumers and providers? Magic string state matching is starting to feel a bit brittle.

jan.krejci
2020-09-30 19:53
@bethskurrie It's great to know it. I am wondering if the feature request will be released to all open source comunity. https://github.com/pactflow/roadmap/issues/4

abdul.akhter
2020-09-30 21:02
has joined #general

matt.fellows
2020-09-30 22:56
One strategy is to have a standard naming convention for the common states - e.g. mapping to the http status codes

matt.fellows
2020-09-30 22:57
Some teams have a published page which outlines the available states, but according to Beth, that?s an anti-pattern. Each consumer should have its own set of states. Personally, I prefer to have less so it?s a point of contention

matt.fellows
2020-09-30 22:58
I think it could be helpful for the pact broker to show the available states somewhere

matt.fellows
2020-09-30 22:58
Also, the provider driven stuff we?re looking to add should make this problem go away, because the provider doesn?t need to implement the states a consumer defines

abubics
2020-10-01 00:14
Just chipping in with more perspectives . . . I like to have a state per significant situation (which is, of course, an "it depends" answer). What that means will depend on your participants and the domain model, necessarily. But some general ideas for what makes a situation significant are: ? For UI tests, collections with 0, 1, some, many, lots are helpful. ? Similarly for headless/API tests, boundary conditions like pagination limits are interesting (e.g. 0 items, <1 page, >1 page, many pages). ? Design for errors early. ? Design for user roles early. ? Abstract for time-sensitivity early (i.e. inject a "now" provider, so you can mock relative times/dates easily). ? Detail as little as possible in the state name, but have known & shared concrete values backing each state (e.g. "a sprocket exists" tells you that an entity exists (significant) and implies but hides that you know the ID in the URL `/sprocket/12` or whatever).

abubics
2020-10-01 00:18
If you find that you need to specify a lot of things in the state names, it could be because your resources are modelled in a complicated way. The states can be a helpful diagnostic tool to highlight such a situation. In those cases, it's important to remember that a hierarchical set of relationships doesn't have to be exposed directly through your ReST API resources. E.g. if you have 4 levels deep of parent-child relationships, but each level has unique IDs, then don't need to be nested in the URL path.

abubics
2020-10-01 00:21
Relatedly, you don't have to have only one path to access each resource. If it makes sense for your consumer contexts, you could have something like `/parent/{id}/child/{id}/grandchild/{id}` and `/person/{id}` where all of those IDs are unique, and access the same pool of entities. Then navigation metadata become more useful/important, and you may evolve more towards HATEOAS.

matt.fellows
2020-10-01 02:06
@abubics gets a :taco:. You must be hungry after all of that typing

ranjanayush03
2020-10-01 04:20
Hi all , I have a provider API which requires a validation of token to be done so that it can be called because of a proxy app running infront of it , but on the consumer side while generating pacts because we are two separate teams we cannot share the token from provider , and hence the pact which is generated won't have the necessary authorization to hit the API .So , is there a way so that I can modify the headers of the pact file on the provider side..



ranjanayush03
2020-10-01 04:52
Thanks Matt will look into the examples..

wilkinsweiqiangliang
2020-10-01 06:25
Hi guys, i had couple of question. ? how does the providerVersion get inserted in JVM? i can see in js we can insert with `providerVersion Options` ? when using gradle plugin to upload the pact file with versioning, can it be used with `git sha` instead of string? (i.e. the publish config in `pactPublish` gradle task.) ? Does the `pactBroker` support multiple user? and token? like `pactflow` does? im trying to understand what is the main different between pactbroker and pactflow, it seems to be better UI, and secret, multiple user. What about functional wise

bethskurrie
2020-10-01 08:28
The majority of the difference between the Pact Broker and Pactflow is in the user management, security and UI, so far. The feature differentiation will be starting soon, as we begin working on provider driven contract support.

bethskurrie
2020-10-01 08:29
The Pact Broker only supports basic auth, and there's only two sets of credentials - a read write, and a read only.

bethskurrie
2020-10-01 08:30
Best to ask the JVM specific questions in #pact-jvm

bethskurrie
2020-10-01 08:32
Extra :taco: for @abubics

abubics
2020-10-01 08:34
All licenced as MIT and/or CC ;D feel free to steal it and/or publish it

matt.fellows
2020-10-01 11:08
You can see the key feature differences at http://pactflow.io/features


matt.fellows
2020-10-01 11:11
It uses the `pact.provider.version` system property e.g. `System.setProperty("pact.provider.version", "1.0.0-somegitsha")`

matt.fellows
2020-10-01 11:12
example spring boot: https://github.com/pactflow/example-provider-springboot/blob/master/src/test/java/com/example/springboot/ProductsPactTest.java#L34 (probably shouldn?t set that directly in the test, it should live in the gradle file or outside of code)

matt.fellows
2020-10-01 12:52
@bethskurrie :point_up: look what you?ve done

matt.fellows
2020-10-01 13:09
I know @marko.justinek has a v3 compatible Pact Swift he?s raring to get in the hands of mobile devs. Anybody willing to put their hands up to help test and provide early feedback/bug smashing during Hactoberfest?

marko.justinek
2020-10-01 13:43
That would be much appreciated! I can transfer a few of the issues I have on my personal to-do/to-verify/find-alternative list to PactSwift github issues so they could be looked into by anyone willing.

michael_james
2020-10-01 14:33
has joined #general

raghanag
2020-10-01 19:44
Hi @bethskurrie @matt.fellows just a qq, if the provider changes the code and is suddenly breaks lots of consumers, whose responsibility it is to change the code?


michael.miranda
2020-10-01 21:39
has joined #general

wilkinsweiqiangliang
2020-10-01 23:42
Willing to help

wilkinsweiqiangliang
2020-10-01 23:43
Thanks for the answers. Will do more reading on this. :+1:

matt.fellows
2020-10-01 23:47
:raised_hands:

matt.fellows
2020-10-01 23:48
that?d be amazing!

matt.fellows
2020-10-01 23:53
> Hi @bethskurrie @matt.fellows just a qq, if the provider changes the code and is suddenly breaks lots of consumers, whose responsibility it is to change the code? :wave: well? that?s a loaded question!

matt.fellows
2020-10-01 23:54
but, my default answer is the provider. Why are they pushing out breaking changes?

matt.fellows
2020-10-01 23:54
> do you recommend CDC for BFF only https://samnewman.io/patterns/architectural/bff/ you can use Pact for BFFs - are you saying pact is _only_ good for BFFs or if you can use pact to test them?

wilkinsweiqiangliang
2020-10-02 02:08
@matt.fellows Tried setting the env variable and run my test again, doesnt seem to pushing the tag to my broker. Do i need to run gradle/`pact-cli` command to push the version from provider?

wilkinsweiqiangliang
2020-10-02 03:01
nvm, i just got it

robbert.van.der.zon
2020-10-02 07:40
Hi all! I hope this questions isn't asked before too much, but I couldn't find it. I just started using pact for our java microservices and use the cli to upload the contracts, to tag the versions, to run can_i_deploy and to upload verification results. The cli works fine, but when possible, I would like to use the maven (pact-jvm-provider-maven_2.12) plugin so I can just use './mvnw pact:publish' to upload the pact file. This works fine for uploading, but I cannot find if we can use the plugin also for tagging versions and for the can_i_deploy call. Does anyone know if this is possible using the plugin? Or is that only possible with the cli?

lakitna
2020-10-02 07:45
has joined #general

uglyog
2020-10-02 07:51
That's the old version of the maven plugin. The latest one supports can_i_deploy calls

robbert.van.der.zon
2020-10-02 07:58
Thanks for your answer! I am using this version: https://search.maven.org/artifact/au.com.dius/pact-jvm-provider-maven_2.12/3.6.15/jar This seems to be the latest version, but the documentation does not mention the can_i_deploy. Unless I am reading it wrong.

robbert.van.der.zon
2020-10-02 08:04
I see now that I can also use pact-jvm-provider-maven, version 4.0.10, and that has indeed a pact:can_i_deploy. That is not added in the documentation. But tagging a version is not possible? Or is there another way of doing that?

wesleythomaswilliams
2020-10-02 09:24
```-Dpact.provider.tag=```

wesleythomaswilliams
2020-10-02 09:26
Is there more info in here that is useful? https://docs.pact.io/implementation_guides/jvm/provider/maven/

robbert.van.der.zon
2020-10-02 09:58
Perhaps I am not doing it correctly. But for the consumer I am uploading my contracts and give it a tag with the branchname in the build pipeline. But when I have deployed my consumer to production, I tag that version afterwards with the tag 'prd'. (following this: https://docs.pact.io/pact_broker/tags) I do that using the cli with: ```pact-broker create-version-tag ``` As described here: https://docs.pact.io/pact_broker/client_cli/readme

xavier.durairaj
2020-10-02 12:52
has joined #general

seda.urguplu6
2020-10-02 19:44
has joined #general

mateusz.derks
2020-10-03 08:05
has joined #general

hovinen
2020-10-03 15:03
has joined #general

robbert.van.der.zon
2020-10-04 10:49
Hi! I am still trying to get the can_i_deploy working with our workflow, but am still truggling with it. I have the following situation: ? For the consumer I create a git feature branch called ?feature1? and add a new field to an existing contract. We upload this version to pactflow and tag this version with the tag ?feature1?   ? Then I run the master build from the provider. This build is also looking at pending contracts en WIP, so is verifying this contract. This succeeds in this case and marks this as verified. The provider version that verified this contract is marked with ?master?. ? If I manually run the can_i_deploy to master on the consumer build, this is now green (as expected). That means that I could merge my feature branch to master and deploy this to production if I want to. ? However, when in the meantime the master build of the provider has an update and builds again, then this new build is not verifying my ?feature1? contract anymore (because it is not pending anymore). This new build is now marked as ?master?. ? If I run the can_i_deploy on the consumer now, then it is red. This is because the latest ?master? version of the provider has not checked my contract. This also means that I don?t know if I can merge my feature branch to master and deploy to production. Am I doing something wrong, or don't I understand it correctly?

matt.fellows
2020-10-04 23:24
Any mobile devs out there that would be interested in creating an iOS or Android workshop? We have a format that can be followed. It?s about 1 - 2 days? effort based on previous I?ve created an issue for the swift project https://github.com/DiUS/pact-consumer-swift/issues/100 and I?m sure @marko.justinek would be keen to see it created!

tjones
2020-10-05 01:57
I know a couple solid android devs - What's missing from this one? https://github.com/DiUS/pact-workshop-android

matt.fellows
2020-10-05 02:45
It?s just old

matt.fellows
2020-10-05 02:46
Ideally, it be brought in line with the JS workshop (which is the new canonical reference)

2020-10-05 02:57
A post in *Feature Requests* has been marked as *in progress*

m_testslackuser2
2020-10-05 06:05
has joined #general

zelre.stemmet
2020-10-05 06:33
has joined #general

m_greetingsbot3
2020-10-05 06:43
has joined #general

bethskurrie
2020-10-05 07:57
@robbert.van.der.zon I understand your situation. That is a very good question.

bethskurrie
2020-10-05 08:00
I'm going to have to think about how we get around this.

me1276
2020-10-05 08:11
Hey @matt.fellows, I didn?t configure notifications for this workspace so just saw this and configured alerts The event was quite well, it seems that many people are already familiar with PACT and appreciate the idea. That said, not enough tried and implemented it which shows how big is the potential. How do we drive adoption :thinking_face:? My personal thoughts are that there should be a quicker way to start, maybe one-click setup of provider-driven contracts (i.e. OpenAPI validation) and then a way to opt-in for more features with consumer-driven? Buy more influencer in the JS eco-system? Or maybe you are satisfied enough from the growth?:)

robbert.van.der.zon
2020-10-05 08:36
I have created a workaround for myself.  On our provider-master build, after running the normal test, I have created an extra step. In this step, I am creating a list of all tags (using the rest-api of pactflow). Then I run the verification test against all tags (with WIP and pending disabled). This way I know that each master build verifies all latest contract versions. I ignore the test results of this step because I don?t want to fail the build on it.

robbert.van.der.zon
2020-10-05 08:39
I don't really understand why WIP stops verifying a pact with a tag which it has already verified. Is that because of performance?

bethskurrie
2020-10-05 08:40
Because if it didn't stop verifying it at some stage, you'd end up verifying every pact ever in the broker.

bethskurrie
2020-10-05 08:41
maybe that's not a bad thing though :thinking_face:

bethskurrie
2020-10-05 08:42
maybe it should keep verifying them in pending mode until they get deleted :thinking_face:

bethskurrie
2020-10-05 08:43
or they become one of the explicitly supported pacts.

bethskurrie
2020-10-05 08:43
I've just been brainstorming with @antonello

bethskurrie
2020-10-05 08:44
we may have a solution. Are you running your own OSS version of the broker @robbert.van.der.zon or using Pactflow?

robbert.van.der.zon
2020-10-05 08:44
We are using pactflow

bethskurrie
2020-10-05 08:46
Can you PM me your tenant? I might get you to beta test my updated WIP pacts logic when I've thought it though.

robbert.van.der.zon
2020-10-05 08:46
With WIP we can set a date. So all pacts older then that will not be tested anyway. This way you are already avoiding pacts to be tested forever

bethskurrie
2020-10-05 08:47
We don't have to have to continually change that date just to get rid of pacts though.

nazar.khmil
2020-10-05 10:34
has joined #general

xandebianchi
2020-10-05 13:05
has joined #general

dorin.enache
2020-10-05 15:01
has joined #general

ruth
2020-10-05 18:53
has joined #general

phil.endsley
2020-10-05 18:53
@bethskurrie Can you elaborate on what your plan/idea is? I'm curious if this would solve my (and others) issue with having to make a code change to remove selectors for consumer feature branches.

raghanag
2020-10-05 23:14
Hi @matt.fellows in this video they talked about fully automated loop, is it already available now? https://youtu.be/-6x6XBDf9sQ?t=2128

raghanag
2020-10-05 23:49
and also at this https://youtu.be/-6x6XBDf9sQ?t=2175 time, they mentioned about verifying the pact file from consumer and swagger file from provider

bethskurrie
2020-10-05 23:51
> if the provider changes the code and is suddenly breaks lots of consumers, whose responsibility it is to change the code? The provider. There are many alternatives to evolve an API without breaking existing consumers. There is some good advice here https://apisyouwonthate.com/

matt.fellows
2020-10-06 00:57
Anyone keen to contribute an updated version of our Java workshop https://github.com/DiUS/pact-workshop-jvm/issues/20 ? #hacktoberfest

wilkinsweiqiangliang
2020-10-06 00:58
Happy to contribute on this. Would you mind to provide a bit of detail what need to be done?

matt.fellows
2020-10-06 01:13
I?m sorry, that video is almost 5 years old - I can?t remember what ?loop? you?re referring to. But suffice to say, we have verification ?loops? available in Pact. Can you please be more specific?

matt.fellows
2020-10-06 01:14
https://docs.pact.io/pact_nirvana/ and the workshops talk about end-to-end scenarios

matt.fellows
2020-10-06 01:15
So basically, there is a new format of the workshops (https://github.com/pact-foundation/pact-workshop-js and https://github.com/pact-foundation/pact-workshop-go for example) that have been re-designed based on feedback. The JVM workshop uses the original workshop format

matt.fellows
2020-10-06 01:16
What needs to happen is to essentially create a JVM port of the JS/Golang workshops

wilkinsweiqiangliang
2020-10-06 01:16
sure, so jvm port need to be refactor base on the new format i guess

matt.fellows
2020-10-06 01:16
yep!

matt.fellows
2020-10-06 01:16
@uglyog will be able to advise more on the detail when it gets to it (see the comment in the issue above for an example of that), but a spring boot app would be a minimum

matt.fellows
2020-10-06 01:17
The idea is that somebody can run that workshop, and get across all of the key concepts by the end of it - provider states, dealing with authorisation, matching rules etc.

uglyog
2020-10-06 01:19
Prob better to just create a new springboot workshop based off the JS one than upgrade the existing

uglyog
2020-10-06 01:20
As long as make gets removed from it :smile:

wilkinsweiqiangliang
2020-10-06 01:24
oh, those MAKE files. yea, find it a bit hard to read at the beginning

raghanag
2020-10-06 01:32
sorry in that video he is referring to making the verification automatic by comparing the consumer pact file with provider swagger spec which you mentioned in case of provider driven testsing

michael_james
2020-10-06 09:46
@matt.fellows I've been updating the .Net Core one as it's .Net Core 2 not 3.1 which is the LTS version, also fixing some bad habits of not awaiting async code, do I PR to the original workshop?

michael_james
2020-10-06 09:48
I started the PR here: https://github.com/tdshipley/pact-workshop-dotnet-core-v1/pull/16 But believe there will be a few other changes

matt.fellows
2020-10-06 11:56
That?s great, thanks!

matt.fellows
2020-10-06 11:57
Any contribution is fantastic, so this is a great start

matt.fellows
2020-10-06 11:57
Ultimately, it?s tdshipley?s IP. But ideally, we?d love to move it to the pact-foundation so it is more visible etc.

matt.fellows
2020-10-06 11:57
I?ll ask on the repo and see what we can do?


matt.fellows
2020-10-06 11:59
Could be a good #hacktoberfest?

michael_james
2020-10-06 12:43
failing that, i could look at using your new JS example and converting to .net core. But only if tdshipley doesn't want to maintain it

michael_james
2020-10-06 12:45
I'm happy either way as I'm looking at how I can onboard our company and writing internal training for us.

ledinhcuong99
2020-10-06 12:53
has joined #general

matt.fellows
2020-10-06 13:12
they released a tool called Atlassian Mock Validator which can do that check - we?ll be adding similar support into Pactflow shortly too. So, yes :slightly_smiling_face:

matt.fellows
2020-10-06 13:15
Oh, sorry I missed the thing about Hoverfly

matt.fellows
2020-10-06 13:15
Hoverfly is a service virtualisation tool, and Pact is sort of one also. But not as a general purpose one. It has service virtualisation in it, but it?s purpose is about ensuring systems are compatible with one another. Hoverfly does not do that bit, but it is a general purpose SV tool

matt.fellows
2020-10-06 13:20
As described in that issue, we?d appreciate an upgrade to the latest workshop format - it covers all of the key concepts, and is consistent with others we have and will continue to build. That makes it much more helpful when moving between languages to compare/contrast etc.

matt.fellows
2020-10-06 13:21
No pressure either way, but I?m happy to create the repo on Pact Foundation and grant access to you folks to contribute to.

matt.fellows
2020-10-06 13:21
But I get that @thomas.shipley might want to get the Github kudos - so whatever works

matt.fellows
2020-10-06 13:22
haha

matt.fellows
2020-10-06 13:22
is there a make file in the pact JS workshop? hmmm

matt.fellows
2020-10-06 13:22
I don?t think so

matt.fellows
2020-10-06 13:23
the CI/CD workshop (and yes, people like to tell us that :stuck_out_tongue: )

thomas.shipley
2020-10-06 13:28
@matt.fellows happy for you guys to take ownership of it

thomas.shipley
2020-10-06 13:30
I have neglected it a bit I must admit :disappointed: - been on my todo list for a while to spruce up. But could help tidy it under the Pact Foundation banner perhaps?

matt.fellows
2020-10-06 13:33
Don?t feel bad!

matt.fellows
2020-10-06 13:34
It?s a piece of art with 50 stars (I think that?s more than all of our other workshops!)

matt.fellows
2020-10-06 13:34
If you want to transition ownership to pact-foundation, we can start the ball rolling on the upgrade (e.g. the PR from Michael) and then from there, the new format

matt.fellows
2020-10-06 13:34
How does that sound?

thomas.shipley
2020-10-06 13:55
Sounds great :slightly_smiling_face: - happy to transition it :thumbsup:

thomas.shipley
2020-10-06 14:03
@michael_james I can take a look at your PR now

matt.fellows
2020-10-06 14:03
Thanks. I think you need to initiate the transfer. Let us know when it's done and we'll make it happen!

thomas.shipley
2020-10-06 14:08
Looks like I need some permissions to create a public repo on pact-foundation to do the transfer...

thomas.shipley
2020-10-06 14:08
That came up after going through _Transfer Ownership_ in the Danger Zone of my projects repo settings

ruth
2020-10-06 16:00
Hey all! what are the best video resources to learn how to integrate pact and pactbroker into your services?

raghanag
2020-10-06 20:40
thanks @matt.fellows but i do have one question, do you recommend CDC to the consumers who entirely uses SDK?s provided by the providers instead of end points or their own clients. For example if you do then they have to write their own mock providers with their own endpoints in the path like below ```path: '/product/10'``` but provider need not to follow the same endpoint on their end, but the SDK?s they provide will know about all this

raghanag
2020-10-06 21:14
in case if the consumer enters wrong endpoints for their mocking, then the pact file will not be used against provider right? I am trying to understand where this CDC can fit in case of SDK?s instead of own consumer clients

2020-10-06 22:19
A post in *Feature Requests* has been marked as *in progress*

matt.fellows
2020-10-06 22:53
Howtolearn

2020-10-06 22:53
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

matt.fellows
2020-10-06 22:54
There is at least one video course there

matt.fellows
2020-10-06 22:54
We know, we need more!


matt.fellows
2020-10-06 23:05
There are trade offs

matt.fellows
2020-10-06 23:06
I still write pact tests for them

wilkinsweiqiangliang
2020-10-06 23:07
i had a look, we currently still have MAKE file in `example-provider-java-kafka` repo, and from my understanding it mainly handle the `can-i-deploy` script. Also went through some docs in pactDoc, dont see a way we can handle this by gradle or any other plugin. i think we still need to use MAKE?

matt.fellows
2020-10-06 23:14
They?re the examples - we use Make to keep them all consistent.

matt.fellows
2020-10-06 23:14
Make is absolutely not required

matt.fellows
2020-10-06 23:15
`can-i-deploy` is just a CLI call - you can use a docker image or the standalone tools to use it

wilkinsweiqiangliang
2020-10-06 23:15
how does the jvm use can-i-deploy currently? i would assume there is a config in gradle

matt.fellows
2020-10-06 23:15
it doesn?t, there?s no need to have it any any language - we have a CLI for that purpose


wilkinsweiqiangliang
2020-10-06 23:18
i c, i was confused with gradle build process, i was assuming `can-i-deploy` is embedded in the gradle life-cycle. So it run after gradle build as a cli command

matt.fellows
2020-10-06 23:21
yep, that?s what I?d do

ruth
2020-10-06 23:24
Thank you!

wilkinsweiqiangliang
2020-10-06 23:25
cool, thats good point. What about using list of PARTICIPANT, is it anyway to feed in list of PARTICIPANT in cli command rather than putting them one by one? ``` pact-broker can-i-deploy -a, --pacticipant=PACTICIPANT -b, --broker-base-url=BROKER_BASE_URL```

bethskurrie
2020-10-06 23:25
no

matt.fellows
2020-10-06 23:25
What are you trying to achieve?


matt.fellows
2020-10-06 23:26
99% of the time, you just need to put the pacticipant of the service you?re deploying (e.g. the consumer or the provider). It will automatically determine the integrations to check compatibility with

bethskurrie
2020-10-06 23:26
if you have to put in more than 1 pacticipant, you're probably not using the recommended workflow, or you're doing something advanced like checking a mobile consumer where you want to ensure you've verified ALL prod versions, not just the latest.

bethskurrie
2020-10-06 23:27
This is a good doc to read to understand how it works https://docs.pact.io/pact_broker/can_i_deploy

wilkinsweiqiangliang
2020-10-06 23:30
i just thinking it loud atm, what about we had a mono repo that contains a few consumers, instead of verify all of them, i need to workout which one is deploying (maybe all) and generate the corresponding cli command

bethskurrie
2020-10-06 23:31
I'm confused why this is such a thing recently.

bethskurrie
2020-10-06 23:31
Why make microservices if you deploy them all together?

bethskurrie
2020-10-06 23:31
That's just a distributed, coupled monolith.

wilkinsweiqiangliang
2020-10-06 23:31
historical reason lol

matt.fellows
2020-10-06 23:32
it?s very common to deploy serverless architectures (e.g. lambdas) together, for example Beth

bethskurrie
2020-10-06 23:32
the pact is meant to be made on the deployable unit.

bethskurrie
2020-10-06 23:32
so maybe there should just be one pact!

matt.fellows
2020-10-06 23:32
perhaps

matt.fellows
2020-10-06 23:32
But one of the benefits of the broker, is you get this fine grained view

bethskurrie
2020-10-06 23:33
anyway, you would need to either call can-i-deploy once for each of them, or create a selector (--pacticipant A --version X) for each of the sub applications.

wilkinsweiqiangliang
2020-10-06 23:34
cool great. in JVM application we are using, it contains JAVA, lambda, and TS also react in one repo

matt.fellows
2020-10-06 23:34
:exploding_head:

wilkinsweiqiangliang
2020-10-06 23:34
gradle handle the most heavy lifting

matt.fellows
2020-10-06 23:35
you could create a gradle shell task that executes can-i-deploy (or execute the docker image)

bethskurrie
2020-10-06 23:35
so, when you say, can you create a list, then answer is that you can repeat "--pacticipant P --version V" as many times as you like, but you can't say "--pacticipant A B C"

wilkinsweiqiangliang
2020-10-06 23:36
i got the idea now

bethskurrie
2020-10-06 23:36
The CLI docs provide many different examples and should explain it clearly.

matt.fellows
2020-10-06 23:42
FYI can we move this to a new thread if we want to continue it? Just realised we?ve hijacked the hacktober one :grimacing:

bethskurrie
2020-10-07 02:26
@phil.endsley @robbert.van.der.zon @antonello I think I've updated the WIP logic to behave the way we want it to. I've written a bunch of tests to work through all the potential scenarios. This is the one that reflects your usecase @robbert.van.der.zon https://github.com/pact-foundation/pact_broker/blob/2a11c32096/spec/features/wip_pacts_spec.rb#L203

bethskurrie
2020-10-07 02:27
The change I've made to the original logic is that successful verifications that happen when a pact is included as a WIP one do not stop it from being WIP any more. It only stops being WIP for a particular provider tag once it has been *explicitly selected* AND successfully verified.

bethskurrie
2020-10-07 02:28
The outcome of this is that a pact on a feature branch keeps being WIP until it has been merged into master.

bethskurrie
2020-10-07 02:31
One interesting side effect of this change is that if a WIP pact passes verification on master, it is still WIP, BUT it is no longer pending, because I haven't updated the pending logic. I'm not sure if I should or not. Here is the line in the test that shows this behaviour https://github.com/pact-foundation/pact_broker/blob/2a11c32096/spec/features/wip_pacts_spec.rb#L236 It means that a WIP pact *could* now break the provider's build, if it was verified successfully, then a regression was made that caused it to fail. What are everyone's thoughts on this?

bethskurrie
2020-10-07 02:33
@phil.endsley I'm going to start a new thread to discuss your question about changing selectors in the pact broker channel

bethskurrie
2020-10-07 05:41
I've added pages for the recommended configuration for publishing and verifying pacts ? https://docs.pact.io/consumer/recommended_configuration ? https://docs.pact.io/provider/recommended_configuration TODO is to add more details and examples for each language.

bethskurrie
2020-10-07 07:47
Ok, I've given the "pending" issue more thought, and I think it should stay as it is. The consumer may have merged based on the fact that the pact has passed verification, so it shouldn't then go back to being unsuccessful without the provider being alerted to it.

robbert.van.der.zon
2020-10-07 07:54
Seems logical and I think that this would work for me like the way that you described it!

preethighalke
2020-10-07 08:23
Hi, can we order the sequence of the pact interactions in a consumer test? i'm using pact junit/JVM . I see https://github.com/pact-foundation/pact-ruby/issues/48 set as implemented, can you help with the API refernce and usage sample. Thanks & Regards

bethskurrie
2020-10-07 08:23
It's not recommended.

bethskurrie
2020-10-07 08:24
Each interaction should be verified with complete isolation from every other interaction.

preethighalke
2020-10-07 08:24
The verification team is requesting us to send them the interactions in a particular order and i was seeing if there is a possibility

bethskurrie
2020-10-07 08:24
Otherwise we get back into the whole "this test fails because the earlier test didn't work properly" scenario that we have in system integration tests.

bethskurrie
2020-10-07 08:25
The verification team misunderstands how to use pact.

bethskurrie
2020-10-07 08:25
if you cannot use provider states to set up the right data for each interaction, then pact is not a good fit for your situation.



preethighalke
2020-10-07 08:27
I agree but then i was seeing if there is a possibility of setting the order in the consumer test

bethskurrie
2020-10-07 08:27
I can't tell you for pact-jvm, but I strongly strongly recommend against having ordering dependencies.

bethskurrie
2020-10-07 08:28
Get your verification team to chat to us on slack to see if we can help them come up with an alternative solution.

preethighalke
2020-10-07 08:29
i see your point of view sure will try putting across the views

preethighalke
2020-10-07 08:29
many thanks Beth for your quick informative response

bethskurrie
2020-10-07 08:29
you're welcome

preethighalke
2020-10-07 08:29
have a good evening

preethighalke
2020-10-07 08:29
thanks again

bethskurrie
2020-10-07 08:30
when pact is used in ways that it is not designed for, it can make life as bad as when you're using integration tests. I don't want you to get stuck there!

preethighalke
2020-10-07 08:31
i agree somewhere i'm seeing they are driving this to be a semi integration test instead of what it is meant for

bethskurrie
2020-10-07 08:32
best to use a different tool for that, in my opinion

bethskurrie
2020-10-07 08:32
right tool for the right job.


preethighalke
2020-10-07 08:32
agree

bethskurrie
2020-10-07 08:32
good luck!

preethighalke
2020-10-07 08:33
:slightly_smiling_face: thank you

dothetan.040490
2020-10-07 09:14
has joined #general

sklein
2020-10-07 15:01
anybody have a general demo workflow they use to introduce how pact works to others that they'd be willing to share. Just looking for something simple like 1. create the consumer contract 2. implement the provider validation 3. change the consumer contract... etc etc etc

phil.endsley
2020-10-07 18:12
Looks like there was an update to the rules. There's some work needed by maintainers in order for PRs to be officially "counted" towards the event. https://hacktoberfest.digitalocean.com/hacktoberfest-update

tjones
2020-10-07 22:41
Good catch @phil.endsley ! I've added that tag to pact-js and pact-node

matt.fellows
2020-10-07 22:44
awesome, thanks!

marko.justinek
2020-10-07 22:56
The few issues perfect for Hactoberfest in https://github.com/surpher/PactSwift/projects/3 repo have been collated in a Hactoberfest 2020 project :thumbsup:

dagostino.remy
2020-10-07 23:03
has joined #general

matt.fellows
2020-10-07 23:04
Don?t forget to add the `hacktoberfest` topic too Marko!

marko.justinek
2020-10-07 23:07
yep, will do

matt.fellows
2020-10-08 00:09
I have one I do with Pactflow customers Sean, I can?t recall if I did it with you (I think not because you did a lot of homework).

matt.fellows
2020-10-08 00:09
Happy to share the demo deck and example projects I use?

matt.fellows
2020-10-08 00:14
Just dropped you an email with some stuff

matt.fellows
2020-10-08 00:14
It?ll all eventually be made public, just not fully tidied up yet

matt.fellows
2020-10-08 00:15
Happy to chat with the team also if that would be helpful!

abhi.nandan
2020-10-08 06:38
has joined #general

sambitkumar.pal
2020-10-08 09:17
I am running consumer driven contract test using pact broker inside codefresh. Pact broker webhook will execute only when the specified event occurs. So for 1st time when contract published by consumer then webhook will create. But the webhook will not trigger the provider build because the event has not occur (1st time) . Then if we need to again run consumer build to recognise the event. Can you please help me to know how I can execute the webhook http request in 1st time itself when it created.

giuseppe.salvatore
2020-10-08 12:30
Hi everyone, I know this might sound a silly question but is there any way from the broker to get easy to read information about the interactions that failed on the provider? I know you can have that info from the inspector and look into response body but it's kind of complicated to find what you are looking for. Also when you get the diff between expected and actual it is a bit difficult to immediately understand what's wrong... something like this ```"class": "RSpec::Expectations::ExpectationNotMetError", "message": "Actual: {\"code\":\"60\",\"message\":\"Resource not found\"}\n\nDiff\n--------------------------------------\nKey: - is expected \n + is actual \nMatching keys and values are not shown\n\n {\n- \"threeMonthAverages\": {\n- \" ... }\n }\n\nDescription of differences\n--------------------------------------\n* Could not find key \"threeMonthAverages\" (keys present are: code, message) at $\n" ```

matt.fellows
2020-10-08 12:32
Not in the OSS broker, I think there is a feature request for that (somewhere on GH)

giuseppe.salvatore
2020-10-08 12:32
Thanks Matt... good to know


giuseppe.salvatore
2020-10-08 12:33
yeah our next step was to take a look at the Pactflow and see if it fits our needs

przemyslaw.dabrowski
2020-10-08 12:36
has joined #general

giuseppe.salvatore
2020-10-08 12:37
@matt.fellows is the developer plan limited in time or just in features/contracts?

giuseppe.salvatore
2020-10-08 12:47
just signed up

matt.fellows
2020-10-08 13:06
:wave:

matt.fellows
2020-10-08 13:06
just limited in features/contracts

matt.fellows
2020-10-08 13:06
Drop me an email, and I can bump your limits - are you doing a PoC with your team?

giuseppe.salvatore
2020-10-08 13:07
I did already last week and it went so well other teams wanted to hear more

giuseppe.salvatore
2020-10-08 13:08
and managers asked me to evaluate the Pactflow

giuseppe.salvatore
2020-10-08 13:08
is it ok if I let you know a few days before the other demo to bump the limits?

giuseppe.salvatore
2020-10-08 13:08
I don't want to take advantage of the kind offer :wink:

matt.fellows
2020-10-08 13:10
Of course :stuck_out_tongue:

emiliano.righi
2020-10-08 13:25
has joined #general

sklein
2020-10-08 13:31
Champion! Thank you!

emiliano.righi
2020-10-08 13:48
Hi everyone, I am testing a webhook that triggers a jenkins x build. ```{ "consumer": { "name": "api-v2" }, "provider": { "name": "some provider" }, "request": { "method": "POST", "url": "http://jenkins.jx.mydomain.com/job/....../build", "username": "<my username>", "password": "<some-password>", "headers": { "Accept": "application/json" } }, "events": [ { "name": "contract_published" } ] }``` And I get a HTTP 403 ``` "x-you-are-authenticated-as": "anonymous", "x-you-are-in-group-disabled": "JENKINS-39402: use -Dhudson.security.AccessDeniedException2.REPORT_GROUP_HEADERS=true or use /whoAmI to diagnose", "x-required-permission": "hudson.model.Hudson.Read",``` It seems to me the my execution is not sending my credentials since it reports I am authenticating as anonymous. I confirm that my credentials work and I have tested jenkins build with curl successfully. Thanks for the help.

robbert.van.der.zon
2020-10-08 14:58
Hi all! I am a big fan of BDD. We try to create a functional test for each feature we are creating. Our current landscape is that we have 16 microservices working together. All these services are owned by our own team. Besides these 16 microservices, we have some other external services. We currently have an end-to-end test setup that mocks all external services but our own 16 microservices are all connected in these tests. All our BDD functional tests are inside these end-to-end tests. We have a big trust in these tests and have the feeling that we can pretty easy change any microservice, and if the end-to-end tests succeed, we know that we can safely deploy our code. But the more microservices we get, the more difficult it gets to run these tests locally, and the more features we get, the longer it takes to run these tests. We are now looking for a way to reduce the end-to-end tests, and do more contract testing and functional testing within the microservices itself. But I have a hard time trusting that way of testing the same way as I have with the end-to-end tests. Now we have all our functional tests together in one git-repo. This is very clear and organized. Also, from a functional point of view, I don?t care which microservice is responsible for some functionality, I just want something some behavior to be done by the system, and that is what I test. E.g. given some input, we want an order to be created in our SAP system. Our end-to-end test just test that we call SAP with the correct payload to create the order. It doesn?t matter which microservice does that. If we move our functional tests out of our global end-to-end tests, and to the microservices itself, then I am afraid that we lose a good view on it. It gets scattered around. Also, the tests needs to know a bit more about how the microservices work together. I have a hard time to get an idea how to do this, with the same trust as we have right now. I know that having one big set of functional tests will not be able to work as we keep growing. I am trying to look for documentation, books or video?s of how to do BDD (with a lot of functional tests), but with a minimum of end-to-end tests (only for checking the connection between the services) and with contract tests to test the interaction between our microservices and more functional test within the microservices itself. Since you are all doing contract testing, I was hoping that someone can lead me in the right direction.

jarmy
2020-10-08 16:26
I was able to get this to work by using a token. Here?s an example: ```{ "description": "Trigger GraphQL Acceptance Test Job on contract_content_changed event from Pegasus", "provider": { "name": "graphql" }, "consumer": { "name": "pegasus" }, "events": [{ "name": "contract_content_changed" }], "request": { "method": "POST", "url": "https://listeners.jenkins-sb.savagebeast.com/job/listeners-acceptance/job/graphql/job/DEVTOOLS-610-test-pact-broker-webhooks/buildWithParameters?os_authType=basic&environment=shared&graphqlHost=shared.graphql.docker.savagebeast.com", "username": "<USERNAME>", "password": "<TOKEN>", "headers": { "Accept": "application/json" } } }```

emiliano.righi
2020-10-08 16:44
Thanks a lot Jason, I am going to try it.. :slightly_smiling_face:

wilkinsweiqiangliang
2020-10-08 20:15
Hi everyone, im getting ```au.com.dius.pact.provider.junitsupport.loader.NoPactsFoundException at PactJUnit5VerificationProvider.kt:426``` in gradle build while the pact file is available in pactflow. And tried to run in idea, it pass. any suggestion?

phil.endsley
2020-10-08 20:16
I'd ask in the language channel for specific questions #pact-jvm

wilkinsweiqiangliang
2020-10-08 20:29
Thanks @phil.endsley

cariaga.bh
2020-10-08 21:03
has joined #general

wilkinsweiqiangliang
2020-10-08 21:25
The issue is being a mistake of pass the token into the docker container, i think the exception is a bit misleading.

jarmy
2020-10-08 23:22
I had a question about https://docs.pact.io/provider/recommended_configuration/. Specifically, how would one verify a contract they?re developing using `consumerVersionSelectors`? Would we just add a selector to the Pact verification test that matches the tagged branch from the consumer test and then remove that selector before merging? Here?s how we have our selectors currently defined ``` consumerVersionSelectors = [ VersionSelector(tag = "develop"), VersionSelector(tag = "mobile-test"), VersionSelector(tag = "DEVTOOLS-641-integrate-pact-consumer-test"), VersionSelector(tag = "production", latest = false.toString()) ]``` Currently, if I exclude the consumer _branch_ tag, the provider verification fails with ```au.com.dius.pact.provider.junitsupport.loader.NoPactsFoundException: No Pact files were found to verify Provider: pegasus Source: Pact Broker https://pact-broker.docker.savagebeast.com: consumerVersionSelectors=[ConsumerVersionSelector(tag=develop, latest=true), ConsumerVersionSelector(tag=mobile-test, latest=true), ConsumerVersionSelector(tag=production, latest=false)] ``` This puts the provider in a bind since they can?t get a PR build to pass until the consumer merges their branch into develop.

abubics
2020-10-08 23:23
Hey :smile: first of all, it sounds like you have great coverage and rigour, so congratulations! :tada:

abubics
2020-10-08 23:24
I also love BDD as a testing lens & direction. I write my unit tests in that style, for high coverage, and usually have only a light touch on functional end-to-end tests, as a post-deploy smoke test, before re-routing traffic.

abubics
2020-10-08 23:26
My initial advice would be, don't try to replace or get rid of your functional tests in favour of contract tests. They bring great confidence (as you know), but grow combinatorially. Rather, be exhaustive with unit tests (and Pact is basically unit tests for the network interface), and less exhaustive with integrated tests.

campellcl
2020-10-09 00:06
has joined #general

bethskurrie
2020-10-09 05:52
@jarmy does this answer your question https://docs.pact.io/provider/recommended_configuration

bethskurrie
2020-10-09 05:53
I can't see from that config why there are no pacts though

bethskurrie
2020-10-09 05:54
Seems like a bug to me. It should be finding all the other pacts.

bethskurrie
2020-10-09 05:54
Also, if this is a pact-jvm question, best to ask it in #pact-jvm



bethskurrie
2020-10-09 05:59
As the wonderful @abubics says, pack as much as you possibly can into the pact tests (you won't be able to cover everything, but do as much as makes sense) and then start removing e2e tests that are basically just there to make sure the right calls are being made.

bethskurrie
2020-10-09 05:59
keep the ones that are ensuring that the overall business value of your system is being delivered.

mateusz.derks
2020-10-09 06:53
> The outcome of this is that a pact on a feature branch keeps being WIP until it has been merged into master. How is it determined that the feature was merged into main branch? Does it compare content of the pact with the selected tags?

bethskurrie
2020-10-09 06:53
yes

bethskurrie
2020-10-09 07:02
To summarise, "successful verification of a pact version (ie. the content) when it has been explicitly selected for verification causes it to not longer be included as a work in progress pact"

matt.fellows
2020-10-09 08:00
He did mention that page explicitly Beth, so i hope so :joy:

emiliano.righi
2020-10-09 09:43
Sadly same problem. I wonder what I am doing wrong.

elenitsaa043
2020-10-09 10:00
has joined #general

phil.endsley
2020-10-09 10:35
Does the provider have any of the other tags published yet (develop, mobile-test, or production)? Is this the first set of pacts? If so, I think the usual advice given is "do what you need to to get the first set in, since that's an abnormal case". We usually use `@IgnoreNoPactsToVerify` for the first pacts being implemented, then remove it on a later PR If that's not the case, something else is wrong here (likely just config)

adriangabrieloros
2020-10-09 11:05
has joined #general

emiliano.righi
2020-10-09 12:35
I have tried allowing anonymous login in jx and it worked.

jarmy
2020-10-09 15:40
Woot! Nice that you have control over your Jenkins infra.

jarmy
2020-10-09 16:31
This _is_ the first set of pacts and seems to be a chicken and egg problem. I can use Phil?s suggestion on `@IgnoreNoPactsToVerify` to workaround the issue.

jarmy
2020-10-09 16:33
Phil, correct me if I?m wrong but I think you meant to say ?Does the _consumer_ have any of the other tags published yet (develop, mobile-test, or production)??

phil.endsley
2020-10-09 17:39
Yes, thank you. Definitely what I meant :slightly_smiling_face:

jarmy
2020-10-09 17:40
phew. thanks for confirming

robbert.van.der.zon
2020-10-09 19:08
I?ve read (parts) of the ?practical test pyramid? of Fowler before and actually one thing he says has always triggered me: _?The concept of acceptance tests - proving that your features work correctly for the user - is completely orthogonal to your test pyramid?_.  I?ve used that as a confirmation that it?s logical that we do not follow the test-pyramid because when you do BDD, you have so many end-to-end tests (in our case). After re-reading the article again, I see that he also says that functional tests doesn?t have to be at a high level (as end-to-end tests), but when possible you can move them to a lower level (as unit tests or component tests). He is basically giving the same advice as @abubics and @bethskurrie are giving me. I will take that advice and see if we can move some functional tests to the services itself and remove them from the end-to-end test suite. That will however scatter our functional tests (which are now all nice together) to the different microservices. But because that are written in gherkin it?s perhaps more easy to distinct the functional tests from the rest of the tests.  Since we see our functional tests as our functional specification of the application, it would be nice to easily show all these tests somewhere. Since they are not in 1 git repo anymore this way, we can perhaps create an agent that scan?s all repo?s and put all functional tests together on a wiki. Not sure if this is really needed however and how that would look like. Perhaps also a bit overkill, but perhaps also handy. I think I need to give this all a bit more thoughts. Thanks anyway for your responses!

wilkinsweiqiangliang
2020-10-10 04:28
When using spring/junit 5, like springbootTest annotation, and gradle command to run `pactVerify` . Any example? im getting connection refuse on 8080. seems i need to start the app in gradle.

wilkinsweiqiangliang
2020-10-10 04:32
seems like i should be use something similar to this ``` task startTheApp(type: SpawnTask) { commandLine 'java', '-jar', '../test_provider/build/libs/test_provider-all.jar' waitFor 'Ratpack started for http://localhost:5050' } task killTheApp(type: KillTask) { kills startTheApp }```

matt.fellows
2020-10-10 08:46
Might be better of asking in #pact-jvm

sh.ilgam_pact
2020-10-11 16:12
has joined #general

matt.fellows
2020-10-12 00:00
:wave: Happy Monday everyone! I wanted to share some exciting community news. Next week @antonello will be representing Pact at an API testing panel - it is shaping up to be quite in interesting conversation: https://commited.tech/events/api-testing-panel-discussion/ Topics on the agenda: ? The mechanics of API testing ? The differences in approaches of different tools ? The best features of known tools ? QA Processes when using API test automation ? How API Automation should influence Unit&Integration&e2e testing ? The role of Contract Testing Get along to support him, or if (like us) it?s going to overlap with your sleep you can stream it after on Youtube.

matt.fellows
2020-10-12 00:10
In the second announcement, Pierre Vincent (long time pact advocate) will be running a Pact workshop at Testbash Netherlands, including CI/CD integration. If you?d like to get hands-on and gain some wisdom from somebody who?s also a leader in the DevOps field, I?d highly recommend it: https://www.ministryoftesting.com/events/testbash-netherlands-online-2020-workshops-day

aforeman
2020-10-12 00:39
Awesome @antonello!

abubics
2020-10-12 00:56
Sounds like you've got an adventure ahead of you :party_parrot:

bethskurrie
2020-10-12 00:57
@robbert.van.der.zon this is one of the trade-offs that gets made when moving to microservices!

bethskurrie
2020-10-12 00:58
The downside of splitting prod code up is that you then need to either split your test code up too, OR you end up re-coupling your prod code in the test code.

abubics
2020-10-12 00:58
One thing I think you'll find is with the functional tests split across multiple repos, you'll get a more granular picture of things that may be broken at any time, rather than the entire functional spec being partly broken. And just because one part is currently not deploying doesn't mean the spec is broken :sunglasses:

abubics
2020-10-12 01:06
Yeah, good to ask in #pact-jvm . . . but yes, if you don't want to specify the provider side as unit tests, you'll need the app to be running, with a state-change endpoint available.

robbert.van.der.zon
2020-10-12 05:33
@abubics: I am not sure that I understand what you mean.

abubics
2020-10-12 05:35
One part of what I"m saying is: rather than relying on inspecting build artifacts to see which part of the tests is broken, you'll have more granular builds and test sets that break.

abubics
2020-10-12 05:37
The other is: once you're further down the https://docs.pact.io/pact_nirvana/, you'll be able to tell that your components don't work together before you've deployed them.

abubics
2020-10-12 05:39
The goal here is to reduce cycle time, while still maintaining confidence :ok_hand: More granularity means less hunting through test outputs, and more specific tests that require less interpretation.

mcruzdrake
2020-10-12 09:47
This is great! Thanks for sharing :slightly_smiling_face: I will share it to my team

anastasiia.bielik
2020-10-12 11:13
has joined #general

robbert.van.der.zon
2020-10-12 11:13
I understand that you get a quick feedback when each microservice has a good set of contract tests and a set of BDD tests to verify that the functional specification of this microservice are met. But I can also imagine that if you have a system with 30 microservices, each having their own functional specifications (and their corresponding BDD tests), that it will be hard to get the confidence that all these separate functional specifications are drawn up in such a way that the global system specifications will be met for all situations.   For the system as a whole, you only do a smoke test, and trust that all the individual specifications are sufficient. I think that it depends on the kind of system that you are building to see that as a problem or not.

hamzahuk
2020-10-12 11:40
Hey all, I have a question (probably a couple!) and am looking for a little help. I'd like to get a better understanding of the journey of a contract, more so for a CI perspective. I've created a contract on the consumer side, great. I can then relatively easily upload this to our pact broker. Happy days! Its at this point I'm a little unsure about the journey. Pact tests will run on every new build of the app. I would only like to publish a new contract (with a new version) if the contract has changed which would trigger some downstream builds to occur and verify against the new contract. My issue is that I don't always want to publish - in the majority of cases, the contracts will be unchanged. How do I make this decision? Does the pact broker provide a simply compare before publish API? Any such functionality I can add to my publish script (this is all javascript using pact-js). In my head all I need to do is a diff (except the version) on the contracts to determine whether any further downstream work is required. I can see that via the broker I can pull an existing pact and then handball the diff if I need to. Is there a better way to do this? I guess I'm looking for a "isUpdated" check against the existing contract. Anyhow, thank you in advance for any help :)

matt.fellows
2020-10-12 12:36
Just on mobile so I wont be able to provide a detailed response. But, don't fear publishing to the broker, it is clever enough to detect changes in the contract. If the contract hasn't changed the version of the consumer will already be compatible with any provider that has verified it

antonello
2020-10-12 12:37
My recommendation would be to publish every time. The broker knows if the pact has changed between different uploads. It?s important to always upload so that a corresponding pacticipant version is created on the broker for every consumer pipeline, regardless of whether the content of the pact has changed.

matt.fellows
2020-10-12 12:37
Can-i-deploy is the feature that gives you the check

matt.fellows
2020-10-12 12:37
See the effective pact / CI/cd guide on our docs

matt.fellows
2020-10-12 12:38
Also the CI/CD workshop in howtolearn :point_down:

2020-10-12 12:38
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

antonello
2020-10-12 12:39
As @matt.fellows says, can-i-deploy will tell you if the contract you have publish is ?pre-verified?, which means that you can skip the provider verification. If you decide to use webhooks - they can be triggered only when the content of the pact changes.

hamzahuk
2020-10-12 12:51
Ace, don't know why i didn't think of that. @antonello just a quick check, the can-i-deploy hook, when you say content has changed, that excludes the version?

antonello
2020-10-12 12:53
Mixing two things here: `can-i-deploy` is a command exposed by the pact cli, which can tell you whether a specific consumer version is compatible with one or more providers. If the a pact was verified before and the content has not changed, then it would be considered pre-verified. The webhook mechanism is different: it?s a request that the broker can make on your behalf to trigger the provider?s pipeline, which can be conditional on whether the content of the pact has changed.

antonello
2020-10-12 12:54
If with version you meant the pacticipant version, that is excluded yes - it?s only based on a hash of the pact content (the pact file), which doesn?t include the pacticipant version (it?s an external concept to the pact file).

antonello
2020-10-12 12:55
But be mindful that nothing should change in the content of the pact, as in the data needs to be static.

hamzahuk
2020-10-12 13:03
I see - apologies for the confusion - I'm specifically talking about the consumer version sent on a publish: consumerVersion: '1.0.1' < this will be updated per build but that doesn't mean that the contract has changed - so lets say a bug fix triggers the build, the pact test will run and the version on merge will go to 1.0.2 - If the contract should be kept in sync with 1.0.2 then thats fine but I wouldn't want this to trigger a build because the content of the pact hasn't been updated. @matt.fellows that implementation guide looks great, I must of have missed this.

antonello
2020-10-12 13:04
yes, that consumer version has nothing to do with the checks we were talking about.

hamzahuk
2020-10-12 13:04
(also, apologies, I should have spent more time browsing the website :persevere:)

hamzahuk
2020-10-12 13:04
Brill, thanks guys - mega helpful!!

antonello
2020-10-12 13:06
if the content of the pact published by v 1.0.1 was `abcd` and then v 1.0.2 publishes again `abcd` , if your provider had already verified 1.0.1, then 1.0.2 will be considered pre-verified (provided that we?re talking about the same provider version, if the provider version has changed, its own pipeline will have to verify the latest version published by the consumer, which is why it?s important to always publish regardless of whether the pact has changed).

deepika.krishnakumar
2020-10-12 15:03
has joined #general

emiliano.righi
2020-10-12 15:46
It worked changing pact-broker version?

2020-10-12 20:42
A post in *Feature Requests* has been marked as *closed*

anbansal27
2020-10-12 23:02
has joined #general

anbansal27
2020-10-12 23:28
Hi Team, I am currently looking out for a solution to integration test event driven systems using RabbitMq as the messaging platform. Does Pact support it ? If yes, please could you help me with links to some resources ?

matt.fellows
2020-10-13 00:05
Message Pact is the term we use for this. Which language are you using? Not all support it natively at the moment

anbansal27
2020-10-13 00:17
I am using C# with .Net Core

matt.fellows
2020-10-13 00:24
You should ask in #pact-net to get the current state of affairs, I think you may need to use an beta/experimental branch

anbansal27
2020-10-13 00:26
Will do, thanks Matt

olarrmide
2020-10-13 00:47
Hi Folks, anyone have experience successfully running pact-node from a windows mapped network drive? I am able to install the npm packages but starting my tests throws this error: _CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows Directory._

bethskurrie
2020-10-13 00:47
There's a challenge. Best to ask in #pact-js

olarrmide
2020-10-13 00:49
Thank you @bethskurrie

bethskurrie
2020-10-13 00:49
:taco: for @antonello for being the person who I think understands the internals of the broker logic almost as well as I do!

abubics
2020-10-13 01:40
Of course this is a valid concern :slightly_smiling_face: It necessitates a shift in perspective and trust, otherwise you'll have to keep thorough integrated tests. During the transition, you'll discover gaps, and need to work out how to fill them to replace that confidence.

bethskurrie
2020-10-13 01:42
The old confidence/agility tradeoff.

abubics
2020-10-13 01:44
To that end, you'll want to de-risk your changes, do them in small chunks while you regain the confidence that you need. Definitely don't try to migrate everything at once :innocent: And actively work out what kinds of confidence you need at each level, and how you can measurably test that.

bethskurrie
2020-10-13 01:47
:taco: for @abubics for always having excellent advice

prabhakar.thippa
2020-10-13 04:58
has joined #general

robbert.van.der.zon
2020-10-13 05:56
We?ll take the advice and won?t migrate all at once. I am actually looking forward to that process and get some more experienced in this. Thanks for your advices!

giadinhluong
2020-10-13 06:24
has joined #general

sagupta
2020-10-13 08:09
Hi folks, I was asked this question by my colleague about the CI CD pipeline with contract tests and looking for answers for it. We have a CI pipeline for provider where we included a job `test-contract` which fetches the latest pact for consumer with the tag `master` . Now as per pact nirvana, I have included a pre-deploy job for can-i-deloy where i am checking if the provider with version xxx can be deployed to master env . Now why do we need a can-i-deploy check when we are already fetching the same contract and verifying it in the `test-contract` job?

bethskurrie
2020-10-13 08:12
Hi @sagupta

bethskurrie
2020-10-13 08:12
"The need for this check increases proportionately with the time that elapses between your pact test execution and your release. If you practice continuous deployment, and you go straight from a test build into a production deployment build, then you can be pretty sure that the version of the other application that is in production probably hasn?t changed in the meantime. If there is a considerable amount of time, however, it is best to do a compatibility check again just before deploying. For example, if you run a pact verification on Monday that verifies the recommended ?master? and ?production? pacts, but you don?t deploy the provider artifact until Friday, the version of the consumer that is now in production may have changed. Alternatively, a pact may have been verified by the ?master? version of the provider, but that version of the provider may not yet have been deployed to production. The consumer cannot be deployed to production until the version of the provider that it depends on is in production (unless it has been specifically written to fail gracefully, which is actually the best approach, but is one that isn?t always followed)."


bethskurrie
2020-10-13 08:13
Another answer is, when you use the "pending" feature (which stops your provider build from breaking when a consumer changes a pact), you need the can-i-deploy check to make sure that you're safe to deploy, because the build won't necessarily fail to tell you so.


sagupta
2020-10-13 08:14
ahh right so what i wrongly assumed is that , we will be running pre-deploy job with all commits which is not the case , it will be run only for master refs

bethskurrie
2020-10-13 08:15
on a branch, can-i-deploy can act as a "can-i-merge", depending on how you configure it. but no, it's not strictly necessary on feature branches.

sagupta
2020-10-13 08:16
ok and indeed we dont do continuous deployment and the consumer version could change during that time so can-i-deploy protects us from that change

bethskurrie
2020-10-13 08:17
:100:

sagupta
2020-10-13 08:17
thanks Beth for this nice explanation

bethskurrie
2020-10-13 08:26
You're welcome

matt.fellows
2020-10-13 08:27
@bethskurrie deserves a :taco:. In fact, many a :taco:

bethskurrie
2020-10-13 08:39
I just got an extremely cantankerous 4 year old through bath and bed time. I deserve more than a taco for that!

florian.nagel
2020-10-13 08:40
@bethskurrie Maybe two tacos? :flushed: :taco: :taco:

pavank
2020-10-13 08:41
has joined #general

bethskurrie
2020-10-13 08:41
And a :wine_glass:

bethskurrie
2020-10-13 08:41
and :chocolate_bar:

sagupta
2020-10-13 08:42
@bethskurrie Thanks for your quick help today . Really appreciate it :taco: :taco:

sagupta
2020-10-13 08:44
tried giving taco to Beth but i posted in the channel and not in this thread :stuck_out_tongue: sorry

bethskurrie
2020-10-13 08:45
haha, appreciated anyway

stephane.meng
2020-10-13 09:06
has joined #general

abirlal.bose
2020-10-13 09:45
has joined #general

michael.west
2020-10-13 14:04
has joined #general

raghanag
2020-10-13 20:26
Sorry to bother you again, if the consumers are using either SDK or direct interaction with provider API?s and if the provider already released the openapi3 or swagger spec, and always supports backward compatibility. Is there any reason to write contract testing, if not can we skip integration testing and replace it with contract testing so that it would be cheap and faster. Other than that my team dont see any value, could you please let me know some strong points on how to convince them.

raghanag
2020-10-13 20:26
@matt.fellows


abubics
2020-10-14 07:09
Where's the link that sent you there?

abubics
2020-10-14 07:10
(i.e. what's the referrer page?)


young
2020-10-14 07:25
thank you

young
2020-10-14 07:25
Pls update it

abubics
2020-10-14 07:28
thanks for the link . . . just need to find someone who knows where to update it :stuck_out_tongue:

young
2020-10-14 07:28
:rolling_on_the_floor_laughing:

young
2020-10-14 07:29
@matt.fellows Can you update the link? Thanks.


abubics
2020-10-14 07:37
if you know where it's meant to point

young
2020-10-14 07:46
Actually I don't know what the new link it is :joy:

abubics
2020-10-14 07:48
oh no :joy:


abubics
2020-10-14 07:53
there are a few different "provider states" pages for each of the build tools, too . . . if you use the on-page search, you might find the one you want

young
2020-10-14 07:54
thank you .

mateusz.mrzyglod
2020-10-14 09:32
has joined #general

cathleen.yuan
2020-10-14 11:16
has joined #general

ramana.jaladurgam
2020-10-14 16:10
has joined #general

alik.berezovsky
2020-10-14 18:38
has joined #general

a.robecke
2020-10-14 19:24
has joined #general

mikahchapman
2020-10-14 21:47
has joined #general

mikahchapman
2020-10-14 21:59
So, I've been working with pact for a while now and it's finally starting to really pick up in our company (yay!). I've been asked a few times about minimizing the number of provider states or sharing a provider state for multiple interactions. I can see some value if you expect the provider to be in the same state, but what's the best practice here? I feel like you want to be fairly specific with the state that you expect the provider to be in, so while sharing states reduces how much you need to maintain on the provider side, it forces the provider state to be more generic (like `entity with id 1 exists`).

hem_kec
2020-10-15 00:44
has joined #general

abubics
2020-10-15 05:42
There are a few paths that people like to take this issue down . . . especially the 2 you've already mentioned. It's definitely an "it depends" problem, because a lof os characteristics affect a desirable outcome.

abubics
2020-10-15 05:43
Personally, I like to keep state descriptions as vague as possible, while maintaining unique significance.

abubics
2020-10-15 05:45
But there are strategies around ? structuring state aspects (i.e. applying orthogonal state pieces from the description), ? making the states parametrically data-driven, ? shared state fixture repos, ? and probably others.

abubics
2020-10-15 05:46
I think there was some v3 or v4 work to provide structured state data, but I haven't used it.

matt.fellows
2020-10-15 08:00
FYI I?ve just scratched together a draft getting started workshop using Katacoda, an in-browser workshop experience. In it, you learn how to create your first contract, publish it to the Pact Broker/Pactflow, verify it on your provider and learn how to gate deployments using the `can-i-deploy` tool. It uses Pact JS but should extrapolate to any language. If you?re new to Pact and/or are willing to share feedback, I would sure love it! Try it out here: https://katacoda.com/mefellows/scenarios/pactflow-getting-started-js

marco.cordeiro
2020-10-15 10:54
has joined #general

giuseppe.salvatore
2020-10-15 13:38
I tried to register for this specific even but it looks like following the subscription link I subscribed to Committed and didn't get any link to the event. Does anyone know how this works?

antonello
2020-10-15 13:44
@giuseppe.salvatore I *think* that the event will be accessible even without registering, but I?m asking

betty.he
2020-10-15 14:32
has joined #general

joel.whalen
2020-10-15 14:48
I was just about to paste this link to my team but got this :disappointed:

sagupta
2020-10-15 14:59
Hello folks, I am using pact cli to verify the provider side. Now i have setup a job in gitlab to fetch the latest contract from consumer xxx with tag master whenever there is a change in provider. Also a provider verification job is triggered from the webhook when a consumer pact is changed , now i am not sure if i need a separate job if build is triggered via webhook ?

seda.urguplu6
2020-10-15 15:09
Hi everyone. I wrote only a basic consumer side test using pact-python. It takes more than 1 minute for start_service() method to run. Also as I see in the pact-mock-service.log, test completed in 4 minutes. Is there a problem with me or is it a normal situation?

brendan.donegan
2020-10-15 16:08
Seeing the same - it appears to be down @matt.fellows

raghanag
2020-10-15 18:10
Hi All, I am using swagger-mock-validator from Atlassian to verify pacts with openapi3 spec, when I use it, I am getting below error. Has anyone used https://bitbucket.org/atlassian/swagger-mock-validator/src. If so could you please let me know how to fix the below issue? ```Error: unknown format "int64" is used in schema at path "#/allOf/1/allOf/0/properties/PrimaryBillingAddressId"```

matt.fellows
2020-10-15 21:10
That is not normal, no

matt.fellows
2020-10-15 21:11
Do you have a virus checker it something blocking things? Could you elaborate more on your setup please?

matt.fellows
2020-10-15 21:11
This channel is for pact support, probably best asking the folks over at atlassian?

matt.fellows
2020-10-15 21:18
It seems to show it getting a number when perhaps it's not defined as a number in the pact / swagger file?

matt.fellows
2020-10-15 21:21
Gah!

raghanag
2020-10-15 21:21
it is defined as int64 in spec file and in pact file it is actually a number ``` "PrimaryBillingAddressId": 3,``` ```"PrimaryBillingAddressId": { "type": "integer", "format": "int64", "readOnly": true, "nullable": true, "x-hints": { "precision": 18 } }```

matt.fellows
2020-10-15 21:22
That's what happen when you push a "minor" edit and run

matt.fellows
2020-10-15 21:22
Sorry all - fixed

matt.fellows
2020-10-15 21:23
What's the pact look like?

matt.fellows
2020-10-15 21:23
Maybe it doesn't recognise any int64 as a valid format?

matt.fellows
2020-10-15 21:24
Upon reflection it does appear that might be it actually

raghanag
2020-10-15 21:26
this is my pact ```{ "consumer": { "name": "fodConsumer" }, "provider": { "name": "crmRestApiProvider" }, "interactions": [ { "description": "a request to get a FodOrder", "providerState": "a FodOrder with ID 300100185754393 exists", "request": { "method": "GET", "path": "/fodOrders/300100185754393" }, "response": { "status": 200, "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "OrderId": 300100185754393, "OrderDate": "2020-10-08", "BasketFlag": "N", "OrderStatus": "DRAFT", "CustomerId": 3, "CurrencyCode": null, "TotalAmount": 0, "ShipToAddressId": 3, "BillToAddressId": 3, "Comments": null, "CreatedBy": "HELPADMIN", "CreationDate": "2020-10-08T20:19:39+00:00", "LastUpdatedBy": "HELPADMIN", "LastUpdateDate": "2020-10-08T20:19:39.283+00:00", "ObjectVersionNumber": 1, "AttachmentEntityName": "fodOrders", "PrimaryBillingAddressId": 3, "CustomerId1": 3, "ObjectVersionNumber1": 1, "PrimaryShippingAddressId": 3, "BillingAddressLine1": "400 Oracle Pkwy", "CustomerAddressId": 3, "ObjectVersionNumber2": 1, "BillingAddressLine2": "2op123", "BillingAddressCity": "Redowood City", "BillingAddressCountry": "US", "BillingAddressPostalCode": "94065", "BillingAddressState": "CA", "ShippingAddressLine1": "400 Oracle Pkwy", "CustomerAddressId1": 3, "ObjectVersionNumber3": 1, "ShippingAddressLine2": "2op123", "ShippingAddressCity": "Redowood City", "ShippingAddressCountry": "US", "ShippingAddressPostalCode": "94065", "ShippingAddressState": "CA", "CustomerFirstName": "Gary", "CustomerLastName": "Jenkins", "OrderNumber": "F300100185754393" }, "matchingRules": { "$.headers.Content-Type": { "match": "regex", "regex": "^application\\/json" }, "$.body": { "match": "type" } } } } ], "metadata": { "pactSpecification": { "version": "2.0.0" } } }```

bethskurrie
2020-10-16 01:31
@sagupta the recommended approach is to have two different jobs. One for the webhook, that just verifies the changed pact, and one for when the provider does its own build, that verifies the test/prod pacts for every consumer.




bethskurrie
2020-10-16 01:34
The webhook triggered job is likely to fail a lot, because its where the changes are introduced. It's best to keep this out of your main provider pipeline, because you only want the "serious" failures to block your main provider build.

bethskurrie
2020-10-16 01:35
Are you running the test on a Docker image?

bethskurrie
2020-10-16 01:36
Yes. v3 allows you to specify multiple states that are in place at the same time as well.

matt.fellows
2020-10-16 06:08
FYI I?ve moved them to the pact org and have split them into 2 workshops: https://katacoda.com/pact

matt.fellows
2020-10-16 06:09
I?m really liking the platform, and I can see us creating lots of short and sharp workshops for different languages/tools, to teach a specific thing (e.g. publish a contract with Node or Java)

antonello
2020-10-16 08:43
Apparently a Play button will appear on the page just before the event!

tamer
2020-10-16 09:08
has joined #general

giuseppe.salvatore
2020-10-16 10:22
Thanks a lot, will share that info with my team

matt.fellows
2020-10-16 10:29
I?d ask the authors of the tool, sorry

seda.urguplu6
2020-10-16 13:17
I have created an issue about this, shared the files and info. Not testing on docker, I have antivirus software but not sure how to check if it is blocking.

mikahchapman
2020-10-16 14:45
Ooh, that sounds nice. But in general, definitely sounds like sharing states really isn't bad, good practice would be to make sure the state is significant enough to have meaning. So a state like `the server is ready to accept new entities` would be good for multiple interactions that create a new entity.

mikahchapman
2020-10-16 15:29
I think personally, I've gotten into the habit of trying to put too much info into the state description and not letting the rest of the interaction describe itself.

mario.gioiosa
2020-10-16 18:57
has joined #general

matt.fellows
2020-10-17 21:40
Disabling AV is the simplest way to find that out

matt.fellows
2020-10-17 21:40
usually AV software will tell you when it?s messing about though

matt.fellows
2020-10-17 23:52
Is that a question?

abubics
2020-10-18 23:26
Sounds like you're heading in the right direction ^_^

abubics
2020-10-18 23:27
I'd suggest avoiding phrasing like "the server is ready", and stick to domain language. Phrasing the state as domain prerequisites should give you the best flexibility.

ramana.jaladurgam
2020-10-19 03:15
Yes @matt.fellows. I wanted to understand if there is a plan and timeline to upgrade PACT Python to support AMQP based tests. Or any alternatives from the experts that could be suggested.

matt.fellows
2020-10-19 03:22
Did you see my suggestion I linked you to the other day?

ramana.jaladurgam
2020-10-19 05:12
Sorry - i am not sure which link is that


lior.baber
2020-10-19 07:33
has joined #general

lior.baber
2020-10-19 07:38
Hello there mates, I wonder if there is a way to add contract to a running pact-server, the builder (i.e generate a pact and then send it to a running pact-server then use this pact as part of the test)?

2020-10-19 10:44
A new post has been created in *Feature Requests*

matt.fellows
2020-10-19 11:01
do you mean to use it as stubs?


lior.baber
2020-10-19 11:08
yes, I don't have a way to interact with it from outside the docker via api. and have the builder build the contract and send it to the docker container instead of spinning up ephemeral http service

matt.fellows
2020-10-19 11:12
In a language independent way, there is the stub server which accepts a pact file and creates a stub server to use

matt.fellows
2020-10-19 11:12
but i think you want to use it in the usual way (i.e. to generate the contract) as part of a unit test?

matt.fellows
2020-10-19 11:12
If you could please elaborate on your use case/problem that would help. Also probably what language you?re using

matt.fellows
2020-10-19 11:13
It?s not evident why you must use docker in the first instance or why that?s important,

lior.baber
2020-10-19 11:19
I'm using scala, I have an integration test in which the service under test is running in side a docker container as well as its dependent services (i.e the providers) the test send http request to the system-under-test running in the docker container, and wait for the response, because the system is spinning up before the test I can change / reconfigure the stubbed service uri I need to do it beforehand, so if the stubbed service is already up and i can change the contract based on the test I'm currently running, it will be flexible enough for me to use

jeffbdye
2020-10-19 17:10
has joined #general

dmcgill50
2020-10-19 19:15
has joined #general

jace
2020-10-19 19:22
has joined #general

raghanag
2020-10-20 05:57
sure will do

raghanag
2020-10-20 06:08
Hi how do we handle when pact getting verified at provider side, when the pact file has dummy authorization headers and provider expecting real authn tokens?

matt.fellows
2020-10-20 06:08
search authorization on http://docs.pact.io, there?s a page on that somewhere


matt.fellows
2020-10-20 06:10
yep!


sagupta
2020-10-20 09:18
Hello folks , I am trying to setup the consumer pipeline as mentioned in https://docs.pact.io/pact_nirvana/step_4 . However i was wondering once consumer publishes pact to broker and then webhook is triggered , should we go to next job i.e. `can-i-deploy` ? I mean how to wait for the results from the provider build triggered from webhook?

sagupta
2020-10-20 09:19
I was able to setup a separate job in gitlab to only run `test-contract` when pact contract is changed by consumer.

sagupta
2020-10-20 09:19
Thanks for these info . :taco: :taco:

sagupta
2020-10-20 09:20
@bethskurrie Thanks for help :taco: :taco:

antonello
2020-10-20 09:25
if you want to explicitly, you can create a webhook that is triggered when the provider verification is published to the broker.

antonello
2020-10-20 09:25
Or you could introduce other forms of waiting based on the CI tool you?re using

sagupta
2020-10-20 09:27
I am using gitlab and I have configured a webhook to trigger provider build when pact is published/changed, but i am not sure how to handle wait from results of provider. Things not clear to me are: ? after publish job, if i move ahead to can-i-deploy job, it will fail as the pact may not be verified by that time ? How others handle this

antonello
2020-10-20 09:30
Option 1 is definitely possible - and then you might want to retry that job later

antonello
2020-10-20 09:30
I mentioned two other possible ways of doing it - what specifically is not clear?

almaak
2020-10-20 09:35
has joined #general

almaak
2020-10-20 09:41
:wave: Hello, I am trying to set up a pact mock server as a stand-alone service for my REST API. I'm using the service as a docker container and I was wondering how can I initialize the server with a json response and a bearer token? - like, when I make a post request to the server, where should I specify the authentication method and a token? should this be included id the json or should I somehow set the state parameter? POST http://localhost:29999/create?state=NoUsers&path=/accounts'{ "provider": { "name": "Animal_Service"}, ... }' basically, what I want is to setup a response for a path and a static bearer token.

giuseppe.salvatore
2020-10-20 12:14
anybody on this able to see anything from the streaming?

giuseppe.salvatore
2020-10-20 12:14
I got a black streaming from the video window

giuseppe.salvatore
2020-10-20 12:14
no sound as well

mcruzdrake
2020-10-20 12:15
It's also the same for me @giuseppe.salvatore

mcruzdrake
2020-10-20 12:15
Have tried refreshing multiple times

giuseppe.salvatore
2020-10-20 12:15
ok thanks... at least it's not just me

lior.baber
2020-10-20 12:19
@matt.fellows

giuseppe.salvatore
2020-10-20 12:25
@antonello do you have any info?

giuseppe.salvatore
2020-10-20 12:25
ah it's working now

matt.fellows
2020-10-20 12:30
yes, I had issues too. They switched to Youtube now and it?s all good

sagupta
2020-10-20 13:04
I think the option you suggested first (creating a webhook) wont help me here as i would want to wait for the provider pipeline results to move forward for can-i-deploy for consumer

sagupta
2020-10-20 13:05
oK so the option to implement retry once on failure of `can-i-deploy` makes sense

matt.fellows
2020-10-20 13:10
:heart: @giuseppe.salvatore

sagupta
2020-10-20 13:10
You can specify the authentication (bearer token) in the json itself

giuseppe.salvatore
2020-10-20 13:10
kudos to you guys

matt.fellows
2020-10-20 13:10
Sorry I missed this.


matt.fellows
2020-10-20 13:11
but i?m still not sure that?s what you need?

sagupta
2020-10-20 13:11
For example : ```{ "description": "Error Scenario", "request": { "method": "GET", "path": "<pathname>", "headers": { "Authorization": "Bearer xxx" } }, "response": { "status": 404, "headers": { "Content-Type": "application/json; charset=UTF-8" }, "body": { "errorCode": "ERROR_NOT_FOUND", "message": "Not found" } } }```

lior.baber
2020-10-20 13:16
no it is not, how can I add a feature request for that? @alik.berezovsky

almaak
2020-10-20 13:48
ok, thank you. so the json is a pact file. correct?

sagupta
2020-10-20 13:49
no this is not pact file, this is the json that you send to your pact mock server

sagupta
2020-10-20 13:49
the auto generated pact file will be pretty similar though

almaak
2020-10-20 13:59
ok, thank you! :slightly_smiling_face:

andra.moraru
2020-10-20 14:13
has joined #general

krisdinesh
2020-10-20 14:18
Guys - I hit through a scenario that I am trying to contract test create new user where I have to pass new user email which should be unique in my post request. If I have use the unique value for every request, I am not sure how can I handle the unique value as part of the contract?

sklein
2020-10-20 14:26
Others definitely chime in here, but I'd expect the business requirement of unique email to be handled by an actual integration test in that service. What I would do contract wise is create two states (email is unique, email is duplicate) on the provider and two tests in the subsequent consumer

sklein
2020-10-20 14:27
then you can add a regex or whatever to check that the payload is indeed an email or just verify its a string

sklein
2020-10-20 14:27
email regex is hard

krisdinesh
2020-10-20 14:41
@sklein - here my scenario is simple post request for creating a user and everytime I need to provide unique email Id. Otherwise it says user exist. How to handle this in contract testing? I can verify as I wanted but the problem exist while posting a request

sklein
2020-10-20 14:52
This would be very much implementation dependent. How does the client generate the unique id? Guid? Some Global Id Service?

antonello
2020-10-20 14:54
@krisdinesh You need to be in control of the data on the provider side (through some kind of mocking, stubbing or using an in memory database).

antonello
2020-10-20 14:55
You definitely should avoid generating a new email every time in your pact, because that would make the content of the pact different for every run, which is a bad pattern.

sklein
2020-10-20 14:55
@antonello this is exactly what I was trying to get at in my original comment.

andra.moraru
2020-10-20 15:00
Hello! I was wondering if anyone here was able to integrate the Pact Mock Server with cucumber tests. At this moment, I create some mocked data using methods annotated with "@Pact" and test the contract with unit test methods annotated with "@PactVerification", but I need to reuse the mocked data also for functional tests built with cucumber. Some links with examples would also be great and I can study further. Thank you

krisdinesh
2020-10-20 16:34
@antonello and @sklein I agree i should have control over the data of provider system but all I am looking here is how can i do that using PACT is my question? In other words, how to test new user creation scenario where it gives 200 ok only when the user details are unique. Please elaborate to this specific scenario to test as part of PACT/Contract Testing. If I use, mock, stubbing or in-memory database it will be more equivalent to unit testing but we are trying to do Contract testing here Please help me here if I am not inline to your thoughts cc: @matt.fellows @uglyog

camila.coder91
2020-10-20 17:06
has joined #general

antonello
2020-10-20 17:49
It depends on what you mean by unit test, but a contract test doesn?t cease to be a contract test if you mock or stub some of your application layers. Actually, it is much preferable than hitting your real database. Ideally you want your provider tests to run without having to hit your deployed application.

antonello
2020-10-20 17:49
Can you mock your data access layer?

antonello
2020-10-20 17:49
If so, that?s what I?d recommend.

krisdinesh
2020-10-20 18:24
makes sense @antonello - I was under the impression that stubs and drivers cant be used in contract testing. I will proceed as suggested but in this case I am not able to distinguish between unit/Component Test VS Contract Test. Thanks for taking time to patiently answer all my questions

antonello
2020-10-20 18:34
Contract Testing is about what you?re testing, which is the contract between two service. You can do contract testing with Pact writing tests that are more like unit tests. In fact, it?s encouraged.


tjones
2020-10-20 21:56
This might be a question for #pact-jvm

wilkinsweiqiangliang
2020-10-21 01:49
Hey guys, a dummy question, for provider to ask can-i-deploy successfully(return YES), it required consumer to public the contract and tag with the specific env tag right? Is there anyway provider can publish first? or it need to wait for you guys to release the `provider-driven` in the future?

matt.fellows
2020-10-21 02:18
I think you can still call `can-i-deploy` even if there are no consumers yet

wilkinsweiqiangliang
2020-10-21 02:19
deploying in progress

wilkinsweiqiangliang
2020-10-21 02:19
will see

wilkinsweiqiangliang
2020-10-21 02:21
```docker run --rm -v ${PWD}:${PWD} -e PACT_BROKER_BASE_URL -e PACT_BROKER_TOKEN pactfoundation/pact-cli:latest broker can-i-deploy --pacticipant ProductAPI --version=0c842e28bfb5267f45eb970367599582521fe4a9 --tag=staging Computer says no ¯\_(?)_/¯ ```

matt.fellows
2020-10-21 02:21
Yes, just tried the same thing

matt.fellows
2020-10-21 02:21
`No pacts or verifications have been published for version cd3f577+1603246817 of pactflow-example-provider`

wilkinsweiqiangliang
2020-10-21 02:21
so currently, it required consumer to tag, so that webhook can trigger pactVerify and publish result

matt.fellows
2020-10-21 02:21
I wonder if a feature request to say ?allow can-i-deploy? to pass for a pacticipant in a provider role where there are no consumers yet?

wilkinsweiqiangliang
2020-10-21 02:22
before we can ask can-i-deploy


wilkinsweiqiangliang
2020-10-21 02:22
That means its provider driven to me

wilkinsweiqiangliang
2020-10-21 02:22
lol

matt.fellows
2020-10-21 02:33
yes, it reflects the fact that not everyone uses pact only in the consumer driven way

matt.fellows
2020-10-21 02:33
there are many good reasons to support that use case I think, including retrofitting into existing systems

bethskurrie
2020-10-21 05:04
It would be very hard to detect an error situation - how would the tool know if you'd made a mistake and had put in an incorrect version vs the 'there are no results' situation?

bethskurrie
2020-10-21 05:05
it would incorrectly allow you to deploy just because you'd made a mistake in the can-i-deploy call.

bethskurrie
2020-10-21 05:06
if you want to start using can-i-deploy for an application that doesn't actually have any pacts yet, you could check if the pacticipant version resource actually existed in the broker before calling can i deploy.


bethskurrie
2020-10-21 05:08
this is not a philosophical question about who is "driving" the contract so much as a practical consideration of which one is being deployed first.

bethskurrie
2020-10-21 05:08
@wilkinsweiqiangliang tagging in case you don't have notifications turned on for threads.

tjones
2020-10-21 05:11
Ah, I thought the solution to "nothing is deployed yet" was to deploy the provider first - which would be a success, because all deployed consumers (ie, none) are compatible with the provider

tjones
2020-10-21 05:12
Perhaps it should ideally be a big warning, or maybe require an "I'm expecting none" flag?

bethskurrie
2020-10-21 05:12
if you're going to do that, why not just disable can-i-deploy until a consumer is there?

tjones
2020-10-21 05:12
like cloudformation's "allow empty changeset" option

bethskurrie
2020-10-21 05:13
there's no point saying "am i compatible with my contracts' if there are no contracts :laughing:

tjones
2020-10-21 05:13
That also works, but I think it's cleaner/better practice to let it run to success with no consumers

tjones
2020-10-21 05:13
like what if someone else deployed and you didn't know?

tjones
2020-10-21 05:14
I think there's a difference between passing with no contracts and disabling the check entirely

bethskurrie
2020-10-21 05:14
all the command knows is that the version that's being asked for doesn't exist.

bethskurrie
2020-10-21 05:15
if you set it with --ignore-missing-version and left it (because who ever goes back in and changes something that's currently passing) then it would never fail if the version was wrong there after.

tjones
2020-10-21 05:18
What if the behaviour was: Can I deploy ProviderX to TAG: * If no ProviderX is tagged with TAG, allow deployment with zero contracts * Otherwise, if there are zero contracts, fail deployment That might solve most cases. Would it have drawbacks?

bethskurrie
2020-10-21 05:20
:thinking_face:

bethskurrie
2020-10-21 05:21
that might work.

julzelements
2020-10-21 05:25
has joined #general

julzelements
2020-10-21 05:29
Hi folks, I'm a bit worried that this question gets asked a lot but here goes: I'm currently testing a single microservice with a 'black box' approach.

julzelements
2020-10-21 05:31
I've spun up my docker compose with: ? postgres ? a docker image of the scala app in question ? my little node app, which runs my jest tests ? localstack with an sqs que runner

julzelements
2020-10-21 05:32
I'm now in the process of adding mockserver to do the job of another microservice that communicates with the scala app so I can do API testing.

julzelements
2020-10-21 05:33
I'm pretty sure I'm rolling too much of my own stuff at this point, and I should dive in and start looking at how to use http://pact.io in the setup. Am I correct in this assumption? Please ask any more questions, if you feel I've left detail out.

matt.fellows
2020-10-21 05:50
When I was out for my run, I thought it would be fairly easy to wrap the can-i-deploy command with a similar check Tim (on the client side, that is)

matt.fellows
2020-10-21 05:51
My main argument for a behaviour like this would be in places where there is a centralised CI team who create templates for all builds - e.g. in regulated environments, controlling the change process is important, and I?ve had several discussions with teams who do just this. It should also be fairly easy to ?parameterise? to disable can-i-deploy also, which is the obvious counterargument!

wilkinsweiqiangliang
2020-10-21 05:53
There is couple of use case here, and i think its common for cross team deployment. ? When there are no contracts and provider is first time to deploy to an environment, would `can-i-deploy` fail? ? When there is contracts, however, contracts are not being tag with the env tag that provider trying to deploy, would `can-i-deploy` fail?

wilkinsweiqiangliang
2020-10-21 05:53
Thanks for taging @bethskurrie

bethskurrie
2020-10-21 05:54
Open a request on http://pact.canny.io and come up with as clear and well thought out suggestion as you can for how you would want it to work (but still avoid potential accidental deploys)

kapil.mathur
2020-10-21 06:40
has joined #general

yann.courtel
2020-10-21 09:36
Hi everyone. Has anyone tried to know the actual routes a consumer was really consuming? We are looking into being able to see if our interactions in our PACTs are really covering all the routes by a specific consumer. Thank you.

mark.hudson
2020-10-21 10:45
has joined #general

cluu
2020-10-21 17:16
has joined #general

bethskurrie
2020-10-21 21:05
Are you asking if the pact has covered all the routes that the consumer uses, or are you asking if the pact covers all the routes offered by the provider @yann.courtel?


camila.campos
2020-10-21 21:35
has joined #general

matt.fellows
2020-10-21 22:13
My read was covering the _consumer_

matt.fellows
2020-10-21 22:13
> the actual routes a consumer was really consuming

matt.fellows
2020-10-21 22:14
@yann.courtel the question comes up a bit (often in the context of ?how do I know when I have all of the right contracts in place?? as a bit of a target. Whilst we?d like to make tools to simplify this, one option would be to look at your consumer API clients to see what they do, or another option could be to use a recording proxy in a test environment and manually review the requests

abubics
2020-10-22 00:31
Maybe, it's a bit hard to say what your intent is with that setup :slightly_smiling_face: Pact is good for testing a network interface, through a pair of known collaborators (provider and consumer). Your description sounds like you may have several providers and consumers, which might all want separate contracts for their pairings.

yann.courtel
2020-10-22 07:36
Hi Beth, thanks for the info. It's the former as in all routes actually consumed by a microservice. They might consume, say 10% of a provider but at least I want to know if this 10% is covered by a PACT contract in place. It's a very touchy subject here as we have many block from our security. There are two ways I find can be less intrusive but it adds complexity on the development side : 1. Add a layer in all our http calls to be able to record the information we need. The problem is that not all services (consumer) are making http requests the same way. 2. Find a tool that can help auto-generate at build time all http routes by directly parsing the code.

yann.courtel
2020-10-22 07:37
It is quite complicated. Another way that requires a lot of work would be to have our teams maintain a manifest or sitemap file recording all their routes but it sounds too restrictive and counter productive. Thank you for the input. I appreciate.

longlevan
2020-10-22 09:15
has joined #general

justin.garfield
2020-10-22 16:15
has joined #general

guppy0356.nakira
2020-10-23 00:34
has joined #general

matt.fellows
2020-10-23 00:48
Just want to put a general shout out to @antonello who is answering questions like a machine in #pact-jvm, is helping organise and release the Pact JVM library (our most popular/used one), has recently spoken at an API Testing Panel on Pact (https://commited.tech/events/api-testing-panel-discussion/) AND is helping to organise our Pact Meetup in November :taco: :taco::taco: :clap: (also a little reminder - don?t be stingy with those :taco: ?s, which is our kudos currency !)

phil.endsley
2020-10-23 01:42
@antonello is a treasure to the pact community :taco: :taco:

bethskurrie
2020-10-23 05:49
I would personally use a standard code coverage tool and run my pact tests in a separate context to my other tests to get a map of which parts of my consumer are exercised in the pact tests @yann.courtel

bethskurrie
2020-10-23 05:51
In my opinion, it's not so much a question of routes as a question of standard test coverage execution. Eg. imagine you had a client method that makes an http call, and then responds to the different http statuses in different ways (eg. 404 is turned into null, 500 raises an error.) These are actually as much of a concern when you're talking about coverage as the HTTP routes themselves.

tjones
2020-10-23 06:21
Both @antonello and @phil.endsley have been smashing the great answers in the past few months! It's such a pleasure to read a question, then find they've answered it better than I would have :taco: :taco:

thomas.shipley
2020-10-23 09:35
Hey @matt.fellows sorry forgot about this. Looks like I need permission to create a repo in pact foundation before I can transfer it over. Is this something you can help me with?

matt.fellows
2020-10-23 10:04
:wave:

matt.fellows
2020-10-23 10:04
sorry I obviously missed your response

matt.fellows
2020-10-23 10:04
will do this now

matt.fellows
2020-10-23 10:07
OK if you could add me `mefellows` as an admin of that repo, I can transfer to Pact Foundation and then grant you admin to that repo

thomas.shipley
2020-10-23 10:10
No worries - great sent you an invite.

matt.fellows
2020-10-23 10:11
thx, just accepted

matt.fellows
2020-10-23 10:12
I think you need to make me an admin/owner now?

krisdinesh
2020-10-23 11:33
Hello @here - I have scenario like request chaining where api response attribute should be used as request attribute in another api method call. In this case response attribute is dynamic in nature. Hence we are unable to create contract. Please share your thoughts if think it can be addressed

krisdinesh
2020-10-23 11:35
That?s true @antonello has lot of patience in answering questions. Thank you!!

thomas.shipley
2020-10-23 13:10
Transfer of ownership request sent :thumbsup:


matt.fellows
2020-10-24 00:32
:clap: thanks to you both! I?ll take a look at the updates this week

matt.fellows
2020-10-24 00:32
@michael_james :taco: :taco:

matt.fellows
2020-10-24 00:33
@thomas.shipley :taco: :taco:

ercalbwar
2020-10-24 19:24
has joined #general

andrewshtamburg
2020-10-25 13:04
has joined #general

siad.ardroumli
2020-10-25 18:16
has joined #general

srikanthpmailid
2020-10-26 01:02
has joined #general

abubics
2020-10-26 01:03
Pact contracts capture individual interactions, not behavioural sequences. Also, the way versioning & preverification works precludes dynamic request parameters. The usual approach, then, is to use state to avoid dynamism, and design your API client so that it doesn't do conditional things dynamically.

abubics
2020-10-26 01:04
Can you describe your use case more concretely, so someone can help answer you more specifically?

krisdinesh
2020-10-26 02:47
Sure, my 1st scenario is post request for creating a license for a user which gives random id of license and assign the license Id through 2nd post request . This more of request chaining concept

bethskurrie
2020-10-26 06:08
You would do two separate interactions. The first would be to create the license. The second would have a provider state "given that a license with id 123 exists".


krisdinesh
2020-10-26 13:47
Yes @bethskurrie , I am inline with the same but the id 123 can?t be reused so data in the will be invalid after 1st time use

photesthesis_geospiza
2020-10-26 15:10
has joined #general

abubics
2020-10-27 01:47
I think maybe you're not understanding how state setup works. That "provider states" doc pretty clearly describes why test isolation is important, and how state setup can solve your problem. If you can tell us what language/platform your provider is written in, we might be able to give you a concrete example :)

krisdinesh
2020-10-27 01:53
@abubics - we are using dotnet .kindly share the info


jackbwheatley
2020-10-27 21:02
has joined #general

carlosalmeida.xon
2020-10-27 22:06
has joined #general

matt.fellows
2020-10-28 02:39
:tada: I?m excited to announce our first global Pact meetup on the 19th November at 9am (UK/GMT) :tada: Based on your feedback from our recent survey, we will: 1. Demo the use of Pact and some of the latest features 2. Present a case study of using Pact in _Real Life_ :tm: (thanks @antonello!) 3. Have a panel Q&A session where you can ask questions directly of the core team ?and more! Register for the event here: https://go.pactflow.io/nov20meetup, we hope to see you there!

oscar821210
2020-10-28 02:40
Great!!

aforeman
2020-10-28 02:42
Awesome!!

guppy0356.nakira
2020-10-28 02:48
I will join this online meetup from Japan.

pdunn
2020-10-28 04:06
Awesome work guys!!!

evanrosal
2020-10-28 05:31
Has anyone used PACT for aws eventbridge?

a.smith
2020-10-28 06:47
Congratulations all! Great news!

matt.fellows
2020-10-28 07:46
I also forgot to mention. If the timezone is not good for you, we will be recording and uploading to Youtube afterwards. You can still register and there is an option for us to send the video to you once it?s up online

alik.berezovsky
2020-10-28 08:09
????

francislainy.campos
2020-10-28 08:35
Looking forward to it! :slightly_smiling_face:

matt.fellows
2020-10-28 10:27
Do you an adblocker @alik.berezovsky? What browser are you using?

matt.fellows
2020-10-28 10:27
Direct link is https://www.eventbrite.com.au/e/pact-community-meetup-tickets-126772009493 but I've noticed the URL can change so put a branded link over it

nasir.amin
2020-10-28 11:07
has joined #general

jimish.shah.-nd
2020-10-28 11:26
has joined #general

dale.bennett
2020-10-28 11:37
Hi, Wondering if anyone could share some insight into what I might be doing wrong here please. I am using PactNet. I am trying to DELETE a resource. This in theory is simple to execute, but I am receiving a status code 415. What's even weirder is that when I check the application logs my delete request doesn't actually seem reaching the application at all. I am not sure where this status code is coming from, I have double checked the endpoint, the headers I am sending, and I have executed the exact same request manually. When I manually execute this request, I get a 204 as expected, however when I attempt to do this through a provider verification test I get the 415. My pact file looks like this {  "consumer": {    "name": "SpiralSuite"  },  "provider": {    "name": "SchedulingAssistantAPI"  },  "interactions": [    {      "description": "The request to delete is successful",      "providerState": "an optimized case exists",      "request": {        "method": "delete",        "path": "/api/optimize",        "headers": {          "Accept": "application/json; v=1.6"        }      },      "response": {        "status": 204,        "headers": {          "X-Request-ID": "2e3dd4f4-77de-4282-8705-7814d65f4f87"        },        "matchingRules": {          "$.headers.X-Request-ID": {            "match": "type"          }        }      }    }, Other requests in the pact file that point to api/someendpoint work, but none of these are a DELETE. Any idea where I am going wrong please? I have attached a successful request executed manually to the same endpoint. I have also attached the error from the provider test run...

matt.fellows
2020-10-28 11:38
415 is unacceptable/unsupported media type - does your provider actually return `application/json; v=1.6` as the content type from that endpoint?

matt.fellows
2020-10-28 11:40
Also for the future, .NET related questions should go in #pact-net :pray:

dale.bennett
2020-10-28 11:40
Thanks for the quick reply, I believe so. I have attached the manual execution of the same request with a seemingly identical header, I get a 204. Oh sorry I didn't realise that :)

matt.fellows
2020-10-28 11:40
doesn?t look like your DELETE requests receives a body, so the accept header seems redundant

matt.fellows
2020-10-28 11:42
There should be a log file somewhere from Pact that shows the in/out details. That may shed some light

dale.bennett
2020-10-28 11:54
Is that the same as the output from the test? Currently digging but maybe I do not have logs, perhaps I have not configured correctly. Either way my test output shows this: Verifying a pact between SpiralSuite and SchedulingAssistantAPI Given an optimized case exists The request to delete is successful with DELETE /api/optimize returns a response which DEBUG: Setting up provider state 'an optimized case exists' for consumer 'SpiralSuite' using provider state set up URL http://localhost:5002/provider-states I, [2020-10-28T11:50:05.041100 #66320] INFO -- request: POST http://localhost:5002/provider-states D, [2020-10-28T11:50:05.041100 #66320] DEBUG -- request: User-Agent: "Faraday v0.17.3" Content-Type: "application/json" Authorization: "Bearer {_token goes here, I have removed this deliberately_}" I, [2020-10-28T11:50:06.899121 #66320] INFO -- response: Status 200 D, [2020-10-28T11:50:06.900123 #66320] DEBUG -- response: connection: "close" date: "Wed, 28 Oct 2020 11:50:06 GMT" server: "Kestrel" transfer-encoding: "chunked" WARN: Adding header 'Authorization: Bearer {_token goes here, I have removed this deliberately_} to replayed request. This header did not exist in the pact, and hence this test cannot confirm that the request will work in real life. has status code 204 (FAILED - 1) includes headers "X-Request-ID" which is an instance of String

adam_figgins
2020-10-28 14:20
has joined #general

aperdomobo
2020-10-28 15:42
has joined #general

diazguerra2
2020-10-28 16:06
has joined #general

xsamore
2020-10-28 19:52
has joined #general

simon
2020-10-28 20:49
has joined #general

matt.fellows
2020-10-29 00:37
Any mobile devs here keen to try out the latest and greatest Swift lib? https://pact-foundation.slack.com/archives/C9VBGNT4K/p1603931113025100 (x-post from #pact-swift )

ruben.cagnie
2020-10-29 01:24
has joined #general

272939217
2020-10-29 05:33
has joined #general

driloni92
2020-10-29 09:05
has joined #general

pauloavra
2020-10-29 12:33
has joined #general

wilkinsweiqiangliang
2020-10-30 05:19
Hi guys, does our docker pact cli support participant name with spaces? like (?This is a name?) im trying to call but it doesnt work.

bethskurrie
2020-10-30 05:19
It should, if they have double quotes around them.

bethskurrie
2020-10-30 05:19
What is the line you are using?

wilkinsweiqiangliang
2020-10-30 05:20
```docker run --rm -v /Users/wilkinsliang -e PACT_BROKER_BASE_URL -e PACT_BROKER_TOKEN pactfoundation/pact-cli:latest broker create-version-tag --pacticipant "Product API" --version 7540-f24a47478c2d840246eb33000864727069cf0703 --tag development```

bethskurrie
2020-10-30 05:22
can you add --verbose and show me the output?

bethskurrie
2020-10-30 05:28
From the description "it doesn't work" I can't tell if it's an issue in the docker -> CLI interface, or the CLI -> HTTP interface.

wilkinsweiqiangliang
2020-10-30 05:28
let me try again

wilkinsweiqiangliang
2020-10-30 05:28
i think issue is not with cli

wilkinsweiqiangliang
2020-10-30 05:28
it might just be my bash script

wilkinsweiqiangliang
2020-10-30 05:30
thanks for confirming the space with naming, i found the issue is on my bash

wilkinsweiqiangliang
2020-10-30 05:30
:taco:

2020-10-30 15:24
A new post has been created in *Feature Requests*

jikogay728
2020-10-30 17:20
has joined #general

raghanag
2020-10-30 22:51
Hi I just have a question why do we need the axios when we already have the mockProvider and pact, isn?t mockProvider is not enough to serve the requests or writing assertions. I understand that axios is like http client but we are including one more library why not pact provide its own http client for the mock service.https://github.com/pact-foundation/pact-js/blob/master/examples/mocha/index.js

matt.fellows
2020-10-30 22:54
That's the client code, which uses Axios to fetch data from the provider

matt.fellows
2020-10-30 22:54
It doesn't know if it's talking to Pact or the real thing

matt.fellows
2020-10-30 22:54
See the howtolearn materials

2020-10-30 22:54
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

raghanag
2020-10-30 22:55
so you meant i can use any http client library i wish not only axios right

matt.fellows
2020-10-30 22:55
Or even start with these quick in browser examples https://docs.pactflow.io/docs/tutorials/

raghanag
2020-10-30 22:57
so mockprovider provides mock server and can you explain this line if you dont mind https://github.com/pact-foundation/pact-js/blob/master/examples/mocha/test/get-dogs.spec.js#L70

matt.fellows
2020-10-30 23:03
On the consumer side, pact mocks out the provider.

matt.fellows
2020-10-30 23:04
The code your looking at is the client code - the thing you want to test

matt.fellows
2020-10-30 23:04
Pact doesn't do anything as a consumer. Your job is to write a unit test of the consumer with Pact

matt.fellows
2020-10-30 23:04
I'd run thru the workshops


matt.fellows
2020-10-30 23:05
It'll really accelerate the learning

raghanag
2020-10-30 23:05
sure

matt.fellows
2020-10-30 23:05
:+1:

blmlcu
2020-10-31 14:51
has joined #general

psychopomp3x
2020-11-02 14:42
Idea: Ability for pact to inform the provider developer that an API is not in use by any consumers. My team is using side-by-side http api versioning and looking for ways to know when it's safe to remove the old versions.

tjones
2020-11-02 14:47
I like this idea! What would it look like? How would you tell pact that the unused api exists?

psychopomp3x
2020-11-02 14:48
Maybe on the test run for a provider, it could declare an informational message? Something like a list of APIS exposed that are not covered by a pact test in the broker.

psychopomp3x
2020-11-02 14:49
I think the provider runner would need to understand how to identify that apis exist from the provider side. Maybe metadata in the code / static analysis? Not sure how to solve it. Sci-fi.

lakitna
2020-11-02 16:51
This would probably combine really well with provider-side things as described here https://github.com/pact-foundation/pact-specification/issues/76

jamescourtoy
2020-11-02 21:04
has joined #general

matt.fellows
2020-11-02 22:42
It?s possible, but probably very framework specific in the current state. i.e. it would probably be fairly easy to discover routes in an ExpressJS app or a spring boot app, but that would involve a lot of plugins to cover all of them. I think the provider driven approach that Sander is referring to is probably going to be easier, because the provider contract is documented in advance - so the ?unused? portion of the api is easier to see. If `P` is the full API documented by the provider (e.g. in an OAS), and `C` is the union of APIs documented by all consumers, then `P - C` is the unused portion that can be decommissioned


matt.fellows
2020-11-03 05:18
The best part is, that she goes on to show how to ?integration? test a smoke alarm, without setting your house on fire :stuck_out_tongue:

telmo.ferreira.costa
2020-11-03 11:32
has joined #general

sergii.kopovskyi
2020-11-03 12:35
has joined #general

silverton.gimenes
2020-11-03 17:58
has joined #general

colber16
2020-11-03 18:34
has joined #general

cvoong
2020-11-03 18:55
has joined #general

cvoong
2020-11-03 19:12
seems like this channel might be the right place to ask this question

phil.endsley
2020-11-03 19:16
Definitely casting a bigger net here, but #pact-net is the best place for language specific questions. Sometimes you might have to just wait a bit, since the core team is based in Australia

brendan.donegan
2020-11-04 11:47
Hi. We?re using the open source Pact broker at the moment and occasionally see `PactBroker::Client::Error - {"error":{"message":"SQLite3::BusyException: database is locked","reference":"WzzADWGTOL","backtrace":` in our CI. Anyone know if this is a known issue?

brendan.donegan
2020-11-04 11:47
We are using pact-node 10.9.2

brendan.donegan
2020-11-04 11:48
The broker version is 2.59.2

antonello
2020-11-04 12:26
this is not going to be super helpful, but using SQLite is not recommended.

brendan.donegan
2020-11-04 12:26
I was thinking that already

antonello
2020-11-04 12:29
My assumption is that it?s struggling with load

antonello
2020-11-04 12:29
and concurrent access

antonello
2020-11-04 12:30
sqlite is only recommended for investigation/spikes

antonello
2020-11-04 12:30
My recomendation would be to switch to Postgres

ukrainian1991
2020-11-04 17:27
Hi, have anyone faced with the task to put credit card expiration date in PACT contract. I know that I could use string matcher, but how about sending card info during provider check. Real provider will decline the expiration date in the past

ukrainian1991
2020-11-04 17:27
```stringMatcher("expiration_year","^\\d{4}\$", "2023")```

ukrainian1991
2020-11-04 17:29
It would send to provider the string 2023 from example, but after 2023 test would have been failing

ukrainian1991
2020-11-04 17:30
Anyway it's not good to hardcode variable (even 2300 year :slightly_smiling_face:)

phil.endsley
2020-11-04 18:14
What languages are you using? I know there's a feature that supports this, but I'm not sure if it's available in every language

ukrainian1991
2020-11-04 18:17
JVM


phil.endsley
2020-11-04 18:26
Your provider can modify/inject a value when setting up the state


ukrainian1991
2020-11-04 18:29
Thanks, seems it's what I am looking for

ukrainian1991
2020-11-04 18:30
need to figure it out

ukrainian1991
2020-11-04 19:05
@phil.endsley Are you using JVM? I am struggled with ```.`object`("accountNumber") .valueFromProviderState("id", "\${accountNumber}", 100) .closeObject()``` valueFromProviderState in body description. I am using Lambda DSL and there is no valueFromProviderState

ukrainian1991
2020-11-04 19:05
seems it's only for ```PactDslJsonBody()```

ukrainian1991
2020-11-04 19:17
Oh, seems I find the way out ```.body(newJsonBody((root)-> { root.object("user", (o) -> { o.getPactDslObject().valueFromProviderState("userId", "${userID}", 6789); <<< o.stringType("email"); o.stringType("firstName"); o.stringType("lastName");```

matt.fellows
2020-11-04 20:35
Ah yes, SQL lite cannot handle multiple simultaneous queries (or something like it anyway). I saw that a lot when testing the terraform provider against it

brendan.donegan
2020-11-04 20:36
okay, good to confirm that

matt.fellows
2020-11-04 20:36
I'd recommend postgres with docker. The example in the repo should work OOTB for testing. For prod obviously you'd probably want to extetnalise that db

uglyog
2020-11-04 22:04
You can also use the date generator, it will generate a value relative to the current system time.

abubics
2020-11-05 03:39
Big tangent . . . are you building or proxying a payment gateway? Dealing with CC info feels like a good way to land yourself in trouble :innocent: especially if it's not 100% necessary

wilkinsweiqiangliang
2020-11-05 03:50
Hi guys #pact-jvm im using gradle plugin `4.1.9` to publish contracts, however, im getting below error. ```> Failed to fetch the root HAL document Caused by: au.com.dius.pact.core.pactbroker.RequestFailedException: Request to path '/' failed with response 'HTTP/1.1 400 Bad Request' at au.com.dius.pact.core.pactbroker.HalClient.handleHalResponse(HalClient.kt:301) at au.com.dius.pact.core.pactbroker.HalClient.access$handleHalResponse(HalClient.kt:140) at au.com.dius.pact.core.pactbroker.HalClient$getJson$1.invoke(HalClient.kt:284) at au.com.dius.pact.core.pactbroker.HalClient$getJson$1.invoke(HalClient.kt:140) at au.com.dius.pact.core.support.KotlinLanguageSupportKt.handleWith(KotlinLanguageSupport.kt:36) at au.com.dius.pact.core.pactbroker.HalClient.getJson(HalClient.kt:278) at au.com.dius.pact.core.pactbroker.HalClient.fetch(HalClient.kt:242) at au.com.dius.pact.core.pactbroker.HalClient.fetch(HalClient.kt:237) at au.com.dius.pact.core.pactbroker.HalClient.navigate(HalClient.kt:219)```

tjones
2020-11-05 06:12
I do this the other way around - I use the provider state "it is currently July 1st 2020" , or similar

uglyog
2020-11-05 06:24
Your pact broker returned a 400 Bad Request, you'll need to enable debug level logs to see what was wrong.

wilkinsweiqiangliang
2020-11-05 07:40
im using pactflow as my broker

wilkinsweiqiangliang
2020-11-05 07:40
not sure if there is a way to enable it

uglyog
2020-11-05 07:42
With Gradle, you can run it with `-d` to enable debug logs

wilkinsweiqiangliang
2020-11-05 07:52
sure will post the log here

wilkinsweiqiangliang
2020-11-05 08:24
```020-11-05T19:17:21.447+1100 [DEBUG] [jdk.event.security] X509Certificate: Alg:SHA256withRSA, Serial:67f94578587e8ac77deb253325bbc998b560d, Subject:CN=Amazon, OU=Server CA 1B, O=Amazon, C=US, Issuer:CN=Amazon Root CA 1, O=Amazon, C=US, Key type:RSA, Length:2048, Cert Id:-1011578998, Valid from:22/10/15, 11:00 am, Valid until:19/10/25, 11:00 am 2020-11-05T19:17:21.448+1100 [DEBUG] [jdk.event.security] X509Certificate: Alg:SHA256withRSA, Serial:67f944a2a27cdf3fac2ae2b01f908eeb9c4c6, Subject:CN=Amazon Root CA 1, O=Amazon, C=US, Issuer:CN=Starfield Services Root Certificate Authority - G2, O="Starfield Technologies, Inc.", L=Scottsdale, ST=Arizona, C=US, Key type:RSA, Length:2048, Cert Id:668791387, Valid from:25/5/15, 10:00 pm, Valid until:31/12/37, 12:00 pm 2020-11-05T19:17:21.448+1100 [DEBUG] [jdk.event.security] X509Certificate: Alg:SHA256withRSA, Serial:a70e4a4c3482b77f, Subject:CN=Starfield Services Root Certificate Authority - G2, O="Starfield Technologies, Inc.", L=Scottsdale, ST=Arizona, C=US, Issuer:OU=Starfield Class 2 Certification Authority, O="Starfield Technologies, Inc.", C=US, Key type:RSA, Length:2048, Cert Id:1766010387, Valid from:2/9/09, 10:00 am, Valid until:29/6/34, 3:39 am 2020-11-05T19:17:21.476+1100 [DEBUG] [jdk.event.security] ValidationChain: -1472444962, -1011578998, -1597878274 2020-11-05T19:17:21.511+1100 [DEBUG] [jdk.event.security] TLSHandshake: http://test.pactflow.io:443, TLSv1.2, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, -1597878274 2020-11-05T19:17:21.511+1100 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Secure session established 2020-11-05T19:17:21.511+1100 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] negotiated protocol: TLSv1.2 2020-11-05T19:17:21.511+1100 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 2020-11-05T19:17:21.512+1100 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] peer principal: CN=*.http://pact.dius.com.au 2020-11-05T19:17:21.512+1100 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] peer alternative names: [*.http://pact.dius.com.au, *.http://pactflow.io] 2020-11-05T19:17:21.512+1100 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] issuer principal: CN=Amazon, OU=Server CA 1B, O=Amazon, C=US 2020-11-05T19:17:21.514+1100 [DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connection established 192.168.1.107:41172<->13.54.166.169:443 2020-11-05T19:17:21.514+1100 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Executing request GET / HTTP/1.1 2020-11-05T19:17:21.514+1100 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Proxy auth state: UNCHALLENGED 2020-11-05T19:17:21.532+1100 [DEBUG] [org.apache.http.impl.conn.DefaultManagedHttpClientConnection] http-outgoing-0: Close connection 2020-11-05T19:17:21.533+1100 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Connection discarded 2020-11-05T19:17:21.533+1100 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection released: [id: 0][route: {s}->https://test.pactflow.io:443][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 10] 2020-11-05T19:17:21.534+1100 [ERROR] [au.com.dius.pact.core.pactbroker.HalClient] Failed to fetch the root HAL document```

uladzislau_danilchyk
2020-11-05 08:35
Hi guys! How can I add custom header for specific state on a consumer/provider side? The problem is that after user is authenticated, there is a header JSESSIONID which need to be sent to provider. But in Pact test it absent and my expected and actual request are different. How can I fix that problem? P.s.: I thought that I can modify request in Pact Provider Verification Test for a specific state.

uglyog
2020-11-05 08:41
You can use a request filter to add the header, but you will need to have a way of getting a valid session ID

uglyog
2020-11-05 08:42
Maybe a request before the pact verification test to get the session ID

uladzislau_danilchyk
2020-11-05 08:42
@uglyog but request filter on provider side works for every state. But I need specific request filter for a specific state

uglyog
2020-11-05 08:44
I can't see anything wrong there. Do you go through a proxy server?

uglyog
2020-11-05 08:45
@matt.fellows how would a GET request to the root generate a 400 response?

wilkinsweiqiangliang
2020-11-05 08:52
nope i dont go through the proxy server

matt.fellows
2020-11-05 08:54
I?ll open up the logs now, one moment

ukrainian1991
2020-11-05 08:58
@uglyog yeah, but contract is static, and i can't handle it without provider states. Or Am I missing something? I think that date should be generated in provider state method and this date would be replaced while sending real request to real provider based on stored contract and corresponding variable in this conrtract

matt.fellows
2020-11-05 08:58
just checking, are you using the `test` account or your own?

wilkinsweiqiangliang
2020-11-05 08:59
NOPE

wilkinsweiqiangliang
2020-11-05 08:59
pls use my work account

wilkinsweiqiangliang
2020-11-05 08:59
i replaced for security reason

matt.fellows
2020-11-05 09:00
ah thx

matt.fellows
2020-11-05 09:02
Is there a full trace of the request response? I can?t see it in that log

matt.fellows
2020-11-05 09:02
Could you please send it to me in a DM?

matt.fellows
2020-11-05 09:03
I can see a couple of `400` s during publish

uglyog
2020-11-05 09:05
It's not specific to a state, it is applied to each request

uladzislau_danilchyk
2020-11-05 09:09
@uglyog you talking about current approach how `@TargetRequestFilter` works. But I would like to modify request just for a few interactions. For example, I have 2 pacts: authorized journey and unauthorized. For Authorized journey I want to modify request and add, e.g. header or something else. But for unauthorized journey I don't want to modify request. So I need to have `@TargetRequestFilter` per `@State`. Do you have any ideas?

uladzislau_danilchyk
2020-11-05 09:10
There was similar issue but no results found: https://github.com/pact-foundation/pact-jvm/issues/729

uladzislau_danilchyk
2020-11-05 09:11
@uglyog, in other words: In request filter I need to know about interaction. In this case I can have one filter but may filter out interactions inside.

uglyog
2020-11-05 09:12
There will be no way to know what the current provider state is from the request filter. Maybe raise an issue for it at the Github project

uladzislau_danilchyk
2020-11-05 09:14
@uglyog, i'm seeing that such filter are no longer used in junit 5 and I need to use `PactVerificationInvocationContextProvider` with `@TestTemplate` . Right? But I suggest that this method is called just one time before all pacts are executed.


uglyog
2020-11-05 09:16
You can inject the request into your test method with JUnit 5. No need for the request filter

uladzislau_danilchyk
2020-11-05 09:16
@uglyog what times it can be executed? 1 or per every pact?

uglyog
2020-11-05 09:17
You can also get the current interaction in the same way, so you could get the provider states

uglyog
2020-11-05 09:17
It is passed into the test method as a parameter

uglyog
2020-11-05 09:17
You need to do what you need to before calling the verify

uladzislau_danilchyk
2020-11-05 09:18
@uglyog, ok. but can you have a look on my last question? how much time the method annotated `@TestTemplate` will be executed?

uladzislau_danilchyk
2020-11-05 09:18
`pactVerificationTestTemplate`

uglyog
2020-11-05 09:20
Once for each interaction in the Pact file

uladzislau_danilchyk
2020-11-05 09:21
So the main idea is to filter out states inside this method and for the needed state modify request, yep?

uglyog
2020-11-05 09:22
You can add the interaction as a parameter to the test method. It will have the provider states as a field

uladzislau_danilchyk
2020-11-05 09:22
Do you have an example? I cannot imagine how it looks like.

uglyog
2020-11-05 09:24
No, but pseudo code would be like: ```void testTemplate(PactVerificationContext context, HttpRequest request, Interaction i) { if (i.providerStates[0].description == '...') { // This will add a header to the request request.addHeader("X-Auth-Token", "1234"); } context.verifyInteraction(); }```

uglyog
2020-11-05 09:25
Sorry, the field is `name` not `description`

uladzislau_danilchyk
2020-11-05 09:25
hm.. I just tried to pass HttpRequest into method but it failed with: `No ParameterResolver registered for parameter [http://java.net.http.HttpRequest request] in method` I'm using gradle lib: ``` testImplementation 'au.com.dius:pact-jvm-provider-junit5:4.0.10'```

uglyog
2020-11-05 09:26
Wrong class, it needs to be the Apache Http Client one

uglyog
2020-11-05 09:27
`org.apache.http.HttpRequest`

uladzislau_danilchyk
2020-11-05 09:28
@uglyog, works with Apache lib:)

uladzislau_danilchyk
2020-11-05 09:31
@uglyog, hm.. it's very strange.. Interaction doesn't have any provider states... but in Pact it exists.

uladzislau_danilchyk
2020-11-05 09:32
@uglyog providerStates list is empty

uglyog
2020-11-05 09:32
That is not right

uladzislau_danilchyk
2020-11-05 09:33
@uglyog , but I have another method annotated with `@States("my-state")` and breakpoint was hit there.

uglyog
2020-11-05 09:34
I'll need to investigate that, it should not be empty. It might be a defect

uladzislau_danilchyk
2020-11-05 09:34
@uglyog it would be good.

uladzislau_danilchyk
2020-11-05 09:36
@uglyog but again. Can Pact's team add following functionality: for method annotated with `@State` pass `HttpRequest` to have an ability to modify request along with provider state?


uglyog
2020-11-05 09:37
It is called before the request is created'

uglyog
2020-11-05 09:37
Just checked an example, and the provider state is populated


uladzislau_danilchyk
2020-11-05 09:39
@uglyog currently i'm in breakpoint in method annotated with `@State` and in debug returned back to `PactVerificationStateChangeExtensio#beforeTestExecution()` and it has `providerStates` populated.

uladzislau_danilchyk
2020-11-05 09:39
But inside my method it doesn't: ``` @TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) public void pactVerificationTestTemplate(PactVerificationContext context, HttpRequest request, Interaction interaction) { context.verifyInteraction(); }```

uglyog
2020-11-05 09:39
Not that method, the actual test method

uglyog
2020-11-05 09:39
`pactVerificationTestTemplate`

uladzislau_danilchyk
2020-11-05 09:40
@uglyog, sorry. don't understand what you mean

uglyog
2020-11-05 09:41
The interaction will only be passed into the test method (in your example pactVerificationTestTemplate)

uladzislau_danilchyk
2020-11-05 09:42
yep, but it doesn't exist.

uglyog
2020-11-05 09:42
That example link I posted works, I just checked it

uglyog
2020-11-05 09:44
And I reply with

uladzislau_danilchyk
2020-11-05 09:45
its strange..

uglyog
2020-11-05 09:45
Are there more than 1 interaction in the pact file?

uladzislau_danilchyk
2020-11-05 09:46
@uglyog, ohh... I just have a pact with duplicated interaction but second interaction has provider state...) consumer have 'update' instead of 'replace' option


uladzislau_danilchyk
2020-11-05 09:47
and now providerStates is populated)

uladzislau_danilchyk
2020-11-05 09:47
thanks!

uladzislau_danilchyk
2020-11-05 09:48
I just wanted to ask you something more: I saw in examples that provider state method can have a map as a Parameter, but where this map is populated?

uglyog
2020-11-05 09:49
In V3 format pact files, they can have parameters

uladzislau_danilchyk
2020-11-05 09:49
@uglyog , oh, only in V3


uladzislau_danilchyk
2020-11-05 09:49
I'm using pactSpecification.version 2.0.0

uladzislau_danilchyk
2020-11-05 10:03
@uglyog in case of multiple interaction states I cannot filter out current executing provider state for the verification. I need to modify request which depends on current provider state

uladzislau_danilchyk
2020-11-05 10:03
Do you see what I mean?

uglyog
2020-11-05 10:09
Look at the example code I posted, it uses an if statement if it is the correct provider state

uladzislau_danilchyk
2020-11-05 10:10
But in this code you just checking everytime first state `i.providerStates[0].description === '...'`

uglyog
2020-11-05 10:12
That was only an example

ukrainian1991
2020-11-05 11:45
I check the service which proxies payments to real 3rd party gateway? 3rd party would be mocked, but anyway I could not rely on fixed date

reema.dhiman
2020-11-05 13:07
has joined #general

ukrainian1991
2020-11-05 13:55
If I understant correctly I need to use `dateExpression` But can't figure out how to set next year shift

ukrainian1991
2020-11-05 13:56
expression type is string

ukrainian1991
2020-11-05 14:25
It was hard to find)))


ukrainian1991
2020-11-05 14:25
Please add it to docs

ukrainian1991
2020-11-05 14:55
```pactDslObject.dateExpression("expiration_year", "+ 4 years", "yyyy")``` Works like a charm)) Thanks to everyone)

jarmy
2020-11-05 23:26
Hi everyone. What?s the suggested approach for handing non-breaking changes to a provider (e.g. a consumer requests a change to the API generated by the provider). Should the consumer teams add the new feature to their pacts first, as sort of a distributed TDD style workflow, which will give provider a clear idea of what they are expected to deliver? However, wouldn?t that break builds on all other concurrent branches or PRs at the time? How do you synchronize the merging of the updated provider in the consumer team, with the updated implementation in the provider, without build failures? The provider team I?m working with wants to know: > What would be the happy path, where nothing breaks?



jarmy
2020-11-06 00:00
I?m not sure this meets our situation since it seems to infer that the consumer changes the contract. Our situation is as such: 1. The consumer published a pact with a _develop_ tag 2. The pact tagged with _develop_ was verified by the provider 3. The provider changes the API upon a request from the consumer which changes the response body 4. The provider verification build fails with the existing contract

bethskurrie
2020-11-06 00:10
If the consumer is requesting a change, they need to change their contract (typically on a branch)

bethskurrie
2020-11-06 00:11
The consumer branch should not be merged to the main branch until the feature has been implemented on the provider.

bethskurrie
2020-11-06 00:12
I'm a bit confused about something though - you said it was a non-breaking change.

bethskurrie
2020-11-06 00:12
If the consumer has not yet updated their contract, how did the verification task fail?

bethskurrie
2020-11-06 00:13
The CI/CD workshop shows you how to do a flow where all the tests stay green.

jarmy
2020-11-06 00:16
Well, the provider team indicated it?s a non-breaking change. I?m not convinced. If the response from the provider has changed, how can it not be breaking?

bethskurrie
2020-11-06 00:16
it sounds breaking to me.


bethskurrie
2020-11-06 00:17
you can add a field though

bethskurrie
2020-11-06 00:17
that's not a breaking change. You could add more values to an enumerator.

bethskurrie
2020-11-06 00:17
breaking changes would be changing types of used fields, or removing them.

jarmy
2020-11-06 00:18
I believe they changed the response body. It used to have a container with 2 elements but now only has 1

bethskurrie
2020-11-06 00:19
that's a contentious one. It's broken the contract, but not necessarily changed the schema.

jarmy
2020-11-06 00:20
This was the failure message from pact ```1.1) BodyMismatch: $.page.containers BodyMismatch: $.page.containers Expected [BIG OBJECT] to have minimum 2```

bethskurrie
2020-11-06 00:21
In this case, the consumer needs to change their expectations first.

bethskurrie
2020-11-06 00:21
change to "at least one"

jarmy
2020-11-06 00:22
Right, I suspected the contract needed an update. What?s the best process for handling that? Is it simply both the provider and consumer talking?

bethskurrie
2020-11-06 00:23
yes.

bethskurrie
2020-11-06 00:23
there's a slide in every one of my talks that says "CDCs are not a replacement for good communication between teams"

bethskurrie
2020-11-06 00:23
"integration tests weren't either".

jarmy
2020-11-06 00:23
Ha. I?ve seen it mentioned

bethskurrie
2020-11-06 00:24
I do tend to stress it heavily :stuck_out_tongue:

jarmy
2020-11-06 00:24
I?ve got to stress that to the teams that are now using contract testing

bethskurrie
2020-11-06 00:29
> For an sqlite database (only recommended for investigation/spikes, as it will be disposed of with the container unless you mount it from an external file system):

bethskurrie
2020-11-06 00:30
I'll update that to mention the concurrency stuff as well!

bethskurrie
2020-11-06 00:36
@ukrainian1991 all our docs can be modified with a PR. Would you mind adding it while it's fresh in your mind? We always appreciate user contributions.

abubics
2020-11-06 01:33
Fair enough :thumbsup: I would default to leaving all validations like that to the actual source of truth, and then only start taking on that responsibility if it gives UX benefits. Maybe that's what you're doing, or something similar :)

matt.fellows
2020-11-06 01:57
I?ve literally had somebody on a phone call suggest we build an integration into their telephony systems, to automatically ?call the other team? (or book a meeting) if they need to change a contract

matt.fellows
2020-11-06 01:57
They mentioned that ?teams don?t like to talk to each other? and that they saw an opportunity for us to help change it

matt.fellows
2020-11-06 01:58
I placated them as best I could ?Oh, that?s an interesting idea. Let me chat with the team??

matt.fellows
2020-11-06 01:58
it?s not an uncommon sentiment, however

linda.anthu
2020-11-06 15:50
hello :slightly_smiling_face: can anyone help me ? I wanted to update a field on request but I always get timeout :( (edited)  ```[2:28 PM] describe("get football market information", () => { let opts: any; before((done) => { opts = { providerBaseUrl: conf.provider[0].BASE_URL, pactBrokerUrl: conf.pact_broker.URL, provider: conf.provider[0].NAME, publishVerificationResult: true, providerVersion: conf.provider[0].VERSION, requestFilter: (req: any, _res: any, next: any) => { if (req.path.match("/api")) { const chunks: any[] = []; req.on("data", function (chunk: any) { chunks.push(chunk); }); req.on("end", function () { req.body = JSON.parse(Buffer.concat(chunks).toString()); if (req.body.params.filter.marketIds) { req.body.params.filter.marketIds = [marketId]; } next(); }); } else { next(); } }, }; done(); }); it("validates the expectations of Matching Service", (done) => { return new Verifier(opts).verifyProvider() .then(output => { done(); }) .catch((error) => { done(error); }); }); });```

matt.fellows
2020-11-06 21:45
I'm actually not sure it's possible with the current setup. Despite it appearing that way, you can't just change the body as it is a stream. Could you please raise an issue on GH

nish699
2020-11-09 12:28
has joined #general

dikili
2020-11-09 17:18
Hi all @here , I have a generic question for provider verifications...I have a request where although I can verify via postman that api is up and all is fine.. I get an error saying

dikili
2020-11-09 17:18
Expected an Array but got a String ("") at $

dikili
2020-11-09 17:18
and also status came as 308, instead of 200

dikili
2020-11-09 17:19
was the other error item.. Do you know what could be done to resolve it , I cant seem to see/find anything on the code that wd flag anything wrong :disappointed:

dikili
2020-11-09 17:44
I am on VPN and use pactflow as the broker

rforjoe
2020-11-09 20:29
has joined #general

pbobba
2020-11-09 23:03
has joined #general

jun.li
2020-11-09 23:05
has joined #general

matt.fellows
2020-11-10 01:53
:wave:

matt.fellows
2020-11-10 01:54
What language are you using? There are many possibilities here, it would be great to see your code so we can help

matt.fellows
2020-11-10 01:54
See also howtoask

2020-11-10 01:54
Please see this page for some tips on how to ask for help to get the best response from the community https://docs.pact.io/help/how_to_ask_for_help

douweicai
2020-11-10 04:11
has joined #general

christian.huber
2020-11-10 09:20
has joined #general

vuttithatkrongyot
2020-11-10 10:57
has joined #general

dikili
2020-11-10 11:05
@matt.fellows this is c# but does the language even matter, I only get this error when provider runs, consumer test seems to pass.. I attached both cons and prov code below,fyi

dikili
2020-11-10 11:05
`[Fact]`         `public void TestProvider()`         `{`           `//  var comp= new PactClient();`             `string provider = "MobileApi";`             `string consumer = "MobileApp";`            `// var pact = comp.GetPact(provider, consumer);`          `//   var pactUrl = pact.ResponseUri.Host;`             `// Act + Assert`             `var buildNumber = Environment.GetEnvironmentVariable("BUILD_NUMBER");`             `//Assuming build number is only set in the CI environment`             `var config = new PactVerifierConfig`             `{`                 `Outputters = new List<IOutput> //NOTE: We default to using a ConsoleOutput, however xUnit 2 does not capture the console output, so a custom outputter is required.`                 `{`                     `new XUnitOutput(_output)`                 `},`                 `Verbose = true,`                 `PublishVerificationResults = true,`                 `ProviderVersion = "1.0.0"`             `};`             `IPactVerifier pactVerifier = new PactVerifier(config);`             `pactVerifier`                 `.ServiceProvider(provider, "http://endpoint/mobile-api-jobseeker")`                 `.HonoursPactWith(consumer)`                 `.PactBroker("pactflo", new PactUriOptions("token"))`                 `.Verify();`         `}`

dikili
2020-11-10 11:06
consumer:

dikili
2020-11-10 11:07
`public void Suggestions_For_JobTitles()`     `{`         `// Arrange`         `#region Consumer Request`         `_mockProviderService.Given($"I request IT job suggestions")`                            `.UponReceiving($"A GET request for getting job titles for term IT")`                            `.With(new ProviderServiceRequest`                            `{`                                `Method = HttpVerb.Get,`                                `Headers = new Dictionary<string, object>`                                `{`                                    `{ "x-correlation-id", "4f684829-af1c-4f51-abfd-232334420946" },`                                    `{ "x-correlation-source-id", "MOBILE-API-JOBSEEKER" },`                                    `{ "x-device-app-ref", "f1715508-3a20-495d-bbdb-0d2fc45f0733" },`                                    `{ "x-app-version", "4.0.1000" },`                                    `{ "x-os-version", "9.0" }`                                `},`                                `Path = $"/jobs/titles/suggestions/IT"`                            `})`                         `.WillRespondWith(new ProviderServiceResponse`                         `{`                             `Status = 200,`                             `Headers = new Dictionary<string, object>`                             `{`                                 `{ "Content-Type", "application/json; charset=utf-8" }`                             `},`                             `Body = Match.MinType(new { }, 1)`                         `});`         `#endregion`         `var mockClient = new MockClient(_mockProviderServiceBaseUri);`         `// Act`         `var result = mockClient.GetJobTitles("IT");`         `// Assert`         `Assert.NotNull(result);`         `#region Pact Teardown`         `_mockProviderService.VerifyInteractions();`         `#endregion`     `}`

dikili
2020-11-10 11:08
@matt.fellows I attached the codes above , looking forward to help ...thank you !

matt.fellows
2020-11-10 11:08
It matters because it is almost certainly a configuration issue

matt.fellows
2020-11-10 11:09
I?m assuming `.PactBroker("pactflo", new PactUriOptions("token"))` is just you replacing the actual broker and token?

matt.fellows
2020-11-10 11:09
I don?t know .NET all that well, but there must be a way to enable verbose logging so that we can see what the verification process is doing

dikili
2020-11-10 11:09
yes that is true, i did not want to reveal my token and the username that is whuy

dikili
2020-11-10 11:10
I have the logs as well, let me give the logs I have and let me know if you need more logs and i can look for a way to generate it

matt.fellows
2020-11-10 11:10
if you could please enable verbose logging as per the example https://docs.pact.io/implementation_guides/net/readme#2-tell-the-provider-it-needs-to-honour-the-pact and share that

dikili
2020-11-10 11:11
Ok then I will enable this and re-run and share the logs with you


dikili
2020-11-10 11:28
@matt.fellows pls see the logs

dikili
2020-11-10 14:26
@matt.fellows I realised that this output is already with Verbose=true, so wont any further logs

dikili
2020-11-10 14:28
pls note that other interactions in the test suite works fine but one of the tests with failure..

dikili
2020-11-10 14:49
@matt.fellows I managed to sort the above problem out and it seems working for me now, fyi..

dan.iosif
2020-11-10 17:06
has joined #general

wesleythomaswilliams
2020-11-10 19:14
Revisiting our Pact tests to flesh some stuff out and in doing so, found one of my services needs to have provider tests for both rest endpoints and kafka messaging. I've written two separate provider test classes (I'm working in java, but I expect this issue to be universal), one for rest, one for messaging tests. However, when I run the tests in either class, they execute against all consumers, irrespective of the connection type. I'm assuming this is happening because the provider name is the same for both, because it's the same service, it just provides two different communication methods. Is there a sensible way of resolving this beyond giving the provider different names in each test class (e.g. <service_name>-rest and <service_name>-kafka) as that seems a bit hacky and not very elegant (and all consumers will need updating too with the updated provider names).

phil.endsley
2020-11-10 19:24
Probably worth waiting for additional confirmation, but I'm 90% sure having different service names is the only way

matt.fellows
2020-11-10 22:55
Yes, that?s correct unfortunately

matt.fellows
2020-11-10 22:55
see https://github.com/pact-foundation/pact-specification/issues/79 for the upcoming change to allow both formats in the same file

uladzislau_danilchyk
2020-11-11 08:24
Hi all! Is there possibility to check/match response value? Not match by type? (pact-js)

francislainy.campos
2020-11-11 08:36
Hi, if you're using Java instead of using .stringType for example, you would use .stringValue, .booleanValue would replace .booleanType, etc.

uladzislau_danilchyk
2020-11-11 08:40
@francislainy.campos, I'm using pact-js

francislainy.campos
2020-11-11 08:42
Ah, okay. Sorry, not sure if there's an equivalent there for this, as the versions seem to vary a bit between languages. Maybe @uglyog or @matt.fellows would be able to confirm that for you.

uladzislau_danilchyk
2020-11-11 08:47
@uglyog, @matt.fellows what do you think about my case?

matt.fellows
2020-11-11 09:13
Please ask in #pact-js

matt.fellows
2020-11-11 09:14
You can match on value in all languages, just don't use a matcher!

matt.fellows
2020-11-11 09:15
But share your code and we can help

dan.iosif
2020-11-11 09:20
Hey everyone, We've implemented Pact as suggested (Provider and Consumer). When verifying the Provider the verifications are fired at the real service, therefore invoking any processes that are required to correctly fulfil a response. This is having an impact on our system by polluting our data set with the data that's in the Consumer tests. How would you suggest we avoid polluting our data when using Pact?

matt.fellows
2020-11-11 09:21
Don't run it against a live system

matt.fellows
2020-11-11 09:21
That would be the recommendation

matt.fellows
2020-11-11 09:21
You really want the tests to be deterministic and live systems usually don't have this property

matt.fellows
2020-11-11 09:30
The standard approach is to be able to run the system locally (i.e. spinning up the service as a black-box/hermetic server style with external dependencies stubbed) You should be able to run pact on your Dev machines and in a CI pipeline without ever deploying your code

dan.iosif
2020-11-11 09:31
Thank you very much for replying, Matt!

dan.iosif
2020-11-11 09:32
Since we're hitting Lambdas, they're already deployed, but it's a dev environment.

matt.fellows
2020-11-11 09:35
In most cases you can still do this locally

matt.fellows
2020-11-11 09:36
Otherwise you might need a data fixture cleanser, that seeds before the tests and wipes afterwards

matt.fellows
2020-11-11 09:36
Are you using SAM or Serverless framework or something?

matt.fellows
2020-11-11 09:36
Are they HTTP pact or message?

dan.iosif
2020-11-11 09:38
We're using AWS SAM, yeah, and they're HTTP pacts.

matt.fellows
2020-11-11 09:42
which language?

dan.iosif
2020-11-11 09:43
JS. :smile:

matt.fellows
2020-11-11 09:43
It?s on my list to put an example together

matt.fellows
2020-11-11 09:43
perfect, I was hoping you?d say that

dan.iosif
2020-11-11 09:43
:joy:

dan.iosif
2020-11-11 09:43
Haha!

matt.fellows
2020-11-11 09:43
:slightly_smiling_face:

dan.iosif
2020-11-11 09:43
I'll be honest, I'd really appreciate more examples...

matt.fellows
2020-11-11 09:43
pactflowexamples


dan.iosif
2020-11-11 09:44
It's certainly a reflection on myself, but the Pact docs have so much theory I can barely cope. :sweat_smile:

matt.fellows
2020-11-11 09:44
:point_up: We?ve been adding a bunch here. They are linked from http://docs.pact.io also

matt.fellows
2020-11-11 09:44
You may also enjoy pactflowuniversity


dan.iosif
2020-11-11 09:45
Oh, I hadn't seen that before!! I'll take a look and share with the people in my company.

simon.nizov
2020-11-11 14:29
We just deployed our first feature after enabling can-i-deploy and pending+WIP pacts in my company for the first time. It works beautifully! Thanks @pact-team! :tada:

matt.fellows
2020-11-11 23:58
:taco: for @simon.nizov , not just for getting to `can-i-deploy`, but also for being a great contributor in this forum and for his PRs in various repositories over the past few months :clap:

matt.fellows
2020-11-11 23:58
Awesome to see you getting to see the fruits of your labour!

rodrigo.costa20
2020-11-12 00:59
has joined #general

yong.gong188
2020-11-12 09:13
has joined #general

lakitna
2020-11-12 10:04
We just ran into a very interesting one. In my org we have sister orgs. I just got a situation where the sister org wants to get going with Pact as well. Pactflow is setup for the main org right now. The sister org will have internal APIs that the main org doesn't care about, and they will have APIs that directly connect to the main org. I'm not sure how to think about this just yet. What would be the best way to set this up? 1. One broker for the main org and its sister orgs. (single broker) 2. One broker for every org. (multiple brokers) 3. One broker for every orgs internal stuff, and one for the shared stuff (multiple brokers)

anandhadeepak
2020-11-12 13:03
has joined #general

david.dias
2020-11-12 20:04
has joined #general

matt.fellows
2020-11-13 05:49
Interesting. I?d suggest going down the single broker route (1) - unless there are really good reasons to separate them. Are there specific issues you?re expecting to run into?

matt.fellows
2020-11-13 05:50
Once you have two brokers, and you need to ?cross the streams? there is currently no supported way to do that, aside from manually dealing with it (i.e. a consumer/provider may now exist in both - so you?ll have to use the CLI tools in ways they weren?t designed and may miss something)

matt.fellows
2020-11-13 05:50
Are you referring to the OSS one Sander or Pactflow? The Teams and Roles/Permissions in Pactflow will certainly go a way to helping some of this hear

billal.patel
2020-11-13 10:31
has joined #general

lakitna
2020-11-13 14:57
In our case, we're talking about Pactflow. Tough I feel like too early to bind this question to a technical details. The biggest issues that might pop up come from the fact that the sister org have their own independent systems and organisational structure. They often use different standards, have other types of legacy, and some have a different culture when it comes to integration. Having the sister orgs be a part of the same broker might help with aligning some of these things, but it would be a long process. A process we have very little control over from within the main org. If possible I would prefer to not involve upper management, they generally lack the technical background for a quick resolution. All of this makes it as much an organisational question as a technical one.

lakitna
2020-11-13 14:59
Reading this back, this thread got really org specific real quick. I'll discuss this with in the main org as well.

michaelkochub
2020-11-13 17:08
Hello! This question is less technical and more related to best practices. Suppose I need to set up an endpoint that responds to provider state changes. I can create a new, standalone service that will serve the endpoint and respond to requests. This works when the service doesn't need to access beans or other services offered by the application. Is there any advice or guidance related to the case where the endpoint should live inside the provider application (so that it is easy to inject other Spring beans and services into the endpoint)? A canonical example of this might be a provider state that expects a user to exist (which requires a call to `UserService#createUser` for example) Several possibilities include 1) Adding authentication to the endpoint and passing the hard-coded auth key in the provider state params 2) Registering the endpoint only for tests 3) Putting the endpoint behind a feature toggle which is set only set to true by the test configuration

2020-11-13 19:34
A new post has been created in *Feature Requests*

matt.fellows
2020-11-13 21:07
I would add the endpoint only during a test phase (e.g setup in a spring test context). I wouldn't deploy it, but there are occasions where that's difficult to avoid. I would have the endpoint fully locked down if it went to prod and completely inaccessible to the public or other internal systems

mikahchapman
2020-11-13 23:40
So, I know authorization and this page (https://docs.pact.io/provider/handling_auth/) have probably been talked to death, but I'm not really wondering about "how to do authorization with pact". I'm more curious on what people's thoughts are on whether authorization belongs in a contract or not. I'm torn because on the one hand, it seems like it should because the provider will behave differently if that header is present or not. On the other, we're not trying to use Pact to verify that the authorization works on the provider, we're verifying other elements of the interaction (other headers, response shape, etc.), so authorization should just be stubbed to a true state. What are other people's thoughts on this?

bethskurrie
2020-11-13 23:41
If it's a well known standard, I often don't bother putting it in the contract (eg. bearer token, basic auth)

bethskurrie
2020-11-13 23:42
If it's unlikely to change, so there is not much benefit putting it in a contract. If it's a custom thing, then there may be benefits.

mikahchapman
2020-11-13 23:42
That's what we're working with, mostly bearer token. And that's the vibe I was getting from point 1 on that page.

bethskurrie
2020-11-13 23:43
The Pactflow API allows 3 different types of auth (basic auth for the legacy tenants, bearer auth for the new ones, and UI auth via Cognito and JWTs). We just stub out the auth in our internal Pact tests, and use other tests to make sure the auth works.

bethskurrie
2020-11-13 23:43
It simplifies things.

bethskurrie
2020-11-13 23:45
What you can do is stub out the auth by default, but then have a provider state and a specific example for when the auth fails.

uglyog
2020-11-14 02:40
Even using two different apps, the actual one that gets deployed, and a test support one that does not. Some people won't like having test code in the actual app, even if turned off.

louis.oliver
2020-11-16 10:33
has joined #general

ashishkujoy
2020-11-16 15:08
has joined #general

raghanag
2020-11-17 00:12
Has anyone used pact/contract testing when there are message queues like Kafka etc?

matt.fellows
2020-11-17 00:15
yes, what language Naga?

matt.fellows
2020-11-17 00:15
See pactflowexamples for a Java and JS integration


raghanag
2020-11-17 00:17
hi @matt.fellows both js and java.

raghanag
2020-11-17 00:17
we have few microservices which instead of interacting with each other they communicate thru kafka in the middle

matt.fellows
2020-11-17 00:18
cool, well hopefully those examples help. We call this form of testing ?Message Pact?


abubics
2020-11-17 00:19
I know there are some translations of workshops into different programming languages . . . are there translations into different human languages?

tjones
2020-11-17 00:20
We did have a Chinese version at one point, but I don't think it's up to date

matt.fellows
2020-11-17 00:23
yes, somebody translated http://docs.pact.io. But no examples that I know of have been

abubics
2020-11-17 01:03
aha, cool . . . I've seen open source things where people basically set a checklist up of things that need translating/updating, and that's worked into the site (similar to Wikipedia too, I guess?). It is a lot of up-front and maintenance effort, though.

pradeepchoube
2020-11-17 03:49
has joined #general

tjones
2020-11-17 09:24
No, but it should be possible, I think.

tjones
2020-11-17 09:24
Good thinking. We could also use that list for the existing docs, too

meng-lingtao
2020-11-17 14:39
has joined #general

pabvidcal
2020-11-17 15:30
has joined #general

magesh.nagamani
2020-11-18 05:15
has joined #general

lakitna
2020-11-18 12:03
Now that more teams are starting to use Pact in our org, we keep seeing the same reasons why people don't like it at first. The biggest of those has to do with functional tests. Due to the amount of legacy there remains a strong need for functional tests. Some of those are executed on an end-to-end environment, and some in isolation with stubs. It's very easy to include these tests in the Pact, but it's considered bad practice for multiple reasons. The result of this is basically that we have to setup two separate stub servers, for example; Pact and Wiremock. One is there to facilitate the contract tests, the other for functional tests. Setting up two separate systems, that do many of the same things, feels a bit iffy. Because of this, I wondered if we can use the Pact stub server for all stubbing uses without all tests making it into the Pact. Basically an opt-in or an opt-out system on the consumer-side. TL;DR: Can we exclude tests from a Pact?

jstoebel
2020-11-18 13:53
has joined #general

sklein
2020-11-18 14:49
Have you considered just using tags to mark just the tests you want to create the pact? How you do that is language and framework specific but the concept should translate.

sklein
2020-11-18 14:53
Since you mention Wiremock I'm going to assume you're working in a JVM based envrionment so maybe Junit Tags are something to look into https://www.baeldung.com/junit-filtering-tests

sklein
2020-11-18 14:58
Another consideration would be partitioning these tests into separate libraries one for your more typical integration/e2e tests and another for the contract specific tests and then configure only the contract test library to publish to the broker on test run in your ci/cd pipeline

jgfarias42
2020-11-18 16:10
The Pact server works just like the Wiremock server, however it has an additional by product of generating an interaction specification. Why not use only Pact? Tests on the consumer side: Your SUT will be your Client object, the one that makes the remote calls. You then TDD the creation of the Client object: ? Configure the Pact Server for one interaction ? Write something on the @test, run and see it fails ? Write the code on the Client object, run the test and it passes ? Repeat until no more interactions On the provider side: Your SUT will be the Controller object. You then use the consumer contract as a specification and TDD building the controller until the specification is satisfied. What?s the point of these integrated/E2E checks, if the Client and Controller object are on the periphery of the consumer and provider applications?

tjones
2020-11-19 01:21
You could also use Pact as a fake consumer to generate the functional tests you need. That way, you'll have two pacts: Real consumer -> Real provider Functional tests -> Real provider

matt.fellows
2020-11-19 03:57
REMINDER: our community event is on today at 8pm AEDT / 9AM GMT. Join the live stream here: https://youtube.com/watch?v=wkld_wRsTDE Have a question you?d like to ask of the maintainers? Ask here: https://app.sli.do/event/txxh27zr Can?t wait to see you all!

matt.fellows
2020-11-19 08:57
we?re about to kick off. Join us, won?t you?

guppy0356.nakira
2020-11-19 08:59
I forgot about the time difference from Japan... I will join later.

matt.fellows
2020-11-19 10:17
@antonello?s team at Treatwell. Went from 2 deployments a month, to 20 a month, to 45 a week :clap:

brendan.donegan
2020-11-19 10:23
That?s cool. We?re still at stage 2 in that journey, due to relying on a lot of e2e?s still

daniel.sayer89
2020-11-19 10:33
has joined #general

art.ptushkin
2020-11-19 10:34
has joined #general

pact457
2020-11-19 10:36
has joined #general

ajerthan.sivayoganath
2020-11-19 10:38
has joined #general

matt.fellows
2020-11-19 10:55
very cool!

philipchardwick
2020-11-19 11:05
has joined #general

tanzmann
2020-11-19 11:09
has joined #general

tjones
2020-11-19 11:11
This was the coolest bit for me

olivier.quere
2020-11-19 12:10
has joined #general

wilfried.vandenberghe
2020-11-19 12:19
has joined #general

simon.nizov
2020-11-19 13:08
Great event today guys, it was a pleasure to watch! Thank you!

elliottmurray
2020-11-19 14:05
Glad you enjoyed it!

2020-11-19 15:30
A new post has been created in *Feature Requests*

alan.hanafy
2020-11-19 19:28
has joined #general

jarmy
2020-11-19 20:59
One of our provider teams has run into a problem after adding a pact verification job on `contract_content_changed` events: https://docs.pact.io/pact_nirvana/step_4/#e-configure-pact-to-be-verified-when-contract-changes. There was a recent update to the contract to bring it in line with an api change made by the provider. The new pact was verified by the provider in its CI job. There are now branches in the consumer that have drifted behind the contract in the master branch. When a commit is made to these branches, a CI build is initiated, the outdated pact is published and a `contract_content_changed` event is triggered. This causes the pact verification job to fail since it is using an old contract. How do I resolve this issue? Is it recommended to only publish pacts on the `master` branch once a contract has been established?

phil.endsley
2020-11-19 21:07
> Is it recommended to only publish pacts on the `master` branch once a contract has been established? Publish with each commit > How do I resolve this issue? Is there an issue? It sounds like that's what you would want. ? Outdated consumer branches are publishing a contract ? Provider build is triggered to verify ? Verification fails, and publishes the failed verification to pact broker This is what you want, since the contracts are not compatible. Failed verification results are not necessarily bad, it just indicates that version of the provider is not compatible with that version of the consumer, so you can't deploy those together

jarmy
2020-11-19 21:35
Ok, we?re already publishing on each commit. My concern was twofold: ? The provider team was notified via slack about a failure and struggled to understand why ? The pact broker showed ?last verified? as failed for the pact

jarmy
2020-11-19 21:37
Once a pact verification test succeeded, the pact broker became happy again

michael.deutscher
2020-11-19 21:39
has joined #general

phil.endsley
2020-11-19 21:40
Speaking for myself, our practice is to do everything in feature branches. Because of that, the dashboard last verified status is useless for us (I haven't found a use for it yet anyway) because it's almost always for a feature branch

phil.endsley
2020-11-19 21:41
It's the end of the work day for me, and my brain is fried. Would pending pacts work in this scenario? To not fail the provider build?

jarmy
2020-11-19 21:43
We?re already using pending and WIP pacts on the provider, They don?t seem to work in this case

phil.endsley
2020-11-19 21:50
I guess that makes sense if the consumer branches push a commit, but didn't change the contract that's on their branch

jarmy
2020-11-19 21:51
yeah, the contract itself didn?t change but it was tagged with either a different version or branch

gerry.power
2020-11-20 03:31
has joined #general

alex900
2020-11-20 05:08
has joined #general

tomas.panik
2020-11-20 08:28
has joined #general

brendan.donegan
2020-11-20 08:48
@jarmy I assume you already tag your contracts with the branch?

brendan.donegan
2020-11-20 08:53
I see now what you?re saying. My answers would be 1. A details needs to be added to the Slack message saying which branch failed. The provider team should only care about master. 2. Explain to them that Last Verified showed as failed is not something they should care about or look at and explain how to use the search feature in ?The Matrix?

marc.ferland
2020-11-20 14:43
has joined #general

sebastien.crapoulet
2020-11-20 15:24
has joined #general

sebastien.crapoulet
2020-11-20 15:24
Hello :slightly_smiling_face:

adutrillaux
2020-11-20 15:28
has joined #general

he
2020-11-20 15:59
has joined #general

phil.endsley
2020-11-20 16:03
Just got done watching the recording of the event from the other day. Lots of great stuff in there! :clap: I know these things take a lot of effort to coordinate on top of the time commitment. I'm very appreciative of everyone on the panel taking the time out to do this! p.s. Thanks for recording it! I really didn't want to wake up at 3am to watch :smile: A couple follow up questions for it 1. @antonello How did you figure out the number of pacticipants over time? 2. Any chance of making the slides available? Particularly interested in the demo ones from @tjones

antonello
2020-11-20 16:05
Hey @phil.endsley ! Thanks for watching and thanks for your feedback :) We?ll made the slides available very soon and also answer the questions we go on http://sli.do.

antonello
2020-11-20 16:06
To answer your question, I simply queried the broker?s pacticipants table (I was specifically interested in the created_at column)

antonello
2020-11-20 16:07
Hi @sebastien.crapoulet! Welcome! :blush:

ivgeni.slabkovski
2020-11-20 21:52
has joined #general

matt.fellows
2020-11-20 23:40
There is also a `/metrics` endpoint, if you regularly ingested that into your log/analytics tool, you could graph it from there too

matt.fellows
2020-11-20 23:40
and yes, we?ll make all of the content available soon

serhatburakyildirim
2020-11-21 21:57
has joined #general

alnasl
2020-11-22 18:46
has joined #general

ashutosh23802
2020-11-23 06:20
has joined #general

leonty
2020-11-23 10:33
has joined #general

dariusz.piwko
2020-11-23 11:34
has joined #general

uladzislau_danilchyk
2020-11-23 15:08
Hi everyone! I have a question regarding provider verification using junit5. I have a provider verification test as per docs. And I want to verify provider against specific pacts version (consumer version) which are stored in Pact Broker? How to do that? I want to pass consumer version before/during running of provider verification test. But no docs were found related to that. Could anyone help me?

antonello
2020-11-23 15:18
I am not sure if there is other way, but I?ve done is using `pact.filter.pacturl`

antonello
2020-11-23 15:19
Basically setting the property like this `-Dpact.filter.pacturl=http://$BROKER_HOSTNAME:$BROKER_PORT/pacts/provider/$PROVIDER_NAME/consumer/$CONSUMER_NAME/version/$CONSUMER_VERSION`

antonello
2020-11-23 15:33
(I?d recommend you use #pact-jvm for questions on pact-jvm :slightly_smiling_face: )

phil.endsley
2020-11-23 16:08
Hey all, wanted to start a discussion to see how others handle this, and see if maybe there's a way to make this easier. We're in a situation now where we're starting to rollout Pact across our company. Our company is in the middle of basically re-writing a lot of stuff, and we have a lot of microservices. One of the biggest pain points I'm running into is the first set of pacts. ? No pacts exist ? Create and publish pact on a feature branch ? Create provider verification in feature branch ? There's nothing with a develop/master/main tag, so merging the provider first will fail, since there are no pacts to verify ? Merging the consumer without verification is not good So in this situation, we're in a sort of limbo period for the first set. This has come up here a few times before, and I think the prevailing advice is, "It's the first set of pacts, so nothing is using it yet. Just do what you need to do to get the first set in". My issue is that, while this shouldn't come up more than once for a consumer/provider pair, it's coming up a lot now as more and more applications start adding pacts for the first time. Basically, my main complaint is: I've spent the past year convincing everyone to try it out and use it. Now that they are (after a lot of resistance), they come to me with this (known) first scenario, and I have to say something like, "Yeah, it's goofy...but just do it and you won't have to worry about this again". It's just not a great first impression for people that are basically taking my word for how to use it, because this goes against how I've been preaching it should work

praneeth.kumar
2020-11-23 16:18
has joined #general

philipchardwick
2020-11-23 17:00
We've always set it up so the provider ignores the test if theres no pacts to verify (`@IgnoreNoPactsToVerify` if you're using pact-jvm) - which I think makes sense since, if there's no pacts for it fulfill, it can do what it wants. The downside is that someone might configure the wrong tag and never actually verify the pact they expect but that'll be caught as soon as the consumer tries to run can-i-deploy.

phil.endsley
2020-11-23 17:05
We do the same thing (Also pact-jvm). But, it feels like we're adding boilerplate code to cover this unique scenario. Aside from the first one, we would always expect there to be pacts, and would want the build to fail, since it indicates something is misconfigured/wrong. The other issue is jvm specific. For junit5, we have to add null checks in addition to adding `@IgnoreNoPactsToVerify` since the context is null It just feels clunky

brendan.donegan
2020-11-23 18:42
very quick and very minor question - let?s say for a particular interaction we don?t care much what the response code is, or maybe we want it to be 2xx. Is there a way to specify that using Pact?

jarmy
2020-11-23 18:46
I'm now passing `${pactbroker.consumerVersionTags}` into the Jenkins verify job to include in the slack message. I've told the provider team to only pay attention to `main|master|develop` branches


brendan.donegan
2020-11-23 21:19
Ok, cool. Was just fixing a contract that expected 200 back from an endpoint and it was giving 201 (which was wrong cause it wasn?t creating anything), but really most client code is doing something like `if (response.ok) {` or `if (response.status < 400)`

matt.fellows
2020-11-23 22:34
exactly

uglyog
2020-11-23 22:39
If it is a brand new provider, then I just work on master and not bother with a feature branch, because nothing is using it yet so it is safe to deploy. I create the consumer pact in the consumer project, publish that, then get the provider verification passing, deploy that (dark release). Then look to release the consumer to use the new provider.

uglyog
2020-11-23 22:41
If it is adding Pact tests for existing services, then they are already working in production, so I think you can tag with the production tags at the start.

uglyog
2020-11-24 00:14
The problem is the can-i-deploy check in the pipeline. You'll need a way to bypass that as a quality gate until everything is running

mark.white
2020-11-24 09:03
has joined #general

nerea.tamayo
2020-11-24 12:40
Hi all! I'm trying to create webhook in PactFlow for triggering Jenkins pipeline but I don't know how to start.... In PactFlow, clicking on "add webhook", there are some parameters... ? url, is the provider pipeline I want to trigger with in Jenkins? ? About credentials....Which are the credentials I need to use in the PactFLow's webhook? Is the service account I'm using for running the pipeline in Jenkins? Sorry for this type of questions, but I'm lost on this thanks!!!

tjones
2020-11-24 12:41
You may get a faster answer in #pactflow (although it is almost midnight here in Aus, where the pactflow team is)

nerea.tamayo
2020-11-24 12:42
Oh, yes!!!Sorry!!!

nerea.tamayo
2020-11-24 12:42
thanks!

matt.fellows
2020-11-24 13:14
:wave:

matt.fellows
2020-11-24 13:14
Yes that's my understanding. The Jenkins user/pass goes into those form fields

matt.fellows
2020-11-24 13:15
The URL of your provider Jenkins build goes in URL

matt.fellows
2020-11-24 13:16
Jenkins has a ... Funny auth model. So if the test webhook functionality doesn't tell you why it's failing you may need somebody from Jenkins admin side to help diagnose

matt.fellows
2020-11-24 13:16
My recommendation is to first test via curl or something first, and then translate to Pactflow

ufuk.ozcelik
2020-11-24 14:58
has joined #general

stefanos.varsanis
2020-11-24 16:48
has joined #general

lalexander2810
2020-11-24 16:53
has joined #general

brendan.donegan
2020-11-24 17:25
@nerea.tamayo I have quite a bit of experience with this, however it does depend on your Jenkins instance and how it is configured. Do you user a username/password or is there an auth provider like Github?

sivaprasad9
2020-11-24 20:46
has joined #general

matt.fellows
2020-11-24 22:15
Oh cool, @francisco.moreno just posted this! Hopefully it?s helpful (I haven?t reviewed yet myself, but thought best to get it to you quickly) https://www.sngular.com/contract-testing-in-ci-uniting-pact-and-jenkins/

bethskurrie
2020-11-25 02:10
@phil.endsley do you have any proposed changes that you think would help?

bethskurrie
2020-11-25 02:11
Is there a fix for @IgnoreNoPactsToVerify that would help? (Like making a NullContext object?)

bethskurrie
2020-11-25 02:12
I've considered changes to can-i-deploy but can't work out how to tell the difference between "you've misconfigured it" and "we haven't got everything started yet"

phil.endsley
2020-11-25 02:34
Honestly, I've had too much going on with other stuff at work to put any real thought towards it. Wanted to put it out here though to see if there were any thoughts about it though. If I'm remembering correctly, the jvm issue was something about the testing framework itself. Haven't looked too much into it myself, but know it has been discussed in issues raised in pact-jvm repo

phil.endsley
2020-11-25 02:36
Maybe that annotation is the answer, and just need to work out the injection piece. Then remove that in a follow up commit...

bethskurrie
2020-11-25 02:41
I wonder if WIP pacts would fix this.

bethskurrie
2020-11-25 02:42
Automatically bringing in the feature pact to be verified without having to change the config.

bethskurrie
2020-11-25 02:44
that would mean as soon as there was a feature pact, it would be considered WIP, and then there would never be a verification with no pacts.

bethskurrie
2020-11-25 02:55
nope. just did a trial run, and for a particular complicated reason, the feature pact is not considered wip

bethskurrie
2020-11-25 03:50
Ok, @phil.endsley I think I've got a tweak for WIP pacts that will help this situation. Assuming you're on a version of pact-jvm that can use wip pacts.

phil.endsley
2020-11-25 03:50
Yes, were currently using wip pacts

bethskurrie
2020-11-25 03:51
sweet. I have a little http demo client that allows you to simulate a workflow with the broker.

bethskurrie
2020-11-25 03:51
It runs in ruby however, is that something you're ok to try locally, or does it need to be dockerized?

phil.endsley
2020-11-25 03:52
Uhh maybe :grin: Dockerized would be the most convenient, but I'm sure I could get it working

bethskurrie
2020-11-25 03:53
I'll see if I can do it quickly enough.

bethskurrie
2020-11-25 03:53
So, here's the scenario

bethskurrie
2020-11-25 03:53
```td = PactBroker::Test::HttpTestDataBuilder.new('http://localhost:9292', { }) td.delete_integration(consumer: "MyConsumer", provider: "MyProvider") .can_i_deploy(pacticipant: "MyProvider", version: "1", to: "prod") .can_i_deploy(pacticipant: "MyConsumer", version: "1", to: "prod") .publish_pact(consumer: "MyConsumer", consumer_version: "1", provider: "MyProvider", content_id: "111", tag: "feature/a") .can_i_deploy(pacticipant: "MyProvider", version: "1", to: "prod") .get_pacts_for_verification( enable_pending: true, provider_version_tag: "main", include_wip_pacts_since: "2020-01-01", consumer_version_selectors: [{ tag: "main", latest: true }]) .print_pacts_for_verification .verify_pact( index: 0, provider_version_tag: "main", provider_version: "1", success: true ) .print_pacts_for_verification .can_i_deploy(pacticipant: "MyProvider", version: "1", to: "prod") .can_i_deploy(pacticipant: "MyConsumer", version: "1", to: "prod") .deploy_to_prod(pacticipant: "MyProvider", version: "1") .can_i_deploy(pacticipant: "MyConsumer", version: "1", to: "prod") .deploy_to_prod(pacticipant: "MyConsumer", version: "1")```

bethskurrie
2020-11-25 03:54
And here's the output. It makes more sense if you can play around with it locally though.

bethskurrie
2020-11-25 03:54
```============================================================= can-i-deploy MyProvider version 1 to prod: no --- errors: pacticipant: - No pacticipant with name 'MyProvider' found ============================================================= can-i-deploy MyConsumer version 1 to prod: no --- errors: pacticipant: - No pacticipant with name 'MyConsumer' found ============================================================= Creating tag 'feature/a' for MyConsumer version 1 Publishing pact for consumer MyConsumer version 1 and provider MyProvider ============================================================= can-i-deploy MyProvider version 1 to prod: no --- deployable: false reason: No pacts or verifications have been published for version 1 of MyProvider success: 0 failed: 0 unknown: 0 ============================================================= Fetching pacts for verification for MyProvider --- :providerVersionTags: - main :consumerVersionSelectors: - :tag: main :latest: true :includePendingStatus: true :includeWipPactsSince: '2020-01-01' ============================================================= Pacts for verification (1): --- url: http://localhost:9292/pacts/provider/MyProvider/consumer/MyConsumer/pact-version/00b1b6424125436c79369dddaf351313ba811aa8/metadata/d2lwPXRydWU= wip: true pending: true ============================================================= Publishing verification ============================================================= Pacts for verification (1): --- url: http://localhost:9292/pacts/provider/MyProvider/consumer/MyConsumer/pact-version/00b1b6424125436c79369dddaf351313ba811aa8/metadata/d2lwPXRydWU= wip: true pending: true ============================================================= can-i-deploy MyProvider version 1 to prod: yes --- deployable: true reason: There are no missing dependencies success: 0 failed: 0 unknown: 0 ============================================================= can-i-deploy MyConsumer version 1 to prod: no --- deployable: reason: There is no verified pact between version 1 of MyConsumer and the latest version of MyProvider with tag prod (no such version exists) success: 0 failed: 0 unknown: 1 ============================================================= Deploying MyProvider version 1 to prod Creating tag 'prod' for MyProvider version 1 ============================================================= can-i-deploy MyConsumer version 1 to prod: yes --- deployable: true reason: All required verification results are published and successful success: 1 failed: 0 unknown: 0 ============================================================= Deploying MyConsumer version 1 to prod Creating tag 'prod' for MyConsumer version 1 =============================================================```

bethskurrie
2020-11-25 04:05
The tweak I did was to change the WIP pacts logic so that if there were no provider versions published, then all head pacts (the latest pact for each tag) are considered WIP.

bethskurrie
2020-11-25 04:05
This means that if you have WIP on, you always get a pact to verify (if one exists).

bethskurrie
2020-11-25 04:05
Can't do much on the broker side if no pacts exist at all.

bethskurrie
2020-11-25 05:14
Bother. It's not quite right. But it's slightly better.


bethskurrie
2020-11-25 05:15
Do what it says. You'll end up with an error "RuntimeError No pact found to verify at index 0" because there are no pacts to verify.

bethskurrie
2020-11-25 05:15
then kill those containers with `docker-compose -f docker-compose-issue-repro.yml up`

bethskurrie
2020-11-25 05:16
and change RACK_ENV=production to RACK_ENV=development and do it again.

bethskurrie
2020-11-25 05:16
This time, you'll get some pacts to verify the first time, but once it's verified successfully, that publishes a provider version, and that makes the pacts not be considered WIP again.


nerea.tamayo
2020-11-25 07:41
Oh, thanks a lot for the link!! @brendan.donegan I'm able to do the Post using curl from the terminal, but now I'm not able to traduce it in PactFlow. In Jnekins I have user/pasword but I generated a token for my user and it works from the terminal

brendan.donegan
2020-11-25 09:25
@nerea.tamayo if the curl command works, you can use the pact-broker create-webhook command and pass the same options as the cURL command to it

nerea.tamayo
2020-11-25 10:26
I did this i PactFlow

nerea.tamayo
2020-11-25 10:26
and I'm getting this error

nerea.tamayo
2020-11-25 10:26
[2020-11-25T10:21:02Z] DEBUG: Webhook context {"base_url":"https://XXXXX.pact.dius.com.au"} [2020-11-25T10:21:02Z] INFO: HTTP/1.1 POST https://jenkins.tools.XXXXX.com/instanceXX/job/XXXX/job/XXX/job/Pact_Glass_Capi/job/triggered_pact_verification/job/master/build [2020-11-25T10:21:02Z] INFO: accept: */* [2020-11-25T10:21:02Z] INFO: user-agent: Pact Broker v2.68.1 [2020-11-25T10:21:02Z] INFO: authorization: [REDACTED] [2020-11-25T10:21:02Z] INFO: host: http://jenkins.tools.XXXXX.com [2020-11-25T10:21:02Z] INFO: content-length: 0 [2020-11-25T10:21:02Z] INFO: content-type: application/x-www-form-urlencoded [2020-11-25T10:21:02Z] INFO: [2020-11-25T10:21:02Z] INFO: HTTP/1.0 302 Found [2020-11-25T10:21:02Z] INFO: server: BigIP [2020-11-25T10:21:02Z] INFO: content-length: 0 [2020-11-25T10:21:02Z] INFO: location: /my.policy [2020-11-25T10:21:02Z] INFO: set-cookie: LastMRH_Session=ceaec8cc;path=/;secure, MRHSession=Xxxxxxx;path=/;secure, MRHSHint=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/;secure [2020-11-25T10:21:02Z] INFO: connection: close [2020-11-25T10:21:02Z] INFO: [2020-11-25T10:21:02Z] INFO: Webhook execution failed

matt.fellows
2020-11-25 10:28
That looks like an auth proxy has intercepted and is redirecting to an auth challenge. Don't forget Pactflow is running in our cloud. Can you please check the curl works from outside of your network?

nerea.tamayo
2020-11-25 10:42
yes, you're right! from outside of my VPN it doesn`t work

brendan.donegan
2020-11-25 11:28
@nerea.tamayo we are in a similar situation, our Jenkins is inside the network firewall

brendan.donegan
2020-11-25 11:29
It?s an ongoing saga

brendan.donegan
2020-11-25 11:29
Hopefully your IT/Devops team is less bureaucratic than ours

nerea.tamayo
2020-11-25 11:32
hahaha, I think the bureaucratic is there.....

nerea.tamayo
2020-11-25 11:33
So, the solution is whitelisting the PactFlow IP into our Jenkins, right?

nerea.tamayo
2020-11-25 11:33
And after that....It Should work

brendan.donegan
2020-11-25 11:34
It all depends on your network setup. But you need to be able to issue the cURL command successfully while off the VPN

matt.fellows
2020-11-25 11:49
FYI - our public IP addresses can be found at https://pactflow.io/faq/#ip-address-whitelist

nerea.tamayo
2020-11-25 12:55
Thanks @matt.fellows!

scyr
2020-11-25 14:56
has joined #general

timotheus.ruprecht
2020-11-25 22:12
has joined #general

phil.endsley
2020-11-25 22:46
I didn't get time to look at this today, abd won't the rest of this week. Will try to make time early next week to look

bethskurrie
2020-11-25 22:46
np

tjones
2020-11-26 01:00
Friends, I was trialing some Pact swag, but because I am bad at using computers, I ordered an XL shirt instead of an XS. Would someone from the channel like it? I will post it anywhere in the world- the only cost will be that you must agree to tell other developers about how great Pact is when you wear it ;) MacBook power adaptor for scale (sorry I didn?t have a banana).

tjones
2020-11-26 01:02
Fit 61cm wide, 82cm tall

tjones
2020-11-26 01:02
If you?d like it, PM me your mailing address. First in best dressed (literally).

matt.fellows
2020-11-26 02:38
do you come with the shirt Tim?

matt.fellows
2020-11-26 02:38
that would help my decision making

tjones
2020-11-26 02:42
I don't, so you can safely ask for it

matt.fellows
2020-11-26 02:44
do you come with the car

tjones
2020-11-26 03:48
^ for anyone reading this without context, Matt and I know each other well. I also know that: 1) Matt already tells people how awesome Pact is, and 2) this shirt won't fit him either. So, Matt- I'm not sending it to you :stuck_out_tongue:

matt.fellows
2020-11-26 04:10
it?s damn shame, would have mad a nice rag

matt.fellows
2020-11-26 04:10
The blue looks quite nice actually

tjones
2020-11-26 04:19
I'm going to order again, but in my actual size. Want one?

tjones
2020-11-26 04:19
Also with a white logo

rarora
2020-11-26 04:46
Thank you for adding retry mechanism with gradle task canIDeploy. can anyone please share one example how values will be passed in case of gradle? I tried below and it seem to not care about retry. ```./gradlew canIDeploy -Ppacticipant=ProductService -PpacticipantVersion=-Ppact.provider.version -DretryCountWhileUnknown=12 -DretryWhileUnknownInterval=10 -PtoTag=develop --info```

wilkinsweiqiangliang
2020-11-26 06:53
#general Hey guys, does pactflow always trigger the `HEAD` commit? i follow the event template from docs, and find it sometime send `HEAD` commit, sometime send a different commit.

manali.mogre
2020-11-26 11:44
has joined #general

erik.terpstra
2020-11-26 12:08
has joined #general

kjayachandra2000
2020-11-26 20:40
has joined #general

sushil.kumar
2020-11-27 01:45
has joined #general

tjones
2020-11-27 02:56
I would try this question in #pactflow

zhujian
2020-11-27 07:54
has joined #general

h.octavian
2020-11-27 14:08
has joined #general

noel
2020-11-28 23:12
has joined #general

muraalee
2020-11-30 01:56
has joined #general

pooja.sharma
2020-11-30 08:52
has joined #general

mo
2020-11-30 09:24
has joined #general

aliaksandr.valadzko
2020-11-30 15:45
Hey guys I have a question regarding PACT _federation_ or something like this In our company we have huge amount of teams, which develop their own bunch of microservices. At this point we add PACT testing within our team's microservices. However we also want to provide to other teams (our consumers) ability to send PACT contracts to our broker. So my question is, how this situation should be handled - does every team should have its own PACT broker service, or there should be one _Godlike_ PACT broker service which should be shared across teams, or there is some mechanism to connect PACT broker services? Thanks!

aliaksandr.valadzko
2020-11-30 15:50
Sorry, looks like wrong place:slightly_smiling_face: Will move this question to other channel

2020-11-30 18:29
A new post has been created in *Feature Requests*

eric.jones
2020-11-30 20:53
Question, regarding access of test results from within a methods in a Pact Provider test using Pact-JVM: ```Is there any way to access test result status while running our Provider Tests? Is there any sort of construct available to access this information while a Provider test is running on Junit4? I know that there is mention of a PactVerificationContext; but it seems to be limited to Junit5. Looking for some guidance on how to move on this for JVM - is it possible with Junit4 and if not, does the PactVerificationContext have accessibility from within methods in the Provider tests, when using Junit5?```

phil.endsley
2020-11-30 21:14
FYI - There are language specific channels for questions specific to that language. #pact-jvm I don't know the answer. But I am curious what the use case is

david.greene
2020-11-30 21:47
has joined #general

bas
2020-12-01 09:00
has joined #general

ravi.mijar
2020-12-01 11:58
where can I order? :slightly_smiling_face:

wainstead
2020-12-01 14:57
has joined #general

jerobinson
2020-12-01 20:32
has joined #general

sumedhagamage
2020-12-02 03:33
has joined #general

antonello
2020-12-02 09:33
Do we have any resources on how to deal with feature flags and dark releases?

matt.fellows
2020-12-02 10:00
good question, I don?t think so

matt.fellows
2020-12-02 10:00
we should also get some published around pure trunk based dev (as in _no branches_)

antonello
2020-12-02 10:03
We have had some conversations this morning with one of our teams that - unsurprisingly - has experiencing issues and raised concerns.

fealaer
2020-12-02 11:40
has joined #general

antonello
2020-12-02 13:40
I?d love to hear thoughts and current solutions when it comes to managing feature flags

patrick.hendron
2020-12-02 14:44
has joined #general

michaelkochub
2020-12-02 15:43
Question about ensuring consumer contracts remain accurate: since the goal of a consumer contract test is to avoid testing business logic and remain a unit test that encodes the client's expectations for the provider, how do we ensure a consumer contract test doesn't drift? Basically, if someone changes the structure of an API request that the consumer makes to the provider, that developer won't immediately know that the contract test should be updated because the unit test itself still passes. Is there a good way to alert the developer by breaking the unit test somehow? This comes with the caveat that if you start adding more business logic testing into the unit test it becomes more of a functional test.

antonello
2020-12-02 15:49
As a general principle, you should https://docs.pact.io/consumer#ensure-all-calls-to-the-provider-go-through-classes-that-have-been-tested-with-pact. This means that you should write pact tests by exercising the very client classes that make the api requests.

antonello
2020-12-02 15:51
In strongly typed languages, this is a good enough guarantee that you cannot drift to the point that the contracts are inaccurate. What could happen is that you contract might end up using more than needed if you forget to, for example, remove unused fields.

antonello
2020-12-02 15:52
In languages that are not strongly typed, like Javascript, you might want to put other measures in place. See this https://docs.pact.io/consumer#ensure-the-models-you-use-in-other-tests-could-actually-be-created-from-the-responses-you-expect.

antonello
2020-12-02 15:55
@tjones touched on this in the Pact Community Event we held not so long ago. https://www.youtube.com/watch?v=wkld_wRsTDE

phil.endsley
2020-12-02 15:55
I was interpreting the question as how to not break existing pacts by altering the way a consumer makes api calls. ex: I have an existing contract that is verified, but I can change the consumer in a way that changes that contract. Everything on the consumer still passes. Is there a way to alert the developer that you're breaking the contract on the consumer Here's the way I think about it...Pact is _consumer_ driven, so the assumption is the consumer definition will be correct. Because of this, failing unit tests on the consumer side for "breaking a contract" wouldn't be great, because the consumer is one driving the api. You can prevent breaking changes by leveraging `can-i-deploy` as part of the merge checks for commits. If the consumer is deployable, the pact has been verified with the provider, and is safe to merge.

antonello
2020-12-02 15:56
Oh I see, @phil.endsley. I definitely got the wrong end of the stick. I scanned through the question rather than reading it properly.

antonello
2020-12-02 15:59
As I touched on in the talk linked above, where I work we take it even a step further and we execute the provider tests in every single pipeline. Something that you can do asynchronously with webhooks, but at the moment we prefer to do it synchronously.

michaelkochub
2020-12-02 16:53
Thank you for both of your inputs. That sounds like it might be worth clarifying the documentation that provides code samples to link back to what you initially sent me @antonello

michaelkochub
2020-12-02 16:54
For instance, the Groovy code sample for writing a consumer test https://docs.pact.io/implementation_guides/jvm/consumer/groovy#usage uses a basic RESTClient to make the calls, but really it would be better to exercise a client that the business application uses. In this case, then it would be best to add a caveat or a notice to indicate something like `"While this example instantiates a vanilla Groovy RESTClient to make an invocation, the recommended pattern is to test with the same client classes that the application uses"`

michaelkochub
2020-12-02 16:56
However, that's not entirely the case for all the examples. Over in the code sample for using JUnit to write a contract test https://docs.pact.io/implementation_guides/jvm/consumer/junit#usage you use a custom client https://github.com/pact-foundation/pact-jvm/blob/master/consumer/junit/src/test/java/au/com/dius/pact/consumer/junit/exampleclients/ConsumerClient.java

antonello
2020-12-02 17:36
It might be work creating a PR @michaelkochub :slightly_smiling_face:

lpratt
2020-12-02 18:19
has joined #general

tjones
2020-12-02 21:19
Oh! This is a great catch, @michaelkochub ! Yes, the intention is very much that the actual code that is called by the consumer is what is tested in consumer pact tests

tjones
2020-12-02 22:38
Where the contract is different if the feature flags are different?

tjones
2020-12-02 22:39
I haven't tried this, but could you build that in to pact tags?

antonello
2020-12-02 22:44
Well, there are (at least) 2 cases: 1. An existing interaction changes, for example a new field is required for a new feature. Consumer wants to add it test first, and they put the feature behind feature flag so that they can keep deploying to prod with the feature off. In a continuous deployment world you don?t want to wait for the provider to have implemented the API in order to deploy whatever is in trunk with the flag off.

antonello
2020-12-02 22:45
2. You need a brand new interaction, but this corresponds to a feature behind a flag that will be off until completed.

antonello
2020-12-02 22:46
There is also another interesting case, which is how to deal with feature flags that are enabled or disabled are runtime.

tjones
2020-12-02 22:51
yeah, I think there might be several different approaches depending on how the flags are used- but you're right that it's not obvious how to do it cleanly. With feature flags, I think there are usually some implicit assumptions, like "prod never turns this flag on"- and that's worth observing. The can-i-deploy question becomes something like "can I deploy X with prod, if prod has <these flags>"

tjones
2020-12-02 22:52
That's what made me think that tags might be the right approach, but I'm not certain.

tjones
2020-12-02 22:54
tags are for different cuts of pacticipants that might have different features - it feels like there would be a model where you have a tag that represents a specific feature flag set- and "prod" would be a layer of indirection to the current feature flags, maybe. But, if you've got feature flags in several pacticipants that might become complex quickly.

antonello
2020-12-02 22:55
One dirty trick that perhaps is not that dirty that some teams have started to use to address case 2 (well, also to get ahead or providers adding pact for existing features) is to publish some interactions in a different pact for a provider-temp.

tjones
2020-12-02 22:55
Right, you could view that as an alternative to tagging

tjones
2020-12-02 22:56
I kind of like the idea that you might have two interactions, and do it with provider states: "when the provider has NewFlag not set, I get this 404" "when the provider has NewFlag set, I get this 200"

antonello
2020-12-02 22:58
The problem is that once they end up into your trunk, they?ll both be published and at some point need to be verified or you won?t be able to release. Unless you suddenly have a way of tagging interactions.

tjones
2020-12-02 22:59
Yes (sorry phone rang before I could type up the next part) - then you could use tags to "toggle" the inclusion of the newflag part

matt.fellows
2020-12-03 00:18
FYI Beth has done a bit of thinking about this. It?s currently documented in the advanced workshop: https://docs.pactflow.io/docs/workshops/advanced

matt.fellows
2020-12-03 00:18
(search for ?toggles?)

abubics
2020-12-03 01:15
@antonello?s description is just like a chat we had in #pact-jvm yesterday :thinking_face: Feels like some concerns show up in patterns :party_parrot:

sandragnzalez
2020-12-03 11:04
has joined #general

kristian
2020-12-03 14:34
has joined #general

me1466
2020-12-03 23:42
has joined #general

stephane.meng
2020-12-04 07:23
Sorry if this question is a bit simple, what would be the PACT recommended workflow when both consumer and providers add incompatible changes with each other, e.g: Current production is consumer v1 and provider v1 consumer v2 publishes a new pact, and will become incompatible with provider v1 provider v2 makes the changes, but is incompatible with consumer v1 Both consumer v2 and provider v2 builds will not be green under pact framework from my understanding, is that correct ? In this case, what is the recommended way of deploying both v2s ?

matt.fellows
2020-12-04 07:30
usually you would use an "expand and contract" approach where you add the new fields/changes in addition first and then remove after the consumer(s) no longer needs them. A provider also had the right not to implement a change and give feedback for a bad suggestion (if it's indeed the case)

matt.fellows
2020-12-04 07:31
The scenario you're presenting essentially requires releasing both components at the same time, which is usually a bad idea and is sort of why Pact exists

stephane.meng
2020-12-04 07:37
Thanks for your response, makes sense !

mbieganski.infomatt
2020-12-04 09:55
Hi I have a question about WIP and pending pacts. Given I have below setup for provider ```@PactBroker( consumerVersionSelectors = { @VersionSelector(tag = "master"), @VersionSelector(tag = "dev") }, enablePendingPacts = "true", includeWipPactsSince = "2020-11-20", providerTags = "pact-update-test" )``` and there also feature branch for consumer called "new-feature". Do I understand correctly that provider will run tests against master,dev and new-feature but build will fail only if tests fail for consumerVersionSelectors branches?

mbieganski.infomatt
2020-12-04 10:46
Or still consumer and producer still have to create matching branches?

wenfeng.li
2020-12-04 11:42
has joined #general

phil.endsley
2020-12-04 13:54
Close. There's some subtleties that are easy to gloss over, but can have big impacts. With the above configuration, your provider will always run verification against the latest versions tagged with `master` and `dev`. When you enable pending pacts, that means if a pact is in the pending state, and fails verification, the build will not fail. A pact is pending if it has not been successfully verified by a provider tagged with `providerTags` ("pact-update-test" in your case). Once it has been verified successfully, it is no longer pending. This applies to all pacts that are verified, even if they are specified with version selectors. `includeWipPactsSince` will also pull in any pacts that are "WIP". A WIP pact is the latest pact for its tag that has not been successfully verified by the provider tagged with `providerTags`. The other caveat is that there must be an existing version of the provider tagged with `pact-update-test` to get WIP pacts. So, putting all this together with the following assumptions: ? You have a provider version tagged with `pact-update-test` published to pact broker ? The pact tagged with `new-feature` has not been successfully verified ? The pact tagged with `new-feature` was published after 11-20-2020 Your provider will run verifications against the latest versions of `master`, `dev`, and `new-feature`. If `new-feature` fails verification, the provider build will still pass. Note that it's possible for the latest version of `dev` to also be pending. This can happen if the consumer team accidentally merges a change to Pacts before verifying. In this case, it's possible for verification to fail, but the provider build still passes. This is why it's important to leverage `can-i-deploy` in your pipeline as well.

phil.endsley
2020-12-04 13:58
I think there was also a change recently to determine when a pact is no longer WIP, but I haven't had time to fully wrapped my head around it yet https://pact-foundation.slack.com/archives/C9VPNUJR2/p1606166532472100?thread_ts=1605857445.464000&cid=C9VPNUJR2

mbieganski.infomatt
2020-12-04 14:01
OK so maybe that's my problem right here > The other caveat is that there must be an existing version of the provider tagged with `pact-update-test` to get WIP pacts. I working on my branches so master branches are not yet updated with latest pact but have 2 feature branches 1 for consumer and provider with different names. So I thought that if I run provider locally it will test against master, dev and will pull latest from feature branches. If I understand correctly I have to merge everything to stable branches for it to actually work? I have can-i-deploy and webhooks setup and works really nice (some devs might disagree :smile: ) but having to set branches manually to match is little annoying :wink:

phil.endsley
2020-12-04 14:11
If you're doing feature development in consumer and provider branch at the same time, I would recommend finding a way to include the consumer tag as a version selector. The problem you may run into if you don't, is a successful verification will remove the pending status, so further commits on the provider won't run verification against that tag. We're in the same situation of manually adding branches. Our current workflow is to delete the version selector just prior to merging the provider. Agree it's annoying/tedious. We've brainstormed in this chat about it before, but haven't come up with other strategies. Using matching branch names is another popular solution, but my company's workflow doesn't allow that. I'm open to other ideas if you have any!

phil.endsley
2020-12-04 14:12
So WIP pacts will make it so once you merge the provider branch (without specifying the consumer tag), the wip settings will verify against your consumer branch, and allow you to merge the consumer branch in (Since it will be verified from the dev build)

mbieganski.infomatt
2020-12-04 14:37
I was under the impression while back when there were first rumors about WIP and pending that it will solve the need of creating matching branches. Currently we are adding provider tag as ```systemProperties.put("pactbroker.tags", "dev,master," + branchName);``` so if there is matching consumer branch it will be verified. Of course there separate provider jobs triggered by webhook to test verify contract by url. Reading the link you sent about removing WIP looks I should also add `PACT_BROKER_FEATURES=experimental_webhook_wip`

mbieganski.infomatt
2020-12-04 14:44
I can do something like ```systemProperties.put("pactbroker.consumerversionselectors.tags", "dev,master," + branchName");``` and it should work as previously but then I think I'm missing the point of using WIP or Pending

phil.endsley
2020-12-04 15:07
> I was under the impression while back when there were first rumors about WIP and pending that it will solve the need of creating matching branches. Same. I think I got it from the way it's worded in one of the workshops (https://docs.pactflow.io/docs/workshops/ci-cd/workshop/verifying-feature-pacts lists 3 ways for verifying feature branches), but this hasn't been my experience. What I've found is: Pending - Makes it so consumers can't break provider builds/deployments by merging "bad" contracts WIP - Makes the merging process easier for feature branches

phil.endsley
2020-12-04 15:07
RE: the workshop, it works fine if the provider is running the main branch. But not when you have feature branches for both

mbieganski.infomatt
2020-12-04 15:19
well from my experience with current setup the only way to "break" provider stable branch is to merge failed contract to master and create sort of deadlock but that involves ignoring/not checking broker before merging but yeah it can happen.. I hoped that with WIP and pending provider will always check all consumer latest branches fail tests if something is broken but fail build only when tests failed for stable branch and then we have can I deploy that would stop consumer if it wasn't previously verified by expected tag... From your experience the pactbroker.consumerversionselectors.tags should still contain the provider branch tag which should match consumer?

phil.endsley
2020-12-04 15:20
For provider branch feature development, yes

phil.endsley
2020-12-04 15:21
If you're using pending pacts, you shouldn't get into a bad state on the provider. Verification will fail if the consumer merges a failed contract, but the build should still pass, allowing the provider to continue deployments

mbieganski.infomatt
2020-12-04 15:25
broken dream

mbieganski.infomatt
2020-12-04 15:25
I hoped I will get rid of passing matching branches :stuck_out_tongue:

phil.endsley
2020-12-04 15:26
The only thing I've thought of is to support regex matching. Our branches include the ticket number, which will be unique per project, so we can't have exact matches. If regex matching was supported, we could format ours to match except ticket number and match that way

phil.endsley
2020-12-04 15:28
Still stuck with coordinating names, but it would make it so we don't have to add/remove a selector for every feature branch (For my specific workflow at least :slightly_smiling_face: ) https://pact.canny.io/feature-requests/p/allow-version-selectors-to-specify-tags-with-regex

mbieganski.infomatt
2020-12-04 15:30
maybe that's idea. but you can always have the branch to include both ticket number from provider and consumer.

phil.endsley
2020-12-04 15:33
That's a good idea! I think this is something that would work in theory, but not in practice (again, for my org). Too many non-technical people using the non-pact tools with integrations that would cause confusion

mbieganski.infomatt
2020-12-04 15:34
yeah that's always that small problem :wink: Thanks for help!

cdambo
2020-12-05 11:59
has joined #general

ranjanayush03
2020-12-08 03:40
Hi all we are facing an issue when trying to validate the last login date of the user onto the app , we need to validate only the format of the time and not the actual value and we tried doing that but facing issue like '''[{mismatch=Expected '2020-12-07T11:08:54.800+00:00' to match a timestamp of 'yyyy-MM-dd'T'HH:mm:ssXx': Unable to parse the date 2020-12-07T11:08:54.800+00:00, diff=}]. Can someone please help me with this.

bethskurrie
2020-12-08 03:40
@ranjanayush03 please ask in #pact-jvm

bethskurrie
2020-12-08 03:41
Assuming you're using jvm as the timestamp matchers are in jvm.

ranjanayush03
2020-12-08 03:41
Yeah we are using jvm I asked there but I didn't got any reply

gayatree.eee
2020-12-08 04:50
has joined #general

tjones
2020-12-08 06:34
I don't know much about the JVM pact implementation, but it looks like the timestamp there doesn't match the format that is listed

ranjanayush03
2020-12-08 14:56
Thank you Tim was able to parse it successfully

c.pavan1986
2020-12-09 04:18
has joined #general

william.pritchard
2020-12-09 15:28
has joined #general

parveshchaudhary111
2020-12-09 17:54
has joined #general

nouri.tawfik
2020-12-09 20:16
Hello, Does pact_broker have any endpoint to check online version? Something like http://pact-broker.comm/version? Thanks

phil.endsley
2020-12-09 20:18
Are you looking for an endpoint you can query from some process? If you go to the API browser, you can see the version in the response headers section. `x-pact-broker-version`

nouri.tawfik
2020-12-09 20:22
Thanks Phil, just need to know the installed version manually, so x-pact-broker-version it's OK for me.

eric.jones
2020-12-09 23:29
I want to be able to view and parse individual test method results for reporting purposes outside of pact.

w.sobasik
2020-12-10 10:39
has joined #general

thanuxxxx
2020-12-12 22:41
has joined #general

ian.hamilton
2020-12-13 06:53
has joined #general

colm.j.murphy91
2020-12-13 07:02
has joined #general

victoria.kruczek
2020-12-13 14:13
has joined #general

2020-12-14 05:09
A new post has been created in *Feature Requests*

wuddarwin
2020-12-14 05:23
has joined #general

connor.aird
2020-12-14 15:52
has joined #general

arman.najafian
2020-12-14 15:52
has joined #general

praveen.lakkaraju
2020-12-14 16:12
has joined #general

alejandro.germain
2020-12-14 16:26
has joined #general

wuddarwin
2020-12-14 18:08
Hi folks, Are there any docs or SOPs I can reference if I want to create a new language support for Pact? I'm aware there's a Rust implementation available so it would be great if there are some docs to explain how to interface with it.

matt.fellows
2020-12-14 23:19
Ah, you want to create an Elixir port right?

wuddarwin
2020-12-14 23:21
yeah, or help get the existing one to a more complete state https://github.com/elitau/pact_elixir unless you already have plans of doing so

matt.fellows
2020-12-14 23:22
Oh cool!

wuddarwin
2020-12-14 23:22
regardless, helping with the existing one or not, i'm having a hard time finding docs or SOPs for implementation so would be great to have someone to point me to the right direction

matt.fellows
2020-12-14 23:23
SOP = ?

matt.fellows
2020-12-14 23:23
Solution on a Page?

wuddarwin
2020-12-14 23:23
standard operating procedure

matt.fellows
2020-12-14 23:23
How familiar with Pact are you already?

wuddarwin
2020-12-14 23:24
somewhat, i've read through all the docs on your website and i know what contract testing is.

matt.fellows
2020-12-14 23:24
Have you ever written tests or anything in it?

matt.fellows
2020-12-14 23:25
I only ask because having some experience will make it much easier to build a nice API for your users

uglyog
2020-12-14 23:26
In some of the enterprise circles we been working in, Solution on a Page is abbreviated as SOAP :smile:

matt.fellows
2020-12-14 23:26
yes - I?m used to that. I thought it was perhaps a variation on the abbreviation

wuddarwin
2020-12-14 23:26
no, i haven't written any tests in the context of pact yet. i was going to write the provider tests for go but the consumer of that service is an elixir app so here we are

matt.fellows
2020-12-14 23:26
It makes sense to call it soap - the things are usually pretty slippery

uglyog
2020-12-14 23:27
The big downside of open source software, is that people do it in their spare time. Who wants to work on documentation in their spare time instead of a new fancy feature!

uglyog
2020-12-14 23:27
But we're here to answer any questions. The best thing is to pick a current implementation and use that as a reference.

wuddarwin
2020-12-14 23:28
understandable. how's the documentation on the rust implementation so far? if there's enough docs there, i can just built the docs and read it there. i took a peek but haven't seen much at the moment.

uglyog
2020-12-14 23:30
I haven't written much. The best thing there is to look at the Pact-JS V3 and Pact-C++ or Pact-Go to see how they are intergrated

uglyog
2020-12-14 23:31
Pact-JS one has a native Node module which use the Rust libraries. Pact-C++ and Pact-Go use the FFI bindings

matt.fellows
2020-12-14 23:32
I would go with the Pact C++ one because the go code is still a bit of a mess. At least, the consumer side is

matt.fellows
2020-12-14 23:32
C++ also follows the ?handle? API you created, whereas the go code was initially created pre that interface.

wuddarwin
2020-12-14 23:32
does ruby version also uses FFI? since Elixir syntax is actually somewhat close to ruby, it might be easier for reference. otherwise, i can definitely look at the ones in Go

matt.fellows
2020-12-14 23:32
It?s also in use by real customers

matt.fellows
2020-12-14 23:33
Ruby doesn?t use the Rust engine at all. It _is_ currently the engine used elsewhere by other langs, and we are actively moving to Rust where we can

wuddarwin
2020-12-14 23:33
i see. i'll take a look at the C++ one then

wuddarwin
2020-12-14 23:34
as for guidance, is it best to implement the v1 spec first before moving on to v2 and v3?

matt.fellows
2020-12-14 23:34
We can use the #pact-rust channel also

matt.fellows
2020-12-14 23:35
I would completely ignore the v1 spec, because it?s so old. I?d start with v2 compatibility because all other first class languages support at least v2

wuddarwin
2020-12-14 23:36
i see. thank you.

josh.ellinger
2020-12-15 01:22
has joined #general

nikitsenka
2020-12-15 09:35
has joined #general

hibahawes
2020-12-15 09:53
has joined #general

sarvar
2020-12-15 14:24
has joined #general

bheemreddy181
2020-12-15 21:10
But do you really care about all those 50 fields or you reading everything even if you don't really need them?

bheemreddy181
2020-12-15 21:29
do we have roles and permissions on the open-sourced version as well https://pactflow.io/blog/teams-roles-and-permissions/

bethskurrie
2020-12-15 21:29
No.

lewis.thorley
2020-12-15 23:18
So this is very PoC, but I am in the progress of creating a PACT consumer for Dart. Which I am hoping will be popular among flutter developers. It's pretty rough and ready but I have achieved my first goal of being able to have a server catch the interactions sent by the Dart http client. https://github.com/lemusthelroy/dart-pact-testing

marko.justinek
2020-12-15 23:24
Great work @lewis.thorley!!! We?ll have to open a #pact-dart channel now :tada:

matt.fellows
2020-12-16 01:15
You can see the key differences between Pactflow and OSS pact here: http://pactflow.io/features

suruchipatidar14
2020-12-16 05:35
has joined #general

smatheson
2020-12-16 06:33
has joined #general

olayemifolakemi
2020-12-16 15:23
has joined #general

ania.kovalchuk
2020-12-17 00:09
has joined #general

writetojoshma
2020-12-17 05:52
has joined #general

tjones
2020-12-17 06:48
This is awesome news! Taco for @lewis.thorley!

tjones
2020-12-17 07:17
Er, let's do that properly: :taco: for @lewis.thorley

elliottmurray
2020-12-17 09:09
:taco:

elliottmurray
2020-12-17 09:09
all round!

rejeesh.g
2020-12-17 11:07
has joined #general

lukas.kempec
2020-12-17 12:45
has joined #general

vikas543
2020-12-17 16:28
has joined #general

bpugh
2020-12-17 17:05
has joined #general

kflo
2020-12-19 03:10
just wanted to say i completed a proof of concept of the entire pact workflow with two of our microservices, including the necessary updates to our CI/CD pipelines, and it was overall pretty easy. really loving what this tool provides, i know a lot of hard work went into it so thanks everyone involved! looking forward to getting more involved in the project at some point

kflo
2020-12-19 03:10
at least for now i can be somewhat helpful in #pact-scala-itv :slightly_smiling_face:

jeff.burmood
2020-12-19 17:45
has joined #general

bheemreddy181
2020-12-19 18:58
It?s been a big challenge in general for me to get my principals agree on this approach - they always wanted to write a lot of unit tests and they feel contract tests are always extra effort , I requested for a demo from pact so that lot of their questions are answered. Few teams are really confident as they started writing contract tests - looking forward for 2021 I should on-board this on more teams.

bheemreddy181
2020-12-19 19:00
Few of them always argue that you should treat your services completely independent like how you use google / AWS services and treat internal services in the same way and we should never change any contract once a service is written - I disagree on that but it?s been really hard to convince all

kyle.florence
2020-12-19 19:21
has joined #general

ankurmalik22
2020-12-19 21:14
has joined #general

vsukumaran
2020-12-20 01:56
has joined #general

omer.morad
2020-12-20 08:10
has joined #general

ringo
2020-12-20 10:51
has joined #general

omer.moradd
2020-12-20 18:01
has joined #general

omer.moradd
2020-12-20 18:10
Hi all :) I am new to Pact.js and after some reading, I found it awesome! exactly the thing we were looking for in the company. We work with NestJS a lot, and I thought that creating an NPM Package that brings those two great technologies together will be nice I would love to hear what you guys think of it! NPM: https://www.npmjs.com/package/nestjs-pact Github: http://www.github.com/omermorad/nestjs-pact

abubics
2020-12-20 23:21
I can say, from experience, that a lot of people struggle to comprehend the value of (many kinds of) testing, and many only do it begrudgingly.

abubics
2020-12-20 23:24
And many times I've heard weird excuses for why they don't want to do contract testing, such as ? Both sides of the interface are our own people, so they can just talk to each other. ? We already have end-to-end tests. ? The responses are too big (so it's too hard). ? The responses are too small/simple (so it's unnecessary). and many more.

abubics
2020-12-20 23:24
I hope you can get some traction & understanding :pray:

abubics
2020-12-20 23:26
fwiw, I usually try to highlight the kinds of gaps that people have in their testing strategy, or speed & specificity improvements that could be gained . . . and don't focus on pact, just focus on confidence & consumer-provider drift

abubics
2020-12-20 23:26
(Pact isn't the only tool that can help, but it is many people's preference for its target niche)

2020-12-21 11:17
A new post has been created in *Feature Requests*

souravsen1
2020-12-21 11:28
has joined #general

bheemreddy181
2020-12-21 17:23
Thanks, Boris for sharing your inputs here. helps a lot

andoni.arroyo
2020-12-21 17:51
has joined #general

theovanessen
2020-12-22 10:47
has joined #general

stuart3166
2020-12-22 12:35
has joined #general

winfante
2020-12-22 22:51
has joined #general

bheemreddy181
2020-12-23 01:13
Need some feedback on how the development workflow should look like with new API's - I created a workflow ( flow chart ) as below

bheemreddy181
2020-12-23 02:33
@matt.fellows@matt.fellows@matt.fellows @bethskurrie@bethskurrie@bethskurrie @abubics any feedback will be really helpful

abubics
2020-12-23 03:22
We're all on holidays :) someone might reply if they're free, though

abubics
2020-12-23 03:23
Probably want to be careful how you tag people, too

bheemreddy181
2020-12-23 04:25
Sorry for the tag , happy holidays

lars.bonnes
2020-12-23 13:05
has joined #general

lewis.thorley
2020-12-23 15:08
I like that workflow

claudiond
2020-12-23 21:22
has joined #general

bheemreddy181
2020-12-24 17:33
Need inputs on one of the use case - we want verify the provider when there is a config change on the provider along with a code change ( config change can be done via UI ) where there is not code deployed/ merged any thoughts around this ?

antonello
2020-12-24 17:34
I don?t think I?d merge the consumer if the provider tests are not merged first.

brendan.donegan
2020-12-24 18:04
If it?s possible to make changes which can materially affect the behavior of your software without triggering appropriate tests, then there is a problem with your development workflow

bheemreddy181
2020-12-24 20:22
We are actually giving an ability for business teams to change config without a code change and the config lives in Aurora Postgres database and we provide API?s to modify these config - this is more like removing dependency with SE team and business handle these configs

bheemreddy181
2020-12-24 20:35
if you don?t merge , provider will not be able to look up your contracts as we tag contracts as master on merge

lewis.thorley
2020-12-24 20:47
I agree, I prefer to merge consumer first without provider implemented and this is the practice my company has followed. Particularly when you have separate teams doing FE and BE development.

antonello
2020-12-24 21:27
ultimately, it?s down to what works for you. my philosophy is that master should only point to pacts that are deployable.

matt.fellows
2020-12-25 10:54
What Anto said. Always up to you, but I'm of the "master should always be deployable" view

matt.fellows
2020-12-25 10:56
Merging to master something not deployable ultimately means either a) you have another branch where releases originate or b) you're trapped in an emergency because you have to double handle. I think it just kicks the can down the road.

matt.fellows
2020-12-25 10:57
Trunk based dev is different, especially if using feature toggles etc

matt.fellows
2020-12-25 10:58

eungjun.yi
2020-12-25 14:25
has joined #general

bheemreddy181
2020-12-26 22:24
Does any one use terraform approach for pact broker https://github.com/pactflow/terraform-provider-pact , if so can you help me understand how does this sit in your cicd pipeline

bheemreddy181
2020-12-27 05:45
I see that terraform approach helps us to maintain and add webhooks easily but is the idea to write terraform first and later do implementation on consumer and provider ?

ebanster
2020-12-27 13:18
has joined #general

matt.fellows
2020-12-27 21:01
So obviously the Pact Broker has APIs for almost everything

matt.fellows
2020-12-27 21:03
Terraform is just a Infra as Code version of that

matt.fellows
2020-12-27 21:04
it?s probably not going to be super helpful for the OSS version of Pact Broker, because the resources currently implemented are a Pact itself, and a webhook

matt.fellows
2020-12-27 21:04
Webhooks can drift, so Terraform is useful to correct that - but so is a `PUT` to the webhook endpoint

matt.fellows
2020-12-27 21:04
Over time we?ll expand the resources available of course

matt.fellows
2020-12-27 21:05
Terraform would usually be run as a separate pipeline to your main CI builds (i.e. separate from the actual Pacticipant repositories) and triggered when a new change is made, or somebody wants to bring everything back into centrally configured alignment

bheemreddy181
2020-12-28 00:26
Even with open source pact broker I feel the terraform is helpful it?s been hard for OSS version of pact broker to add webhooks , we have been adding them manually right now which adds a dependency with another who can only view or add or maintain secrets for a NH user for CI

abubics
2020-12-28 07:22
As far as diagrams go, I think it's easy enough to read :slightly_smiling_face: It's missing some consistency/symmetry with PRs and publishing to the broker (PR is only mentioned in the provider side, how/where does the consumer build publish to the broker?). I'd suggest either leaving the source-control details completely out, or making them completely explicit for everyone's sanity :innocent:

onur.baskirt
2020-12-28 10:48
has joined #general

massimo.daros
2020-12-29 13:18
has joined #general

chris.fullinwider
2020-12-29 18:15
has joined #general

piotr.soltysiak
2020-12-30 16:55
has joined #general

adrian.przybyla
2021-01-04 13:41
has joined #general

dcorrales
2021-01-04 22:06
has joined #general

jokubas.lekevicius
2021-01-04 22:10
has joined #general

adrian.przybyla
2021-01-05 09:40
Hey guys, do you have any gist/example/whatever with case where you testing mutation in graphql ? https://github.com/pact-foundation/pact-js/issues/565

tjones
2021-01-05 10:09
Hi Adrian, I'm afraid we don't, but it would be great to extend the graphql example to include one.

tjones
2021-01-05 10:11
(as you point out in the issue, it might require some code changes before we can support mutations. I'm not sure).

tjones
2021-01-05 10:16
I added some extra information on the issue.

adrian.przybyla
2021-01-05 10:55
@tjones thank for response i respond to you on GH

matt195
2021-01-05 16:35
has joined #general

rafael.manzoni
2021-01-05 17:56
has joined #general

thanuxxxx
2021-01-05 19:24
What are the differences between `providerStates` vs `providerState`

animesh2712
2021-01-05 19:29
has joined #general

phil.endsley
2021-01-05 19:57
I think this was just a change between Pact specs. v2 vs v3. One is an array (v3), and one is not (v2)

thanuxxxx
2021-01-05 20:11
:thumbsup:

info
2021-01-06 01:55
has joined #general

pascal.libenzi
2021-01-06 10:57
has joined #general

writetojoshma
2021-01-06 13:54
Error: Error while installing binary: Postinstalled Failed Unexpectedly: Error downloading binary from https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.88.3/pact-1.88.3-win32.ziphttps://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.88.3/pact-1.88.3-win32.zip: Error: Error while installing binary: Error: unable to get local issuer certificate

writetojoshma
2021-01-06 13:54
any help ?

animesh2712
2021-01-06 18:06
Hello All, Could someone help me with an example for sharing Pact file via GitHub URL?

2021-01-06 18:17
A new post has been created in *Feature Requests*

brett
2021-01-06 18:55
has joined #general

josh.rosenfeld
2021-01-06 19:39
has joined #general

matt.fellows
2021-01-06 20:57
Are you behind a network proxy?

matt.fellows
2021-01-06 20:57
Look at the issues in pact node for that

matt.fellows
2021-01-06 20:58
You'll need to set some node settings because network proxies man in the middle requests which confuse HTTPs chains

matt.fellows
2021-01-06 21:49
Why are you wanting to share it this way?

2021-01-07 04:37
A new post has been created in *Feature Requests*

writetojoshma
2021-01-07 06:06
Oh Okay

writetojoshma
2021-01-07 06:32
But this seems to be an intermittent issues

writetojoshma
2021-01-07 06:32
sometimes absolutely no problem installing

writetojoshma
2021-01-07 06:33
and some time it always throws postinstall error

writetojoshma
2021-01-07 06:33
how to resolve this

matt.fellows
2021-01-07 10:52
It sounds like an issue at your end.

matt.fellows
2021-01-07 10:53
Is this inside your company network? Try using a non corporate network and see if the issue persists

writetojoshma
2021-01-07 10:53
Okay Sure

matt.fellows
2021-01-07 10:54
If it does, its likely an issue with your laptop/workstation

matt.fellows
2021-01-07 10:54
Otherwise all of our users would be having the same issue

writetojoshma
2021-01-07 10:54
Error: Error while installing binary: Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND <company-name>http://proxy.com

writetojoshma
2021-01-07 10:54
this is the error

writetojoshma
2021-01-07 10:54
its a proxy issue

writetojoshma
2021-01-07 10:54
not all of us getting

writetojoshma
2021-01-07 10:54
so yes its a proxy issue

carlo
2021-01-07 13:24
has joined #general

denis.ducansel
2021-01-07 15:52
Hi, I'm facing a situation where I don't really know if I could reasonably use Pact, and if so, how. Context ? We have provider *P*, and consumer *C*. ? *P* exposes its services to consumers through a *P-api* library . ? *P-api* completely hides communication details (HTTP requests/responses, messaging payloads) to *P* consumers. ? *P*, *C*, and *P-api* are all developed "in-house" ? *P* could have other consumers than *C* Questions Should I use Pact:grin:? ? I'd like to say yes? It's worth knowing whether some version of *C* is compatible with some other version of *P*! ? For this to work, contracts should be published to Pact Broker by *C* How should I use Pact? ? *C* should theorically define and validate the contracts, but *C* does not know at all about communication details ? *P-api* does, but doesn't know about actual consumption of *P* by *C* (which endpoints get called, with which parameters, ?) ? I could imagine having *P-api* produce the contracts by some mean, but this would make overall process more cumbersome, no?   Do any of you know of some good recipe to apply here?   Thanks,     Denis

danny.porrello
2021-01-07 16:48
has joined #general

animesh2712
2021-01-07 17:01
@matt.fellows@matt.fellows@matt.fellows My team don?t want to build infrastructure to share file via pact broker, as no one wants to build and maintain the broker. They are trying to first find out can we use Github way

matt.fellows
2021-01-08 00:23
All of the tooling can communicate to a URL to fetch a pact file, so as long as the file is URL accessible it should be OK

matt.fellows
2021-01-08 00:23
Github will be tough, because it has specific authentication requirements that the system won?t have native support for. So you?ll probably need to build tools to download the pact file from Github first and point to a local file instead

matt.fellows
2021-01-08 00:24
You could also look at using http://pactflow.io whilst you evaluate it

matt.fellows
2021-01-08 00:24
quite honestly, the broker is the best path - you?ll miss out on a lot of key functionality of the approach without it

animesh2712
2021-01-08 03:04
Thank you Matt, for your suggestions! Let me do some POC on it.

dawood.abbas
2021-01-08 07:00
has joined #general

matt.fellows
2021-01-08 10:57
I think at least conceptually, many of the benefits of contract testing still apply to this. Practically things get a little more complicated. One option as you allude to, is that *P-api* could produce the contracts, publishing the version of the library itself. In this model, you would need to publish one version for every consumer of the library for the Pact Broker workflows to work. Then each *C* that uses *P-api* could use the _can-i-deploy_ check passing the version of the *P-api* that they use. Probably time I updated this with more approaches: https://pactflow.io/blog/should-i-write-contract-tests-for-client-sdks/

michaelkochub
2021-01-08 14:45
Question about provider versioning: is there a best practice for encoding information about the version of the provider app from the consumer contract unit test? Looking through the documentation for https://docs.pact.io/pact_broker/can_i_deploy/ I was really wondering where the information about the provider version comes from, since Pact is consumer-driven. I can think of a number of approaches: 1. In the consumer source code, copy-paste Pact tests into separate packages based on provider version, and then modify those tests as needed 2. In the consumer source code, have a single Pact test that has multiple test cases, each that passes the name the provider and its version to the `provider` setter method in the Pact DSL 3. Within a single test case, use the `fromProviderState` method to inject the version of the provider being tested

michaelkochub
2021-01-08 14:52
As a follow up question, where do the provider versions in the example version matrix in https://docs.pact.io/pact_broker/can_i_deploy/ come from?


tjones
2021-01-08 14:56
In general, it's good to version your software on a per commit basis for pact (and only publish pacts from CI).

phil.endsley
2021-01-08 14:57
> is there a best practice for encoding information about the version of the provider app from the consumer contract unit test? I think best practice is to not. The consumer shouldn't care about what version the provider is, only that the provider satisfies the contract defined by the consumer. Check out the summary. https://docs.pact.io/pact_broker/can_i_deploy/#summary If you use the `--to` argument, you only need the version of the application you're deploying (assuming you're tagging where you deploy to each time. That's what the call to `create-version-tag` is doing in the link)

tjones
2021-01-08 14:58
I've been planning to write a blog post on this topic - since it's nice to be able to reason about what's in a prerelease version. The script I personally use is here: https://gist.github.com/TimothyJones/edf3c5d0e0de582ec34a6daa734d7517

phil.endsley
2021-01-08 14:59
> where do the provider versions in the example version matrix ... come from Any time you publish a pact (from the consumer) or verification results (from the provider), you can provide a version

tjones
2021-01-08 14:59
Oh, yes! Good catch, Phil. In the consumer, you create a pact for a specific version of the consumer, but you only name the provider, you don't specify a version.

tjones
2021-01-08 15:00
Then, you can verify that pact against any version of the provider. Obviously, this might not pass for older versions of the provider.

phil.endsley
2021-01-08 15:05
> Obviously, this might not pass for older versions of the provider I might be starting on a tangent, but one of the points I find myself repeating frequently to new adopters in our organization is that it's not necessarily a bad thing if verifications fail. The point of the matrix is to identify which versions of two applications are compatible with each other. APIs will (probably) continue to evolve and change. The pact matrix is there to prevent breaking changes on deployment, not ensure backwards compatibility forever.

michaelkochub
2021-01-08 15:05
Thank you both for the quick responses. That makes sense, but what about the case where you need to update the Pact but you still want provider verification to succeed against an older version of the provider app because of a business req. Here's an example of what I mean, where the Provider has a capabilities framework that "tells" the Consumer what it can call: ```Assume P is the provider and C is the consumer Assume that C must be compatible with all versions of P and that C uses a capabilities framework to check if an endpoint is supported P 1.0 defines an endpoint /hello P 2.0 defines an endpoint /hello and an endpoint /goodbye P latest defines an endpoint /hello and an endpoint /goodbye the client in C latest looks like GET /hello if P.hasCapability(goodbye) GET /goodbye else use default value what happens is that the same contract is sent to 1.0, 2.0, and latest { GET /hello works GET /goodbye works } which breaks provider verification on P 1.0, even though the app itself works fine but really, in this case (I think) we wanted { P 1.0 GET /hello works P 2.0 GET /hello works GET /goodbye works P 3.0 GET /hello works GET /goodbye works }```

michaelkochub
2021-01-08 15:08
I could see that this resolves to the point made earlier: the consumer effectively "cares" about the provider version, and because of that fact, we're pushed closer to a Pact anti-pattern

phil.endsley
2021-01-08 15:11
My gut reaction is that this: ```if P.hasCapability(goodbye) GET /goodbye else use default value``` Would not be needed if you're using Pacts and can-i-deploy. You're essentially doing a version check from your consumer to make sure the endpoint exists. If using pacts and can-i-deploy, you're effectively guaranteeing that the endpoint will always be there for the consumer (Since the consumer would have a contract for /goodbye, and can-i-deploy would prevent you from deploying a version of P that does not have /goodbye).

tjones
2021-01-08 15:22
I think this is an interesting case. I'm on my way to bed here, but it's possible you could do something with provider states to give the verification you want.

tjones
2021-01-08 15:23
Unless you have some surprising architecture (like old versions of the provider deployed alongside new ones), it does sound like this is a different solution to the problem that Pact solves with can-i-deploy, though.

tjones
2021-01-08 15:28
You can also tag pacts in the broker, so you could maybe do something like have a tag for the different capability settings? That might get messy.

michaelkochub
2021-01-08 15:31
Agreed. It sounds like a capabilities framework doesn't jibe well with Pact concepts because it tries to _replace_ some of those concepts with its own definitions

michaelkochub
2021-01-08 15:32
In our use case though, it's as if our product versions are multiple products, all of which must be compatible with the current consumer

tjones
2021-01-08 15:34
You could potentially consider the different capabilties as different consumers.

michaelkochub
2021-01-08 15:39
I think we'd want to consider the different capabilities as different providers. It doesn't need to necessarily hardcoded to a specific provider version `P v1.0` or `P v2.0` but there would be some labelling that communicates a semantic difference: `P-onlyHello` and `P-laterOn`

tjones
2021-01-08 15:51
Yes, that?s probably better. At that point, the capability endpoint is a kind of service discovery, almost. This is an interesting case!

michaelkochub
2021-01-08 15:53
Yeah exactly, the capability endpoint is a barebones service discovery. In our architecture, it's best to think of multiple versions of the product as separate products in their own right, so using that as a mental model leads us back to the three (or possibly more) options laid out in the initial message.

michaelkochub
2021-01-08 15:54
For using provider states, were you thinking of a provider state callback, where you'd do something like `fromProviderState('version', 'v1.dummy')` and then assert different things based off that. But once you do that it's probably easier to split things off into separate test cases

victoria.kruczek
2021-01-10 14:47
hello, I have a question about provider object properties. Does `__running: false` stand for the fact, that the provider haven?t been properly setup? I can see this values after printing out the `provider` object: ``` Pact { opts: { xxx: xxx }, server: Server { _events: [Object: null prototype] { delete: [Function] }, _eventsCount: 1, _maxListeners: undefined, options: { xxx: 'xxx', }, ---> __running: false, __cliVerb: { xxx: 'xxx' }, __serviceCommand: 'xxx', __argMapping: { xxx: '--xxx', }, [Symbol(kCapture)]: false } }```

cksharma122
2021-01-10 17:19
has joined #general

matt.fellows
2021-01-10 23:30
Hi Victoria, is this question in relation to Pact JS? For future questions, please direct them to #pact-js

matt.fellows
2021-01-10 23:31
This looks like a dump of the consumer side Pact object

matt.fellows
2021-01-10 23:32
But yes, the `__running` property is there to detect when the Pact mock service is started. This can take a few seconds. If it?s not starting as expected, please enable debug logs and share the output along with the issues you?re experiencing

tjones
2021-01-11 02:21
Note that `provider.setup()` returns a promise that you will need to wait for before trying to use it.

caiquedpfc
2021-01-11 04:05
has joined #general

irldev
2021-01-11 18:23
Is there a pact binding for typescript? Or is pactjs the nearest option?

henrik.rudstrom
2021-01-11 18:30
has joined #general

matt.fellows
2021-01-11 23:02
Pact JS _is_ written in typescript, and exports TS bindings

matt.fellows
2021-01-11 23:03
is there something specific you need?

irldev
2021-01-12 07:59
Not really no. I'm about to start implementing it and our code is typescript and from a quick search I didn't see a typescript version available. I can see pactjs and various other flavours to let you write your consumer side and provider side pieces in those languages such as Java, C# etc but didn't see typescript.

matt.fellows
2021-01-12 09:44
Cool, pact JS should do the trick then

eric
2021-01-12 10:23
has joined #general

victoria.kruczek
2021-01-12 12:28
Ok, thank you for you insides :slightly_smiling_face:

henrik.rudstrom
2021-01-12 13:01
Im doing some research on adopting pact in our organization and i have a question regarding best practices: We have a config service that distributes config to almost all our apps, it is accessed via client libraries by 50-100 services. Im wondering what the best practice here is regarding consumer contracts. Likely it will be a massive job to write very similar consumer tests, is it possible/desirable to bake the consumer tests into the client library somehow

fnguyen
2021-01-13 00:39
has joined #general

matt.fellows
2021-01-13 01:55
I posted some thoughts to a similar question just the other day: https://pact-foundation.slack.com/archives/C5F4KFKR8/p1610034769384400

matt.fellows
2021-01-13 01:55
I?m keen on other perspectives of course

henrik.rudstrom
2021-01-13 12:53
So you suggest tagging the version of P-Api with the name of the consuming version (v1.2-<name-of-app>) and validating those in addition to the contract of C?

henrik.rudstrom
2021-01-13 12:57
im just speculating if it would be feasible to add some test-utility functions in P-api that can run as part of the test suite of C. in the most simple case a function takes a pact provider (initilized with the name of C) as argument and runs the whole suite of consumer tests for P-api.

henrik.rudstrom
2021-01-13 12:57
or a more granular approach along those lines?

pollet_22
2021-01-13 16:04
has joined #general

pollet_22
2021-01-13 16:12
Hello Every body , i am pollet a software testing engineer i am trying to implement contract testing in our company between BE and FE and between Apis also so i am in the phase of exploring pact and trying to do CDC between apis first

dshattuck
2021-01-13 20:49
has joined #general

thomas.rosati
2021-01-13 21:58
has joined #general

matt.fellows
2021-01-14 00:05
yep I think it?s doable

matt.fellows
2021-01-14 00:07
They key thing here is that we want to be able to ensure that each _version of_ *C* is able to publish a contract that expresses its needs of *P-api*

matt.fellows
2021-01-14 00:07
Doing that ensures all of the existing broker workflows/tools (e.g. can-i-deploy) will continue to operate

matt.fellows
2021-01-14 00:09
If it?s impossible to know which specific subset of functionality each *C* uses of *P-api* (because they are hidden behind the client lib), then the best you could probably do is just ensure Pact knows the versions of *C* that use the API in its entirety.

matt.fellows
2021-01-14 00:09
This is still useful, but less useful than knowing specifically which APIs and fields are actually in use

rahulsmalpani
2021-01-14 07:56
has joined #general

2021-01-14 07:57
A new post has been created in *Feature Requests*

sacha.camfferman768
2021-01-14 09:42
has joined #general

brandonbeard86
2021-01-14 22:10
has joined #general

geetishnayak
2021-01-15 01:02
has joined #general

stanleyawang
2021-01-15 06:26
hi all, does anybody get intermittent connection refused errors 'connect ECONNREFUSED 127.0.0.1:35183' while using node.js pact on docker?

matt.fellows
2021-01-15 06:28
Mind creating a thread in #pact-js with any logs to show?

stanleyawang
2021-01-15 06:30
ok sure

shettyg
2021-01-15 14:18
has joined #general

shettyg
2021-01-15 14:19
Hi All.I am facing an error while implementing pact provider using Junit

shettyg
2021-01-15 14:20
Receiver class http://au.com.dius.pact.provider.spring.junit5.MockMvcTestTarget does not define or inherit an implementation of the resolved method 'abstract java.util.Map executeInteraction(java.lang.Object, java.lang.Object)' of interface http://au.com.dius.pact.provider.junit5.TestTarget. java.lang.AbstractMethodError: Receiver class http://au.com.dius.pact.provider.spring.junit5.MockMvcTestTarget does not define or inherit an implementation of the resolved method 'abstract java.util.Map executeInteraction(java.lang.Object, java.lang.Object)' of interface http://au.com.dius.pact.provider.junit5.TestTarget.

shettyg
2021-01-15 14:20
Has anyone faced this error before

phil.endsley
2021-01-15 14:22
There's a channel for #pact-jvm specific help. Probably better to move the discussion there

shettyg
2021-01-15 14:22
Sure Thanks

michaelkochub
2021-01-15 14:46
Hello, is there a best practice for breaking up a massive consumer contract unit test? We'd like to do this because we have multiple team members working on adding more test cases and it's harder to parallelize if they're all touching the same file. It's also less maintainable. A few solutions to consider: 1. Split up the consumer unit test into multiple tests, and suffix the provider with the endpoint like `provider-hello_world` 2. Split up the consumer unit test into multiple tests, but stitch the resulting consumer contracts back into one big one before pushing to the broker

natarajang1
2021-01-15 15:29
has joined #general

matt.fellows
2021-01-15 22:50
Hi Michael, which language are you using?

matt.fellows
2021-01-15 22:51
(2) should be supported in most cases

matt.fellows
2021-01-15 22:52
Is it all the same code base though?

michel.neufeglise
2021-01-18 08:55
has joined #general

bart.boersma
2021-01-18 10:48
has joined #general

2021-01-18 14:44
A new post has been created in *Feature Requests*

michaelkochub
2021-01-18 16:06
We are using Java. It's all the same code base. Should that "stitching" behavior be on be default?

matt.fellows
2021-01-19 00:01
I've just asked in #pact-jvm, let's carry on this convo there

monica.wu
2021-01-19 06:25
has joined #general

makobernal
2021-01-19 08:23
has joined #general

jibrail.idris
2021-01-19 10:11
has joined #general

jmvb.registros
2021-01-19 11:01
has joined #general

irldev
2021-01-19 17:16
I was looking at http://pact.net and I'm not totally clear on what this does and what I need to set it to: pactVerifier .ProviderState($"{serviceUri}/provider-states") https://github.com/pact-foundation/pact-net

irldev
2021-01-19 17:16
What are "provider-states" and where are they set?

antonello
2021-01-19 17:59
This explains what provider states are https://docs.pact.io/getting_started/provider_states/

antonello
2021-01-19 17:59
They can be added to an interaction, so set in the consumer tests.

antonello
2021-01-19 18:00
The provider tests then can use these states to do any test data set up (mocks, in memory db, real db, etc.) that?s needed for the tests to pass.

irldev
2021-01-19 18:11
Is there an example of how these can be used in .net? I can see this in the sample but not sure what it's setting pactVerifier .ProviderState($"{serviceUri}/provider-states") https://github.com/pact-foundation/pact-net

matt.fellows
2021-01-19 19:32
Howtoexamples


matt.fellows
2021-01-19 19:32
There is a .NET example there

matt.fellows
2021-01-19 19:33
Also howtolearn has a .NET workshop that might help

2021-01-19 19:33
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

irldev
2021-01-19 19:57
Cheers, thanks

tpham
2021-01-19 22:36
has joined #general

2021-01-19 23:50
A post in *Feature Requests* has been marked as *closed*

vishal.grover
2021-01-20 03:12
has joined #general

priya.saraf
2021-01-20 08:43
has joined #general

fahad.aj.khan
2021-01-20 08:58
has joined #general

nicole.jaenchen
2021-01-20 09:38
has joined #general

vuttithatkrongyot
2021-01-20 11:03
Hi teams, can we add new contract to pact-stub-server without restart it? or even update the specific contract

vuttithatkrongyot
2021-01-20 11:11
my flow is I've contract as JSON file (wrote from scratch) -> I want to add this contract into stub-server without restarting the stub-server

dinakaran.ulaganathan
2021-01-20 13:59
has joined #general

ananda-kumar.irudhaya
2021-01-20 15:51
~hi, Any one have a latest example for pact setup in node..~

ananda-kumar.irudhaya
2021-01-20 16:08
found it

ptsiakos77
2021-01-20 21:55
has joined #general

2021-01-20 23:56
A new post has been created in *Feature Requests*

jibrail.idris
2021-01-21 01:08
Pact is the most frustrating framework that I have ever worked with.

uglyog
2021-01-21 01:11
Then don't use it if it is that bad. There are other ways to test your services, like end-to-end test suites and integration tests. But they tend to be even more frustrating to maintain.

jibrail.idris
2021-01-21 01:14
fascinating way to reply to feedback.

jibrail.idris
2021-01-21 01:16
i didnt say it is bad. It is just frustrating to use. Genuinely frustrating.

marko.justinek
2021-01-21 01:18
What in particular regarding using Pact is frustrating you, @jibrail.idris?

marko.justinek
2021-01-21 01:21
To @uglyog defence, just stating something is off with something without providing context or reason, doesn?t really help anyone. Similar to bug reports that look like ?There?s a bug. Thing doesn?t work. Please look into it.? :sweat_smile: ?Well, I looked into it. Works as designed.? :man-shrugging:

jibrail.idris
2021-01-21 01:22
@uglyog @matt.fellows Yes, apologies for that. I didn't elaborate on the context.

marko.justinek
2021-01-21 01:24
Pact is open source after all (well, most of it). So anyone is welcome to provide ideas and solutions for improvement.

jibrail.idris
2021-01-21 01:34
My working colleagues had great difficulty in setting up simple pact contracts and testing them in JUnit. When things don't work for example, the pact broker doesn't match up with a certain expected response, they are stuck on what to do next. So, what I usually do is step in deep into let's say TestTarget.kt with them and examine how pact plugin uses HttpClient to interact with broker and the actual endpoint to match up. It could be a header missing for example. The missing header example is a classic example. At the consumer side, the contracts are specified in a JSON file and the verified interactions may not work on the provider side. Reason being is that the provider's side spring boot endpoint comes with security such as JWT Token defined in header. All in all, I say kudos to the pact team for crafting an outstanding product. The experience to use it, however, is frustrating. I am not exactly sure what's the point of frustration. The docs are there. My colleagues can spend hours and days at time on figuring out something if we get stuck.

marko.justinek
2021-01-21 01:40
Fair enough. Generated values are always going to be tricky to validate especially if one tries to ?contract everything? in a request/response. Some general pointers on what to test, when and how are written throughout the Pact-land like you wrote.

tjones
2021-01-21 01:41
If you're experiencing this kind of frustration, then I would say that either the team is using it in a way that is causing more trouble than necessary, or we have improvements to make.

tjones
2021-01-21 01:42
If the team are using it in a way that is causing trouble, then probably we need to improve the documentation. Specific feedback on what problems you are experiencing is very helpful, and will lead to improvements.

matt.fellows
2021-01-21 01:42
I?m glad to see this conversation heading on track. We understand things can be frustrating, but also know that it?s an open source tool maintained by a community of dedicated people (often in their own spare time). Insults like this don?t help, and so you are likely to get blunt responses. Let?s keep it on track and within our https://docs.pact.io/contributing/code-of-conduct. Specifically, let?s focus on what can we do to improve.

tjones
2021-01-21 01:50
> When things don't work for example, the pact broker doesn't match up with a certain expected response, they are stuck on what to do next. Do you mean when the response from the provider doesn't match the expectation in the contract? This should be explained in error messages or logs from the verifier. If you're needing to read the pact source to find out what went wrong, I'm curious to know more about how you're using it.

matt.fellows
2021-01-21 01:51
I recall when first using the JUnit provider I didn?t realise I had to look at the test report to see the errors. Once I discovered that, I found it much simpler

tjones
2021-01-21 01:54
> Reason being is that the provider's side spring boot endpoint comes with security such as JWT Token defined in header. There are several approaches that make verification with a security token quite straightforward. There may be springboot examples in the JVM docs, I'm not sure.


jibrail.idris
2021-01-21 01:58
@tjones > Do you mean when the response from the provider doesn't match the expectation in the contract? This should be explained in error messages or logs from the verifier. If you're needing to read the pact source to find out what went wrong, I'm curious to know more about how you're using it. Yes. Let's use this article as an example. https://www.baeldung.com/pact-junit-consumer-driven-contracts In this example, the contract is crafted using the builder. Contract is published and verified. The verification is done simply using `PactProviderRuleMk2` . However, testing the same endpoint at the provider returns mismatch error. For example, a 403 error because JWT could be missing when Pact provider plugin invokes the actual Spring boot endpoint, which comes with the security part as well. I am currently exploring MockMvcTarget and hopefully that makes things simple and doesn't break potential security modules put in place. The console screen spits out the difference and on a cursory glance it is easy to spot the difference. Understanding the difference is another issue. To add from the example above, the engineer working on the consumer part, writing the contract above can publish the to the broker. The engineer working on the provider side verifies the contract and it fails. The consumer engineer said that the contract is fine and tests pass. The provider engineer shows the failed state test. From here, we realise that the pact contract requires the Authorization header with Bearer value to be hardcoded, which flags out security issue with the team because tokens can't be hardcoded.

mhdtouban
2021-01-21 01:58
has joined #general

marko.justinek
2021-01-21 02:11
yeah, you don?t want hardcoded tokens (or secrets of any sorts). Your consumer devs should use matchers instead. Or value generators which some Pact frameworks provide. Is the TL;DR response to the above. But I?m sure someone else will elaborate much better :thumbsup: (I?m counting on it :sweat_smile: )

jibrail.idris
2021-01-21 02:14
Which now then brings to the next question, how do we craft custom headers at the Provider side so that we can include Authorization and other headers, which apparently Pact does not support. https://stackoverflow.com/questions/42765222/how-combine-a-targetrequestfilter-with-runwithparameterized-class

jibrail.idris
2021-01-21 02:15
@marko.justinek Thanks, i will explore matchers.

abubics
2021-01-21 02:21
I'd probably also use the Pact https://docs.pact.io/consumer & https://docs.pact.io/implementation_guides/workshops/ to learn, rather than a more narrowly-targeted tutorial (such as that Baeldung example; I love Baeldung, but they don't always give a full picture).

bheemreddy181
2021-01-21 02:43
@matt.fellows Quick Question : How do we get provider merged first , as provider is always looking for `master` pacts , we don't fail if there are no pact present for provider both on pull request and master ? - then as if we have provider on master now just get the consumer pr triggered again ?

veeraprathap.n
2021-01-21 04:10
has joined #general

tjones
2021-01-21 04:32
Yep. Pact is not a substitute for communication between teams. If there's no communication about the authorisation, then verification would fail. As an aside, my personal preferred auth approach is to have a Provider State like `VALID_TOKEN is a valid auth token`, then mock out the auth provider to turn `VALID_TOKEN` into some mock data. I like it because it is simple, but of course it means you're not properly testing your authorisation. If you want something more principled, you can use an approach like the one documented here: https://docs.pact.io/implementation_guides/jvm/provider/maven#modifying-the-requests-before-they-are-sent

tjones
2021-01-21 04:42
Unless I'm misunderstanding what you're asking I think the answers you are looking for are in the official Pact documentation and examples. If you find areas where we're lacking documentation or features, please feel free to open an issue against the relevant project. If something is unclear, asking here is a good way to get a fast response - and it's good to know where our documentation can be improved. Of course, the very best way to help us improve is to contribute PRs that fix up documentation/otherwise improve the tool. Almost all of Pact has been written in people's spare time, by developers like you and me (although I appreciate that not everyone has the time). I'm not sure how Baeldung works, but I think your observation that the article you linked doesn't handle authorisation would make the seeds for an excellent follow up post explaining how to do it.

tsiakos
2021-01-21 09:24
has joined #general

denitsa.kulezich
2021-01-21 10:13
Hi all, I would like some help with a problem we are currently facing with Pact. We are trying to fit it in a federated api architecture. We implemented several pacts between our federated api (which acts as a consumer) and the source web services on one side and between federated api consumers and the api (which acts as a provider in this case). But we currently face some problems: 1. First is that the federated api is transforming the data from the source web services but doesn?t care about the data, they only care if the schema of the source web services remains the same. 2. Second is that the federated api consumers pact  fails now and then because the source web services deletes their databases. The federated api doesn?t have a db so the consumers can?t rely on the provider states. What we did to avoid these fails is to remove any data from the pact that may change leaving the pact with the bare minimum information. But this means that we can?t actually benefit from the  contract tests

denitsa.kulezich
2021-01-21 10:13
Do you have a case like that? What would be your approach?

tjones
2021-01-21 10:14
Usually you would mock the downstream services during provider verification

tjones
2021-01-21 10:15
(it is usually much easier to do this in code just before the boundary, rather than with actual mock services)

denitsa.kulezich
2021-01-21 10:15
Thanks for the advice, Tim :slightly_smiling_face:

tjones
2021-01-21 10:15
The boundary that you would mock would be the same as the boundary for the code under test in the consumer tests for your federated service

tjones
2021-01-21 10:17
Provider states are the consumers way of saying "I expect this state", but it doesn't care how it is set up- so it doesn't need to be a database. Usually I find it easiest to stub the DB connector layer completely, something like: ```when Db.listSomething is called, then return SomePredeterminedList```

tjones
2021-01-21 10:19
Another approach that people sometimes use is to treat your "provider" as both the federated API and its downstream services. Using pact to drive an integration test, essentially. This feels less clean and easy to reason about to me, but I know that some people have had success with it.

tjones
2021-01-21 10:21
Depending on which pact framework you are using for the verification of the provider, we might have examples of the first approach.

denitsa.kulezich
2021-01-21 10:24
I definitely agree that mocking downstream service is the cleaner way of dealing with our case. I wouldn?t like to create a dependency with the other service when with pact we are actually decoupling them.

denitsa.kulezich
2021-01-21 10:25
As for the framework we are using, it?s pact-js

tjones
2021-01-21 10:36
Ah, perfect. This example has the kind of in-memory mock I am talking about, although because it isn't a real provider, it doesn't actually have the database that it would be mocking https://github.com/pact-foundation/pact-js/blob/master/examples/e2e/test/provider.spec.js Might be useful for some inspiration

tjones
2021-01-21 10:37
https://github.com/pact-foundation/pact-js/blob/master/examples/e2e/repository.js Basically, you just want to mock the layer where you would give business operations to the downstream service

tjones
2021-01-21 10:38
rather than putting a mock that responds to network requests or SQL queries or whatever.

tjones
2021-01-21 10:38
Let us know if you have any further challenges!

denitsa.kulezich
2021-01-21 11:00
thanks a lot Tim, for the help!

tjones
2021-01-21 11:06
No problem

oleg
2021-01-21 13:05
has joined #general

psychopomp3x
2021-01-21 14:37
My team is having a debate about how to interpret the guidance in https://docs.pact.io/5-minute-getting-started-guide/#scope-of-a-consumer-pact-test Some folks are reading it as "only put pact tests on the service api code for calls to services that our dev team don't own", and others are reading it as "pact tests all the service responses. The `collaborator` is just an abstraction in the client code to call service apis". Can somebody more seasoned weigh in? We have an enterprise app with like 40ish microservices if that helps set the scope.

kflo
2021-01-21 16:58
IMO it means ?you should have pact tests for all client requests to services that your company maintains? (e.g. not third party services outside of your control, because you can?t dictate those contracts). so, whenever you have a service which talks to another service that you maintain over HTTP, you should have a pact test in the consuming service for it (and then verification tests in the providing service)

matt.fellows
2021-01-21 21:39
Test all the things for services your org owns or can have verified. In the case for APIs where they won't/can't verify (such as a third party) you could still get some value from the pacts (e.g. they are useful feature specs) but you won't get the full benefit obviously

wesleythomaswilliams
2021-01-21 22:20
:point_up::point_up:and don't forget messaging tests too if you're using Kafka etc. My company has a lot of small teams, some working on a several microservices, some working on one. Our team started by implementing pact between all the microservices we've built, we're now at the point where we're looking to get other teams to do the same and then to have pact tests across the boundaries between our teams.

kflo
2021-01-21 22:21
yes, i am about to figure out how to set up the pact flow for messages (kafka) using scala

kflo
2021-01-21 22:22
:upside_down_face:

2021-01-21 23:36
A new post has been created in *Feature Requests*

tjones
2021-01-22 00:42
I think the dotted line in that diagram is supposed to represent the boundary of your consumer code. So, "external service" would include services owned by the same team.

tjones
2021-01-22 00:42
(I'm not certain that's what it's meant to mean, but that's how I would interpret it)

matt.fellows
2021-01-22 00:53
That?s what I meant it to mean!

matt.fellows
2021-01-22 00:53
How?s the terminology in that diagram - I?ve had mixed feedback. I have thoughts, but if there is more popular language I?d rather update it

matt.fellows
2021-01-22 01:24
@lakitna just released another (awesome) blog post on contract testing: https://lakitna.medium.com/contract-based-testing-5-the-best-approach-e7890c30065 :taco:

bheemreddy181
2021-01-22 01:28
So for everyone on this thread - the reason led me to the above approach was ruby implementation doesn?t allow you run verifications with no pact present - which is a possibility on golang implementation


bheemreddy181
2021-01-22 01:30
i will see if i can send out a feature PR implemented myself

matt.fellows
2021-01-22 01:35
> @matt.fellows Quick Question : How do we get provider merged first , as provider is always looking for `master` pacts , we don?t fail if there  are no pact present for provider both on pull request and master  ? - then as if we have provider on master now just get the consumer pr triggered again ? (edited) Sorry, I didn?t see this yesterday - lots happening

matt.fellows
2021-01-22 01:37
I just found the thread from yesterday it seems you had with Beth. Makes sense

matt.fellows
2021-01-22 01:40
some options in the meantime are to: a) disable pacts for the provider side until there are pacts b) wrap the process with a check to the broker first - basically fetching latest pacts for that provider e.g. `curl <host>/pacts/provider/<ProviderService>/latest/<prod>` and skipping if it comes back with no pacts

tjones
2021-01-22 02:45
I think different frameworks and communities have different languages so there's not really one best or most popular language. Maybe the example could be more concrete? Or less specific about the other code blocks?

tjones
2021-01-22 02:47
For instance, I would say that the coverage of Pact might be better drawn over the interfaces block - which would include both consumers and providers. But that doesn't help if you think about your code as "controllers" -> "services" -> "collaborators"

matt.fellows
2021-01-22 02:57
I?d like to change the examples (again)

matt.fellows
2021-01-22 02:57
The REPL thing sucks, but I don?t have a better browser runnable solution at the moment

matt.fellows
2021-01-22 02:57
I like this, but you can?t embed without paying (and it?s like, not cheap): https://katacoda.com/pact/scenarios/pactflow-getting-started-js

bheemreddy181
2021-01-22 03:43
`disable pacts for the provider side until there are pacts` - i can explore this one for now , lets see how it goes

thomas.powell
2021-01-22 10:18
has joined #general

thomas.powell
2021-01-22 11:48
Hi everyone. We don?t currently use PACT in our org but I?m trying to assess if this would be the right fit for my use case. My team is working on a provider service similar to that shown in the attached diagram labelled ?My Provider Service?. Consumers of our service interact with our translation service only. This API does not hold state as such but does implement request validation of various business rules. The ?Data Warehouse API? contains state. This API is populated through the ingestion of large data files which take ~minutes to ingest. We already have in place a set of e2e tests for our service which populate the Data Warehouse API with a set of canned data. So my questions are these? Is PACT a good fit for this scenario? When working with provider states which of the following scenarios is recommended and why? -        mock out the Data Warehouse API. -        pass information to our Consumers of the canned data used in e2e tests, then run provider tests against a pre-populated system. All the services shown are internal to our organisation and we have relatively good comms channels between teams. Thanks for any help Tom

jibrail.idris
2021-01-22 11:49
@tjones Thank you for the link! That's very helpful! I am wondering if it is possible to create a custom HTTPClient via code and have it injected into the service provider? Let's say in @BeforeAll

stefan.selent
2021-01-23 01:54
has joined #general

jokubas.lekevicius
2021-01-24 21:21
Hi Thomas, I see a place for pact, to test the interactions between your microservices DataWarehouse-TranslationAPI, and between your consumers and the TranslationAPI. And the fact that you have good communication between teams is a nice addition to all this! Regarding the provider states, I'm searching an answer to this question, but to my understanding, you should use mock responses. (if you do this, AND write contracts between your own microservices, you should be set AFAIK) I'm new with PACT so it'd be interesting to hear more opinions

jokubas.lekevicius
2021-01-24 22:27
Hello, I'm writing with a philosophical question to which I can't find a concrete answer in any of the docs or presentations. Tl;dr how much should I couple with the producers data in my contracts. Long version: We've been implementing CBT in our team and it just so happened that we had 3 microservices, 2 consumers, 1 producer. So we separated our work, one writes for consumer A, the second for consumer B. We chipped the contracts away, a few days pass, we submit our PRs and start to celebrate. Until we noticed that we took two different routes on writing the contracts. One developer took a very abstract route for the contract. Some stringType goes in the parameter, some stringType goes in this request field, in this request field we have an Enum, so let's generate a Regex for that. The same for responses, all the fields have very loose constraints, only the type matters in most cases. Add only loose assertions on the consumer side, to see if all the response fields are not null, meaning that our contract represents what our response data types expect. The second developer took a more strict route. Open up the producer application, fire it up with its test database, open you swagger endpoint, see what request payloads return what responses, and write the contracts according to these datapoints, strict on every field. Also do your assertions strictly on the responses, validate every field mapping. These two approaches bring their own pros and cons. The first one is very relaxed, the consumer does not care about the producers test database, only that all the response fields are filled. The consumer doesn't care if the correct request field got mapped to the correct response fields (in a SAVE operation, for example). The second is very good at catching mapping errors, also it helped to catch a certain string generation change (we had an additional question rise from this: imagine you generate an address field from given data, if the format of the string field changes, should the contract break?). The cons are apparent too. We're never sure if our mapping is 100% sure in the first approach. On the second approach, we're really coupled to the producers test data. If something changes in the test db, all contracts should be changed. We're now trying to solve which approach is better, and if chosen, what can be used from the dropped one. I read the docs regarding Postel's Law (here https://docs.pact.io/getting_started/matching) but I can't fully wrap my head around this. For example, if I use Postel's Law and use strict matching on a Save action payload, should I also be strict on the same fields in the response, or should I be loose? Should I be strict on request params in GET?

bethskurrie
2021-01-24 22:34
Good questions @jokubas.lekevicius

bethskurrie
2021-01-24 22:34
Have you read this page? https://docs.pact.io/consumer

jokubas.lekevicius
2021-01-24 22:35
I'm sure I have but I'll look over it Monday morning, I might've missed something crucial :smile: Thanks

bethskurrie
2021-01-24 22:35
I recommend being strict on the consumer side, and as loose as possible (but no looser on the provider side).

bethskurrie
2021-01-24 22:36
On the consumer side, the same person is responsible for the test and the actual requests. You want to make sure your code is sending out exactly what you think it is.

bethskurrie
2021-01-24 22:36
On the provider side, it's best to be as loose as possible - but be strict about things that might cause issues if they changed.

bethskurrie
2021-01-24 22:38
The key to ask on the provider expectations side is "if I made this looser/tighter what bugs would I miss/prevent?"

bethskurrie
2021-01-24 22:39
I would say, both approaches are required, and it's situational as to whether you need to go strict or loose.

bethskurrie
2021-01-24 22:40
That one about the address thing - it seems that if you didn't test with real data, you would miss bugs if the format changed. So it seems a good thing to be strict on.

jokubas.lekevicius
2021-01-24 22:40
Thanks @bethskurrie didn't expect such a swift answer

bethskurrie
2021-01-24 22:41
I just started work and was going through Slack, so it was good timing.

bethskurrie
2021-01-24 22:41
> If something changes in the test db, all contracts should be changed.

bethskurrie
2021-01-24 22:41
That's a situation you want to avoid ^^.

bethskurrie
2021-01-24 22:42
We want changes to cause proportional affects as much as possible. Small change to db -> small change to tests.

bethskurrie
2021-01-24 22:43
So that string generation one - sounds like that field needed someone to think and say "if something about this changes, it would break X, so let's be strict on this one" - but it doesn't mean every field in the response needs strict matching.

bethskurrie
2021-01-24 22:43
Do the strict/loose consideration field by field.

bethskurrie
2021-01-24 23:02
I've taken some of our discussion and put it into that page. Thanks for giving me the impetus to do that!

bethskurrie
2021-01-24 23:05
@lakitna loved your post! https://lakitna.medium.com/contract-based-testing-5-the-best-approach-e7890c30065 An excellent discussion of the trade-offs of various approaches. I am ALL ABOUT highlighting trade-offs rather than saying "this thing is objectively good/bad".

abubics
2021-01-25 00:11
Another little addition to this is: pact isn't trying to replace all your unit tests. For example, if the generated string is an identifier used in a lot of places, maybe the format should be opaque, but it always needs to be valid. Rather than checking the format validity in every interaction, unit tests might cover it better.

bethskurrie
2021-01-25 00:12
On the consumer side? Yes, agreed.

abubics
2021-01-25 00:14
Yarr, there's a lot of maybe (variant of "it depends" :P) . . . working out the best place to do things is one of my more fundamental struggles in computer science :sweat_smile:

bethskurrie
2021-01-25 00:14
And it's something that's so hard to write definitive rules about!

paulo
2021-01-25 11:37
has joined #general

kmckeever
2021-01-25 14:38
has joined #general

robert.land
2021-01-25 19:25
has joined #general

aparnachaudhari
2021-01-25 21:34
has joined #general

gwhill7
2021-01-25 23:23
has joined #general

bheemreddy181
2021-01-26 00:41
Can some one help me understand how the pactflow Hosted Stubs work ?

bheemreddy181
2021-01-26 00:42
more interested on this

tjones
2021-01-26 04:45
You might get a better response in #pactflow , but you may have to wait until tomorrow- it?s a public holiday in Australia today

tjones
2021-01-26 04:46
(I don?t know the answer to your question, sorry)

matt.fellows
2021-01-26 06:03
Hey Bheem, have you read https://pactflow.io/blog/hosted-stubs/?


matt.fellows
2021-01-26 06:04
One thing to note is that you still need to auth as per any Pactflow API

bibinc99
2021-01-26 14:37
has joined #general

luisc.barretog
2021-01-27 00:42
has joined #general

matt.fellows
2021-01-27 00:47
Hi Thomas, sorry for the delay (long weekend here in Australia, where a bunch of the maintainers live)

matt.fellows
2021-01-27 00:47
Jokubas is basically on point

matt.fellows
2021-01-27 00:47
Great question!

matt.fellows
2021-01-27 00:49
There is no absolutely correct answer here. If the canned data and e2e tests are easy to setup and maintain (for this specific scenario) then you could go that route. But generally this is not the case, so the simpler path is to mock out the backend to enable really fast verification in your Translation API. Of course, you would then need a contract (or to use the e2e tests) between your Translation API (now the consumer) and the Data Warehouse API (the provider).

rarora
2021-01-27 07:42
Hi team, i want my provider to only verify "production" tagged contracts of consumer when provider test are run. when provider test are run through webhook, I want provider to verify tests of branch that trigerred it. is there any way to do this conditionally?

matt.fellows
2021-01-27 10:20
Of course. What language are you using? Can you please ask in the language specific channel and tag me?

laxmi.somni508
2021-01-27 10:27
has joined #general

laxmi.somni508
2021-01-27 11:44
Hi Pact Team, Thanks for letting me join. We're in process of embracing PACT in our organisation. Could you please advise how could we get a virtual Brown-bag session by Pact contributor ? As mentioned on the http://pact.io/faq/ webpage. Kindly advise. Thanks

laxmi.somni508
2021-01-27 11:46
Technology stack: *BE* - Scala, Python-Django & few other technologies *FE*- iOS (Swift & XCTest), Android (mixture of Kotlin & Java)


laxmi.somni508
2021-01-27 11:46
great thanks a lot

ryanding16
2021-01-27 20:25
has joined #general

ryanding16
2021-01-27 21:10
We have a situation where one field of a response body could be either one of two values. Let's say they are 'A' or 'B'. So we'd like to use the or matcher. The following is the DSL on the consumer side:

bethskurrie
2021-01-27 21:11
Might be best to ask in the language specific channel @ryanding16

bethskurrie
2021-01-27 21:11
Or is it a general pact theory question?

ryanding16
2021-01-27 21:11
```testkey or('A', equalTo('A'), equalTo('B'))```

ryanding16
2021-01-27 21:13
This generates the following in the contract json file

bethskurrie
2021-01-27 21:13
Can you keep this all in one thread please?

ryanding16
2021-01-27 21:13
``` "matchers": [ { "match": "equality" }, { "match": "equality" } ], "combine": "OR"```

ryanding16
2021-01-27 21:14
Sorry, using this for the first time. Let me try to put everything in one thread. DSL on the consumer side: ```testkey or('AB', equaltTo('A'), equalTo('B'))``` Generated contract json: ``` "matchers": [ { "match": "equality" }, { "match": "equality" } ], "combine": "OR"``` The match does not have any value: "A" or "B" But the following DSL using includeStr ```testkey or('AB', includesStr('A'), includesStr('B'))``` Generates the following contract: ``` "matchers": [ { "match": "include", "value": "A" }, { "match": "include", "value": "B" } ], "combine": "OR"``` Notice the value "A" and "B" for includeStr Could someone help me understand why the values for equalTo are missing in the generated contract?

bethskurrie
2021-01-27 21:44
@ryanding16 the way to put something in a thread is to hover over your first message and then click on the little "talking bubble". It will open up a new section on the side. It's good to do that because it reduces the noise in the thread for all the subscribers.

bethskurrie
2021-01-27 21:45
Ok, I'm replying over here @ryanding16

ryanding16
2021-01-27 21:46
Thanks

bethskurrie
2021-01-27 21:46
There are 10+ pact languages, and they all have different support for the pact specification, so it's best to ask in the channel for your language. General is for "general pact theory stuff" that's applicable to everyone.

bethskurrie
2021-01-27 21:46
Did you get a welcome message with some pointers about the channels?

bethskurrie
2021-01-27 21:47
In answer to your question, which language and version are you using?

ryanding16
2021-01-27 21:47
Should I post this to the pact-jvm channel? We use pact-jvm.

bethskurrie
2021-01-27 21:47
Is that go?

ryanding16
2021-01-27 21:48
We use v3 pact-jvm.

bethskurrie
2021-01-27 21:48
ok, yes, ask in the pact-jvm channel.

ryanding16
2021-01-27 21:48
OK, I'll post there. Thanks.

bethskurrie
2021-01-27 21:48
I think I might be able to answer your question though

bethskurrie
2021-01-27 21:49
for equal to, it just uses the values in the pact.

bethskurrie
2021-01-27 21:49
there is only extra matching data put into the matchers section when the value in the pact is not necessarily the value that should be accepted on the provider side.

bethskurrie
2021-01-27 21:50
in the equality case, it's just saying "the value that the provider returns must be equal to the value that was put into the pact"

ryanding16
2021-01-27 22:17
So how do I specify that the response value is either "A" or "B"? I over simplified the actual problem. The response is not a simple string. The actual problem is the response could either be an empty map or a particular map (either {} or {abc: 123}, for example).

tjones
2021-01-27 23:00
@ryanding16 A common point of confusion is that a contract is not the same as a spec. So, instead of saying "you might reply with A or B", you say "in the state where you would reply with A, the response looks like A", and "in the state where you would reply with B, the response looks like B"

tjones
2021-01-27 23:00
So, generally, write two interactions- one to cover each case\

tjones
2021-01-27 23:02
The reason we do this is because if you say "it could be A or B" you could successfully validate a provider which cannot ever produce B. This is the same reason why our array-like matcher doesn't let you specify an array that could be zero length

rarora
2021-01-28 00:15
we are using java and configuring using gradle

rarora
2021-01-28 00:16
i am sorry, i am not sure which channel is java specific. can you add me to that. i found this channel in documentation

matt.fellows
2021-01-28 00:22
#pact-jvm

matt.fellows
2021-01-28 00:23
I think the answer is using system properties

rarora
2021-01-28 00:23
would that property set conditionally?

matt.fellows
2021-01-28 00:55
what have you looked at so far?

rarora
2021-01-28 00:57
currently for webhook, i get a flag set as true. based on value of that flag i set with `systemProperty "pactbroker.tags"`latest or production. Wanting to know if there is better way

matt.fellows
2021-01-28 00:58
That?s what I would do

rarora
2021-01-28 00:59
Thank you @matt.fellows ++++

matt.fellows
2021-01-28 01:03
:slightly_smiling_face:

kflo
2021-01-28 01:53
re: https://docs.pact.io/pact_nirvana/step_8 ? at what point would this CI job be invoked? or would it be invoked on a schedule?

ryanding16
2021-01-28 13:35
Thanks, Tim for helping. This is our usage scenario, we have an API to pull the execution status of a job. On the provider side, we launch the job as part of the provider state setup. Depending on the execution stage (queued, executing, finished etc.), the response of this pulling request is different. Specifically, one field of the response json is empty before the job is done. After the job is completed, we return a piece of json for that field. Depending on how busy the server is and how fast the execution is, when making the API call, this field could either be empty or has something. That's why we'd like to use the or matcher for these two possible values. It will take efforts to either pause the execution (for the empty value) or wait for the job to finish (for the non-empty value) as part of the provider state setup. Just want to confirm we could not use the or matcher in this situation and we have to do something to control the output as part of the provider state setup.

athurner
2021-01-28 13:55
has joined #general

thomas.powell
2021-01-28 16:20
Thanks for the responses both. TBH the canned data and e2e tests are in place and running so it felt like testing against a primed system would be the way to go. Mocking the internal interface would be quite an overhead and may be brittle with downstream testing. My next question... the data is quite transient in nature and has timestamps in the path. Is it possible to use 'terms' in the path then reroute requests on the provider side to a datetime (path) that exists within my canned data set?

alex.mcnair
2021-01-28 18:35
has joined #general

ryanding16
2021-01-28 21:29
Bump, could someone help confirm if the way we'd like to use the or matcher described above is supported by Pact?

matt.fellows
2021-01-28 23:17
what language do you use? It?s supported in Pact JS (beta) and Pact JVM

mailinglistsspammedme
2021-01-28 23:30
has joined #general

mailinglistsspammedme
2021-01-28 23:38
We are using pact-php and were relying on the default `PactTestListener` to start and stop the mock server (https://github.com/pact-foundation/pact-php#start-and-stop-the-mock-server). We found that because of the way it is configured (and hard coded), that it caused tests to fail for developers when they ran tests locally because it is essentially coded in a way that you have to be running specific test suites for it to start. The documentation says that you can just start the server however you'd like, which works, but the Test Listener also does a bunch of stuff as well: https://github.com/pact-foundation/pact-php/blob/master/src/PhpPact/Consumer/Listener/PactTestListener.php#L96 including uploading everything and verifying the interactions. Without copying and pasting everything how can I replicate the behaviour in the best way possible.

matt.fellows
2021-01-28 23:41
Might be best asked in #pact-php Steve

abubics
2021-01-28 23:51
I will just back @tjones?s point up here, and recommend that you should still have a test for each significant state. You want Pact to help you assert the contract by specifying all the interactions that are important. In the case you're describing, there are at least 3 states that have shapes that you care about (queued, executing, finished, etc), so you should have a interaction for each that is important to distinguish. i.e. ? given the request is queued, when the status is checked, it should have shape A ? given the request is executing, when the status is checked, it should have shape B ? etc If you don't do that, how can you tell that all the shapes you care about are correct in each state? Or inversely, that the states you care about have the fields you need?

mailinglistsspammedme
2021-01-28 23:59
I can try asking there, I saw that but there was no action in 3 months.

matt.fellows
2021-01-29 00:07
Maybe PHP just does the best job of self-documenting on Github :stuck_out_tongue:

tjones
2021-01-29 00:18
Yes, that's a really clear explanation. The point is that if your test allows either shape to pass, you don't *know* that both shapes can be generated. This is an important distinction between a spec and a contract - with a spec, you are defining what kind of shapes are generally possible. With a contract, you are asserting that the right shape is used at the right time. Note that most specs allow completely nonsensical responses to be constructed - so saying "does this match the spec" isn't actually enough to know that your client can understand the response.

abubics
2021-01-29 00:24
> the right shape is used at the right time Stealing this description, I love its conciseness :star-struck:

steven.beaver.retail
2021-01-29 15:34
has joined #general

steven.beaver.retail
2021-01-29 15:42
is http://pactflow.io working today?  Yesterday I was able to push to and pull ... today I am getting 302 errors.  Is anyone else seeing this?

kflo
2021-01-29 16:45
working for me

steven.beaver.retail
2021-01-29 16:52
I am a new user and I signed up for the free plan. Do free plans expire after 1 day?

kflo
2021-01-29 16:59
they do not

kflo
2021-01-29 16:59
i believe they are indefinite, just with restrictions

steven.beaver.retail
2021-01-29 17:17
that's my understanding as well ... I'm not sure what is happening with my account. I emailed about the issue. Thanks for your help

matt.fellows
2021-01-29 21:23
I've responded to your other query in slack.

ekberli.elbrus
2021-01-30 16:33
has joined #general

george.south
2021-02-01 21:12
has joined #general

kflo
2021-02-03 00:22
we are currently using pact for service to service communication, but we additionally also need test coverage for our public API (which is basically composed of an API gateway layer that routes to a bunch of our services). we could of course make a ?fake? consumer and test the public API that way? but i?m wondering if maybe pact isn?t the best tool for that.

kflo
2021-02-03 00:24
i guess my hesitation is because we don?t really have any way of knowing how external consumers will use our API. we can only write tests that cover flows we think they will use.


matt.fellows
2021-02-03 00:26
You?re basically on point

kflo
2021-02-03 00:26
yeah i saw that, although we have control over this public API because it is ours

matt.fellows
2021-02-03 00:26
yep

matt.fellows
2021-02-03 00:26
same kinds of problems though, just in reverse (you can?t / may not be able to control the consumer)

kflo
2021-02-03 00:28
any recommended tools? we already have swagger in our ecosystem for generating documentation so i will look into that

kflo
2021-02-03 00:29
my naive idea is that we can just maintain a manually updated swagger spec, and always run regressions against that prior to deployment. it should fail if the spec is out of sync with the implementation

matt.fellows
2021-02-03 00:41
Tools that come to mind to keep things in sync: ? *OSS Tools:* ? Dredd ? https://github.com/rabobank/openapi-contract-validator-server (via @lakitna - feel free to chime in here!) ? *Services:* ? Optic ? Akira Software The last two look promising, albeit are only in private beta As an aside, we are also planning on creating a tool (see https://github.com/pactflow/roadmap/issues/31) to validate swagger specifications that would work with the rest of the Pact ecosystem. Albeit that would be a few months away for you at best.

twierzchowski
2021-02-03 07:05
has joined #general

yassin.hajaj
2021-02-03 10:35
has joined #general

dany.marques90
2021-02-03 12:48
has joined #general

marcelo
2021-02-03 13:11
has joined #general

sandeeparthur
2021-02-03 19:46
has joined #general

jarmy
2021-02-04 00:33
How exhaustive do you want your contract tests to be? Say I have a provider that has 20 endpoints. Should we expect the consumer to write a contract that exercises all 20 endpoints and their permutations?

bethskurrie
2021-02-04 00:36
My opinion is, do the cost/benefit analysis for your situation. How likely is it that the given fields will change? Are the responses different? Would any of this be covered in any other tests? How good is your error logging?

bethskurrie
2021-02-04 00:37
Eg. when there is a high number of potental values for a field (like an enum) then I might not put every value in a contract test, but I might have my code written to explicitly handle an unknown value.

bethskurrie
2021-02-04 00:38
e.g. follow the laws of interoperation and just pass on things you don't understand, and log them in such a way that the dev team gets notified of the violation.

bethskurrie
2021-02-04 00:38
I'd make sure the main scenarios are covered, but I'm not sure of the benefit of completely exhaustive testing.

jarmy
2021-02-04 00:39
Right. Typically the more exhaustive the tests are the more brittle they become

bethskurrie
2021-02-04 00:39
totally

bethskurrie
2021-02-04 00:40
you have to make sure you're not trying to do "functional" testing at that stage

bethskurrie
2021-02-04 00:40
remember we *mostly* care about shapes, and making sure we understand the possible responses, not necessarily the response to every different variation of data.

jarmy
2021-02-04 00:42
The reason I posted this question is because we have a team that develops acceptance tests that test the swagger api docs for a provider. I imagine there would be some level of duplication with contract tests

bethskurrie
2021-02-04 00:43
yes.

bethskurrie
2021-02-04 00:44
There is overlap in the venn diagram of contract tests and acceptance tests, however, there is a lot in each circle that doesn't overlap

bethskurrie
2021-02-04 00:44
And neither on their own is sufficient.

bethskurrie
2021-02-04 00:45
But both help reduce the need for integration tests, so #winning

jarmy
2021-02-04 00:45
precisely

bethskurrie
2021-02-04 00:45
What tool are you using for verifying your OAS btw?

bethskurrie
2021-02-04 00:46
@matt.fellows and I were discussing this topic this morning actually

jarmy
2021-02-04 00:46
I believe it's RESTApi

bethskurrie
2021-02-04 00:47
I'm having trouble finding it on google. It's a very overloaded term!

bethskurrie
2021-02-04 00:48
Have you seen our Roadmap info on Pact/OAS support? https://github.com/pactflow/roadmap/issues/4

jarmy
2021-02-04 00:48
Correction, it's REST Assured

jarmy
2021-02-04 00:49
I'm following that roadmap issue

bethskurrie
2021-02-04 00:50
Awesome. Is there someone who is working on those tests who I could have a chat with? I'm interested in knowing what sort of artifacts come out of the tool that we could publish to Pactflow.

jarmy
2021-02-04 00:51
Let me see if they'd be willing to share

bethskurrie
2021-02-04 00:51
Thanks!

matt.fellows
2021-02-04 01:27
Hi Steven, just wanted to check-in as I never heard back - everything OK?

bethskurrie
2021-02-04 02:40
People - naming things is hard. What is the noun that means "a specific version of an application running in a specific environment for a period of time that starts when it is deployed, and ends when it is undeployed (ie. when the next version is deployed)". I have a particular word in my head, but when I used it, it was not obvious to another person reading my code what I meant. I want to see what words come to other people's heads without saying the word that I'm thinking of!

bethskurrie
2021-02-04 03:03
For context - at the moment, when an application version is deployed, we tag that version in the broker with the name of the environment. I'm now adding first class support for modelling <name of the thing with the app version/environment/time period> in the Pact Broker, so that when you deploy you would now run `pact-broker name-of-command-to-be-decided --pacticipant Foo ---version 1 --environment production`


tjones
2021-02-04 05:45
I mean, I would just call that `deployment`

tjones
2021-02-04 05:45
Like, the deployed version at 2pm tuesday afternoon was v1.2.3

tjones
2021-02-04 05:46
so, `deployment` or `deployedVersion`

2021-02-04 05:50
A new post has been created in *Feature Requests*

octoberclub
2021-02-04 16:27
has joined #general

kflo
2021-02-04 17:02
optic looks really nice

kflo
2021-02-04 17:03
going to try that one out

slavick
2021-02-04 17:21
has joined #general

imran.settuba
2021-02-04 18:57
has joined #general

matt.fellows
2021-02-04 21:54
Just a general shout out to a few people that I can see have been working furiously on OSS contributions over the past few weeks: @tjones (he?ll be asleep, because I saw him committing/working at almost 2am last night) :taco:

matt.fellows
2021-02-04 21:54
@marko.justinek he?ll probably be on a bike/run/swim right now :taco:

matt.fellows
2021-02-04 21:54
@artur who?s been furiously raising issues, feature requests and contributing across the ecosystem :taco:

bethskurrie
2021-02-04 21:55
I called it a deployment @tjones but then Matt thought I was talking about the deployment process itself, so that made me question the term.

matt.fellows
2021-02-04 21:57
Actually deployment is the perfect term. Sorry I didn?t get back to your other notes Beth

matt.fellows
2021-02-04 21:57
It was the `--end-previous-deployment` that I think threw me off. It seemed to imply a sort of process there

matt.fellows
2021-02-04 21:58
where as simply ?record deployment? is exactly what you talk about here

matt.fellows
2021-02-04 21:59
so perhaps rather than ?end previous deployment?, it?s really a replacement.

matt.fellows
2021-02-04 21:59
i.e. Application A version 1 is deployed to prod. Application A version 2 replaces version 1 in prod

bethskurrie
2021-02-04 21:59
Hm. Kind of. You're replacing IRL, but in terms of the resource model, you're not replacing the object.

matt.fellows
2021-02-04 22:00
But the CLI is not a resource model - that?s the REST guff under the hood

bethskurrie
2021-02-04 22:00
It's putting an end date on the previous latest "thing" resource.

bethskurrie
2021-02-04 22:00
True.

bethskurrie
2021-02-04 22:02
There's a distinction between the language used in the CLI and the terms used in the resource model. But we do want them to harmonise as much as possible.

tjones
2021-02-04 22:02
I think deploymentVersion disambiguates it between the process and what we?re talking about here

bethskurrie
2021-02-04 22:04
`pact-broker record-deployed-version --pacticipant Foo --version --1 --environment prod --replaces-previous`

bethskurrie
2021-02-04 22:04
?

bethskurrie
2021-02-04 22:05
`/environments/prod/deployed-versions/current`

bethskurrie
2021-02-04 22:05
that makes sense.

matt.fellows
2021-02-04 22:05
I think this is still clear. Version is a required flag, so not sure it?s required in the subcommand ```pact-broker record-deployment --pacticipant Foo --version --1 --environment prod --replaces-previous```

bethskurrie
2021-02-04 22:05
`/pacticipants/Foo/deployed-versions/environment/prod/latest`

matt.fellows
2021-02-04 22:06
I think `s/deployed-versions/deployments` is nicer personally

bethskurrie
2021-02-04 22:06
the `--replaces-previous` would actually be on by default because most systems are not mobile consumers, so perhaps we need a flag that says the opposite.

bethskurrie
2021-02-04 22:07
Ok, so the cli could be "record-deployment" but the API could be "deployed-versions"

matt.fellows
2021-02-04 22:07
yep, that would make sense if it matches the resource model clearer

bethskurrie
2021-02-04 22:09
If we're going back to the CLI being "deployment" is "deployment" better in the resource model after all then?

bethskurrie
2021-02-04 22:09
`/pacticipants/Foo/deployments/environment/prod/latest`

bethskurrie
2021-02-04 22:09
`/environments/prod/deployments/current`

bethskurrie
2021-02-04 22:10
I'm leaning towards deployed-versions just because "current deployments" could sound like" the ones that are in process at the moment" where as "current deployed versions" is very clear.

christopher.roberts
2021-02-05 01:02
has joined #general

tjones
2021-02-05 03:10
> most systems are not mobile consumers The other use cases I'm aware of are publishing a client library, or using a progressive web app with a long cache life

matt.fellows
2021-02-05 03:22
yes, good call

tjones
2021-02-05 03:22
I'd like to add @omer.moradd to the list of shoutouts - not only did he create an excellent wrapper for using nest-js together with Pact, but he's brought up several improvements and housekeeping items that will lead to an improved experience for developers all around :taco:

omer.moradd
2021-02-05 06:33
Wow thanks Tim! Happy to be part of Pact!! :blush:

r.darcel
2021-02-05 09:15
has joined #general

kflo
2021-02-05 18:06
first word that comes to mind for me is ?release?

kflo
2021-02-05 18:07
but i guess ?release? implies something changed, when that may not be true? so deployment also works

kflo
2021-02-05 18:10
?deployment? seems like a smaller point in time to me, but it also seems like what you are really tracking is an event and not a ?living? thing

ashish.joshi
2021-02-06 01:07
has joined #general

przemek.sech296
2021-02-08 23:18
has joined #general

matt.fellows
2021-02-09 05:32
This is what a ?day off? looks like for @bethskurrie, @uglyog and @tjones :taco:

tjones
2021-02-09 05:32
What does a day on look like? :thinking_face: :joy: :joy:

vplows
2021-02-09 06:00
has joined #general

ranjanayush03
2021-02-09 06:43
Hello all, I have a new requirement in which I need to implement contract testing for event driven message system in which the provider and the consumer are exchanging messages continuously and based on the messages the ui renders one type or another, they are using hateoas architecture. So suppose if one key changes it's value then there are some changes in the response json structure, so it will be very difficult to write mocks for every such case and in order to generate a pact for that , so is there a way to write a consumer test that has mocks which can cater to all such points based on various matchers or rule that we can provide while creating pact.

ranjanayush03
2021-02-09 06:45
If anyone has implemented contract testing for event driven architecture , it will be very helpful for me if they provide an example or a link to that.

matt.fellows
2021-02-09 10:54
howtoexamples


matt.fellows
2021-02-09 10:55
There is a message queue version here

matt.fellows
2021-02-09 10:55
which language are you using?

matt.fellows
2021-02-09 10:55
(there is also a siren example there, I think, that is a HATEOS/hypermedia api)


ranjanayush03
2021-02-09 11:55
Thanks a lot Matt will look into this

ranjanayush03
2021-02-09 11:56
We are using javascript.

rodney.stromlund
2021-02-09 16:18
has joined #general

nada
2021-02-09 19:00
has joined #general

siddhardhan
2021-02-09 20:21
has joined #general

mamtha.3687
2021-02-10 04:36
Hi, we have a HATEOAS javascript app that integrates with many message providers and has lots of interactions, say 100s of variations for each message "intent" based on various conditions. Few questions: 1. How do we implement contract tests for these? Do you recommend contract tests for messages for this? 2. Since all of the messages mostly have same parent structure, the difference is only within the nested children, is there a way for us to specify rules for the general structure once that can be used for any message as a first rule by default and any additional rules over it? 3. The inner children may not have the same depth for messages. Is there a way to just find if a key called "myKey" exists anywhere within the json (at any level)? Sorry if some or all of these questions are basic. Just trying to help out a team that's struggling with ever changing message structure and really want to leverage contract testing in the best possible way.


abubics
2021-02-10 04:38
Even if it's not the same problem set, the links in that thread might still be helpful :slightly_smiling_face:

mamtha.3687
2021-02-10 04:42
Yes the intent is the same but felt the example shared did not talk about code maintainability and best practices to segregate the interactions when there are way too many. Hence wanted to provide some more background into the issue so someone who has done something similar can assist.

matt.fellows
2021-02-10 06:45
could you perhaps give a few examples to illustrate your point? When some people say ?100s of variations? it can mean different things.

mamtha.3687
2021-02-10 07:25
The app renders UI based on messages it receives. If the intent is to identify user, the message would have validated the given information from home page and find a match and if some additional info is required, a message containing only the missing information fields is sent back and UI for that is rendered accordingly until the app is able to determine if the user is a returning user or a new one. So although the intent is just one, the message structure changes based on the information the user enters. I hope this gives you some idea?

matt.fellows
2021-02-10 07:29
sure, but could you please also share some code snipped examples of the payload?

matt.fellows
2021-02-10 07:32
Ultimately, https://docs.pact.io/consumer still applies: > The rule of thumb for working out what to test or not test is - if I don?t include this scenario, what bug in the consumer or what misunderstanding about how the provider responds might be missed. If the answer is none, don?t include it.

matt.fellows
2021-02-10 07:33
if it?s just values that can change, but have no specific meaning to the user interface (i.e. they are just displayed without having a semantic meaning), then they probably shouldn?t be included

matt.fellows
2021-02-10 07:33
if these are specific hypermedia actions that have a semantic meaning and you need to ensure they exist then they probably should exist

mamtha.3687
2021-02-10 07:42
if these are specific hypermedia actions that have a semantic meaning and you need to ensure they exist then they probably should exist <-- this exactly. There are actions and description body that contains specific validations that need to be applied to the controls. I'll check if the schema can be shared and revert.

matt.fellows
2021-02-10 07:43
thanks

lars.hisken916
2021-02-10 08:08
has joined #general

pauligoe10
2021-02-10 08:19
has joined #general

tusharvarm
2021-02-10 09:38
has joined #general

igorsharf
2021-02-10 10:39
has joined #general

kieran
2021-02-10 17:13
has joined #general

kieran
2021-02-10 17:22
Hey :wave: I am new to pact and currently using pact-python (v 1.3.0) to experiment with a consumer test and the http://packflow.io broker. The docs suggest using a unique string for versioning pacts, i.e a commit SHA, but when I pass anything other than a string in this format 'x.x.x' to the below for example I get the following error. ```pact = Consumer( "example", tag_with_git_branch=True, tags=[prod_tag_flag] ).has_pact_with( Provider("exampleName"), host_name=mock_host, port=mock_port, publish_to_broker=True, broker_base_url=pact_broker_url, broker_token=pact_token, version="1.0.0" <---- ideally this would be dynamic and unique. )``` ```Malformed version number string 9bb9d91 (ArgumentError)``` Am I misunderstanding how I am supposed to pass a version number to the broker? (https://docs.pact.io/getting_started/versioning_in_the_pact_broker/)

kieran
2021-02-10 17:23
I also subsequently get this warning when publishing to the broker: ```A pact for this consumer version is already published. Overwriting. (Note: Overwriting pacts is not recommended as it can lead to race conditions. Best practice is to provide a unique consumer version number for each publication.)```

kieran
2021-02-10 17:24
_(which makes sense if the version number is static on publish)_

poward
2021-02-10 18:17
has joined #general

thirumal.net
2021-02-10 20:51
if you are running in CICD system , i guess you can pass buildnumber

ckhadilkar
2021-02-10 21:16
has joined #general

abubics
2021-02-10 23:03
There's some advice https://docs.pact.io/getting_started/versioning_in_the_pact_broker/, but that sounds kinda like an old thing I've heard of, before people realised that the semver format might not represent enough info . . . might be more to do with that pact-python version :thinking_face:

kieran
2021-02-11 09:15
Thanks @thirumal.net - I am not sure that the build number is unique across PRs in a CICD scenario but I will try use that for now.

kieran
2021-02-11 09:15
I have raised this as an issue against the project -- thanks :thumbsup:

kieran
2021-02-11 18:23
I have figured this out, the structure must follow: ```'1.0.0-' + get_git_revision_short_hash()```

neild
2021-02-11 18:53
has joined #general

painenigowthami
2021-02-11 22:32
has joined #general

matt.fellows
2021-02-11 22:42
I?ve responded to the ticket. It looks like the `version` field on the top level `Consumer` class actually maps to the pact specification version (on the `Pact` class), which is an entirely different thing.

matt.fellows
2021-02-11 22:42
You only need to pass the version when _publishing_

stephenkilbourn
2021-02-11 23:02
has joined #general

tcarlson
2021-02-11 23:05
has joined #general

arindam.datta
2021-02-12 06:22
Hi @bethskurrie, is it recommended to keep the Provider verification step in a separate build pipeline than the normal build pipeline?

bethskurrie
2021-02-12 06:22
Yes.

bethskurrie
2021-02-12 06:22
Let me grab the docs.

arindam.datta
2021-02-12 06:23
Thanks a lot @bethskurrie, the documentation link would be helpful.


arindam.datta
2021-02-12 06:23
:pray:

bethskurrie
2021-02-12 06:23
You have two "modes" of verification. One when the pact changes, and one when the provider changes.

arindam.datta
2021-02-12 06:24
Yes, true..

arindam.datta
2021-02-12 06:24
when pact changes, webhook triggers the verification with specific pact_uri

arindam.datta
2021-02-12 06:26
So, if I understand correctly, the `verification step` which gets triggered when pact changes, is recommended to be in a separate pipeline.

arindam.datta
2021-02-12 06:27
And there will be a `verification step` in the providers normal/default build pipeline too?

bethskurrie
2021-02-12 06:29
yes

bethskurrie
2021-02-12 06:29
That page I sent you describes both flows.

arindam.datta
2021-02-12 06:29
Thanks for the confirmation... clear now. :pray:

knsrividya10
2021-02-12 06:48
has joined #general

r.strauch
2021-02-12 10:15
has joined #general

ztlboy05
2021-02-12 14:57
has joined #general

smith260194
2021-02-12 15:22
has joined #general

greg719
2021-02-12 18:41
We organize Pact related meetup talk, please join :slightly_smiling_face: https://www.meetup.com/Warsaw-Code-Craft-Group/events/276047962/ it will be the first of a series

kflo
2021-02-12 19:58
has anyone made a helm chart for the pact-stub-server before?

kflo
2021-02-12 19:59
we do deployments of our services to local kubernetes for testing, so putting the stub server there would work well for us

dabfleming
2021-02-12 20:34
has joined #general

neild
2021-02-12 21:10
Hi, i?m confused about whether or not to tag the production version of a provider when verifying a consumer contract inside the consumer CI pipeline (webhookless flow). Ex/ say we want to verify the contract in the `feat-a` branch of the consumer against the production version of the provider (tagged `prod`). In the consumer CI pipeline, we would perform the following steps: 1. checkout the production version of the provider using a Docker image 2. Run the verify step inside the consumer CI pipeline 3. Publish the results of the verification from step 2 In step 3, should we publish the results and tag the provider with `prod`? This seems to be the only way to tell the pact-broker that `feat-a` is compatible with `prod`, but it breaks the ?golden tagging rule?, which states to only tag a pacticipant with an environment name on deploy.

ryanlevell
2021-02-13 00:29
> the provider (tagged prod) You said the provider is already tagged prod, so you wouldn?t need to tag it again. The verification results will already show compatibility between consumer feat-a and provider prod.

prasanthp
2021-02-13 00:45
has joined #general

matt.fellows
2021-02-13 00:52
Haven't seen it but good idea!

bethskurrie
2021-02-13 01:02
^^ What @ryanlevell said. That pacticipant version will already be tagged with production, so it doesn't matter if you do it again or not.

bethskurrie
2021-02-13 01:03
@kflo someone has before, just google it.

kflo
2021-02-13 01:06
i saw one for the broker but not the stub server. went ahead and rolled my own for now

kflo
2021-02-13 01:07
i can throw this up on github although it only supports loading pact files from directories right now

bethskurrie
2021-02-13 01:08
sure.

bethskurrie
2021-02-13 01:08
send us the link and we can put it in the docs.

bethskurrie
2021-02-13 01:08
I mis-read your question, and didn't realise it was the stub server you meant.


bethskurrie
2021-02-13 06:14
@neild there is a change coming to the APIs that I'm making that means that I recommend that you put the "prod" tag in there just to be safe.

bethskurrie
2021-02-13 06:15
On a separate note, tag support isn't going away, but we are introducing explicit support for deployments https://github.com/pact-foundation/pact_broker/discussions/384

2021-02-14 20:13
@bethskurrie has a polly for you!

bethskurrie
2021-02-14 21:40
@marko.justinek @animesh2712 you've voted for what I would consider the "feature branch" format. What is the name of the branch that all those features merge into?

marko.justinek
2021-02-14 22:03
`main`

abubics
2021-02-14 22:29
Can't pick multiple :( github changed their default branch name from `master` to `main` a while back, and I'm in multiple repos & git providers :sweat_smile:

bethskurrie
2021-02-14 22:30
Oh, I thought I made it multiple select, but must not have.

bhardwajdiwakar
2021-02-14 22:38
has joined #general

bethskurrie
2021-02-14 22:42
When configuring the verification on the main branch of the provider, does anyone ever have more than one *branch* of the consumer that they include? The reason I'm asking is that I'm adding support for recording the branch name with the version resource in the broker, and I want to make the whole "consumer version selectors" go away by having a `mainDevelopmentBranch` property on the pacticipant. I'm not sure whether to make it a string or an array.

bethskurrie
2021-02-14 23:00
I have plans to make the whole "configuring which pacts to verify" thing much simpler. Would welcome your thoughts on this https://github.com/pact-foundation/pact_broker/discussions/391

abdul.hussain
2021-02-14 23:31
I'm trying to integrate webhooks within my pact workflow so that when a consumer needs to deploy the provider is verified to prevent breaking changes from being deployed, to do this I've got another bitbucket pipeline I can run to verify the provider within the webhook handler, I'm currently trying to substitute the username, password or bitbucket token within the webhook I'm creating within the pact broker with some form of variable, as ideally I wouldn't like to store such credentials within the broker. Is this possible, I can only see the following variables from the documentation https://docs.pact.io/pact_broker/advanced_topics/api_docs/webhooks#dynamic-variable-substitution I also noticed the following statement from the documentation https://docs.pact.io/pact_broker/webhooks/template_library ```If you use Bitbucket and have worked out how to pass parameters into the build, can you please submit a PR to update this example.``` Thoughts?

matt.fellows
2021-02-15 00:26
ahh, so Gitflow has the idea of a release branch (`feat-a`), a main development branch (`develop`) and mainline (`master` or `main`)

matt.fellows
2021-02-15 00:27
I?m just thinking how this may map onto your question

bethskurrie
2021-02-15 00:27
sounds like an array would be safest then.

matt.fellows
2021-02-15 00:28
Personally, I think gitflow is horrible and Github flow is much better, but I know it?s common in enterprises because reasons

bethskurrie
2021-02-15 00:28
it's really "branches you want to verify all the time". but needs a better name!

matt.fellows
2021-02-15 00:29
I still think in gitflow you only really care about a single branch, it?s just that that branch will _change_ depending on where you are in the lifecycle

bethskurrie
2021-02-15 00:30
Well... that could be tricky!

matt.fellows
2021-02-15 00:31
mmm

matt.fellows
2021-02-15 00:32
that?s where falling back to the consumer version selectors probably makes sense

matt.fellows
2021-02-15 00:32
It?s probably safe to say ?we always care about `development` and `main` ? though, and during a release we additionally care about `release-x`

bethskurrie
2021-02-15 00:33
the bigger picture is that we'll be recording and automatically including deployed versions for verification, so anything that's actually in an environment will get picked up that way

bethskurrie
2021-02-15 00:33
so it's mostly "branches that are not currently deployed"

matt.fellows
2021-02-15 02:36
@gradzio is organising a PHP meetup this week on contract testing with Pact https://www.meetup.com/Warsaw-Code-Craft-Group/events/276047962/. Greg - is it worth anybody outside of the PHP community joining? Would you care to share a little more about it?

tjones
2021-02-15 05:52
People who use broker tags - does your tag name also end up in the version?

tjones
2021-02-15 05:52
or, more generally, what do you use as versions for your consumer/provider?

bethskurrie
2021-02-15 05:53
That would imply the branch name is in the version?

tjones
2021-02-15 05:54
Are broker tags always the branch name? (also, yes, this is something I?m thinking about)

bethskurrie
2021-02-15 05:54
they're pretty much always meant to be the branch name or the environment name.

bethskurrie
2021-02-15 05:54
I can't think of a reason for them to be anything else.

tjones
2021-02-15 05:54
Spoiler: I?m working on a module for pact-js which will automatically do versions from git tags

bethskurrie
2021-02-15 05:55
the special Tim format.


tjones
2021-02-15 05:55
But I?m keen to see what other people do so I can support their formats too

bethskurrie
2021-02-15 05:55
I'm not sure what it has to do with pact. it seems just a generally useful thing.

tjones
2021-02-15 05:55
Also the special tim format is just semver with lots of (allowed) metadata

tjones
2021-02-15 05:56
yep! I?m going to release it as a separate module that people can use or not as they like.

bethskurrie
2021-02-15 05:56
sounds like a good plan

tjones
2021-02-15 05:56
In js-land, we can include it in the examples so that modifying the examples results in best-practice rather than hardcoded example versions.

hiteshpatadia
2021-02-15 06:29
has joined #general

antonello
2021-02-15 07:43
We have two ways of doing versioning. In the legacy versioning, the branch would end up in the pact version. In the versioning, it doesn't!

kieran
2021-02-15 09:20
Thanks @matt.fellows I have responded also.

matt.fellows
2021-02-15 11:05
Thanks. It looks like a bug to me

matt.fellows
2021-02-15 11:13
I?ve updated the ticket

matt.fellows
2021-02-15 12:48
ICYMI - the proposal on extending Pact with plugins: https://github.com/pact-foundation/pact-specification/issues/83 (it?s fairly elaborate now - this probably could have been a blog!)

vikrant.sarkaniya
2021-02-15 13:31
has joined #general

neild
2021-02-15 14:12
Got it, thank you all. I was having a hard time wrapping my head around the tagging system, but this clears it up

lemitrou
2021-02-15 14:20
has joined #general

neild
2021-02-15 15:13
Related, I?m basing my consumer CI pipeline on the https://github.com/pactflow/example-consumer-webhookless/blob/master/.github/workflows/build.yml, and I think the `verify` step is missing some pieces. Namely, it doesn?t specify to the provider the newly published pact that needs to be verified. Am I correct or am i missing something here @bethskurrie? ``` Verify: runs-on: ubuntu-latest needs: Test continue-on-error: true steps: - run: docker pull pactfoundation/pact-cli:latest - uses: actions/checkout@v2 - name: Check if verification exists # Taises an error and does not continue if the verification already exists # Because continue-on-error is set to true, this will not fail the overall build however run: "! make check_if_successfull_verification_exists" - uses: actions/checkout@v2 with: repository: pactflow/example-provider - name: Set TRAVIS_BRANCH environment variable run: echo "::set-env name=TRAVIS_COMMIT::$(git rev-parse HEAD)" - uses: actions/setup-node@v2-beta with: node-version: '12' - name: Install run: npm i - name: Verify run: make ci_webhook env: PACT_BROKER_PUBLISH_VERIFICATION_RESULTS: true TRAVIS_BRANCH: master```

matt.fellows
2021-02-15 23:52
I spoke with @uglyog this morning about his ideas to improve the proposal, including better reliability/consistency in plugins and also including how a plugin can also refer to another plugin (the N:M problem). If that doesn?t make the plugin authorship too difficult, or detract from our key objectives, it will genuinely be *awesome.* Stay tuned

helloraj
2021-02-16 08:09
has joined #general

tjones
2021-02-16 11:29
@antonello: I?m keen to hear more details on this - what did the two schemes look like? Why did you change?

wesleythomaswilliams
2021-02-16 15:39
For context on what I've picked our flow is: feature -> develop -> pre-prod -> master (production) Although we're in the process of renaming master to main

jamesmlucas
2021-02-16 19:29
has joined #general

antonello
2021-02-16 19:47
@tjones Our current versioning is: *git-20210127-0818-21accfd6* *I showed it during our pact event.* Nothing particularly odd about the two versioning approaches. We had a different one, based on pom versions and some older apps are still on that.

gabe707
2021-02-16 20:31
has joined #general

wangpei9679
2021-02-16 21:29
has joined #general

geir
2021-02-16 23:03
has joined #general

bheemreddy181
2021-02-16 23:34
Team , How do i check a diff between two pacts ?

abubics
2021-02-16 23:43
@wesleythomaswilliams Is that a gitops kind of thing, like "this branch is deployed to this environment"?

abubics
2021-02-16 23:44
(or more like git-flow?)

matt.fellows
2021-02-17 00:02
Head to the HAL browser for a given Pact, and there is a diff relation on it

matt.fellows
2021-02-17 00:02
you can diff against any version

bheemreddy181
2021-02-17 00:04
Ah got it

bheemreddy181
2021-02-17 00:08
Matt , i got some feedback on the terraforms built around pact broker , i asked my deployment team to join this slack channel to share his feedback. you should see them soon here.

2021-02-17 03:27
A new post has been created in *Feature Requests*

tjones
2021-02-17 03:28
^ This is the kind of thing that could be implemented with the pact file operations tooling I was talking about

tjones
2021-02-17 03:28
I reckon if we had that tooling, all sorts of surprise helpful features would emerge

soruma.net
2021-02-17 05:58
has joined #general

wesleythomaswilliams
2021-02-17 09:19
I wasn't familiar with the git-flow term, but reading up, I believe that kinda fits. When our feature branches are merged into develop, they're deployed into the dev env, likewise, when develop is merged into pre-prod it's deployed to staging and master it's live in production.

therimpact
2021-02-17 12:30
has joined #general

andrzej.igielski
2021-02-17 21:41
has joined #general

andrzej.igielski
2021-02-17 21:45
Hi, I have a general conceptual questions about atomicity of tested interactions and provider states

andrzej.igielski
2021-02-17 21:48
my name is Andrzej and I?m a developer in a team that is contributing to a larger product along with other 5-6 teams. The product we?re developing consists of a number of components that communicate with each other, but are - generally speaking - developed as separate micro-services. We?ve been thinking of using contract testing for a while now, some of our colleagues being passionate advocates of this approach, while others having some doubts (I?m kind of somewhere in between). On clarification in advance: I?m in no way a pact (or contract testing) expert, so my questions are of rather of conceptual nature. I wanted to ask you about 2 points, because I?m still not sure if I?m missing something or whether we?re indeed thinking in different paradigms. These points (both touched upon on this page: https://docs.pact.io/getting_started/provider_states/) are: 1. Isolated testing of single interactions 2. Necessity to provide separate tooling to set internal states of the provider Ad. 1. The way I see it - the contract between consumer and provider is more than just how the provider responds to a given request. The consumer also assumes some behavior of the system over a course of of several calls. This can of course always be reduced down to a series (state, action (request), response + new state) tuples (which is essentially done by the notion of Provider States in `pact`), but this introduces tons of theoretically unrelated test cases / interactions that can be hard to manage and implies some additional capabilities of the provider (more on that in point 2). Wouldn?t it be more natural and understandable to be able to define a contract in form of a series of interactions with some ways on symbolic representation of the provider state on the client side? Ad. 2. I don?t quite understand the necessity to for the provider to additionally provide some means to set its internal state. Every valid provider state can be achieved by (a series of) public API calls, otherwise it?s not a valid provider state. So the only reason to provide additional means to achieve this state is to simplify things for the consumer. This simplification however comes at a cost on the provider side: ? additional effort to develop such means ? risk of these 2 ways (internal and public) to set the state running apart ? deviation from the microservice architecture (the consumer would essentially need to know the internals of the provider?s state to know what to set it to in a given situation); (yes, I know, this is more on the ideological than pragmatic side) Again - wouldn?t it be better to be able to define a contract as a series of interactions (as described in point 1) and achieve (more or less) the same thing? Let me give you some simple example that we were discussing in our team: ? Provider exposes ArtifactService that can register and get / list registered artifacts (corresponds to POST and GET operations in REST API) ? Consumer uses this ArtifactService and wants to make sure that the contract that is assumed by the consumer doesn?t change ? To do it the consumer wants to check that querying for an existing Artifact with ID=1234 yields the response containing attribute ID=1234. This is problematic, however, because the ArtifactService doesn?t allow the consumer to set the ID of the artifact - this ID is generated by the provider. To explicitly check the contract by using fixed ID 1234 the consumer would have to force the provider to go into this state. This could be done using some internal provider API setting the provider to this state, but we?d run into risk of setting it to something that is not a valid state (consumer would have to know all the valid internal states of the provider to not make a mistake). It?s like allowing to use a private method for test purposes. What I was suggesting is to define a contract a sequence of 2 interactions:

andrzej.igielski
2021-02-17 21:48
1. Create artifact by calling POST /artifacts and saving the result of it to some client-side test session (that could be symbolically represented in the contract by some arbitrary handle, e.g. A) 2. use the handle A to define the expectation for the GET call (i.e. check that the response of GET /artifacts/{A.id} contains attribute ID={A.id}) It would allow to test more complex behavior of the system. *Pros*: intuitive definition of test flows reflecting the nature of the provider API *Cons*: not possible to reduce to single interactions Sorry for being that verbose, but this topic has been keeping us occupied for a long time now. I hope you can clarify my doubts to some extent (confirm that what I?m writing makes sense or help me understand what I?m missing). Thanks in advance for your help!

wangpei9679
2021-02-18 00:44
Hi team, one general question, if I write the pact verify test on provider, does it means that I don?t need to write the controller test. since I found the pact verify testing is similar to the controller test which I will also mock the underlying service.

abubics
2021-02-18 00:46
The super-short answer is: ? What you've described might be a conflation with functional tests (stateful, with side-effects). ? The philosophical intent of Pact (and other contract testing tools) is to reduce the scope (collaborators, state, etc) of tests to a unit-level, so test cases & suite sizes don't grow exponentially.

abubics
2021-02-18 00:47
Functional tests are still useful, but replacing bits of them with interaction tests can improve overall test time, and remove flakiness.

abubics
2021-02-18 00:48
It's analogous to replacing bits of end-to-end tests or UI (screen-driver) tests with unit tests. You still want some integrated tests to make sure the units are connected properly, but you don't want only black-box tests, because they take forever to run, especially if they're exhaustive.

abubics
2021-02-18 00:49
You still have to work out how much coverage you want for each level of your testing pyramid :slightly_smiling_face:

abubics
2021-02-18 00:51
Yes and no. ? If I have contract tests, I write less (approaching 0) integrated controller tests (e.g. MockMVC). ? I still have controller unit tests, in cases where there is significant logic.

abubics
2021-02-18 01:29
Discussing this is a little off-topic, but I'd love to hear about your experience with that. I can only imagine issues with having no separation between building artifacts and deploying them :slightly_smiling_face:

matt.fellows
2021-02-18 01:42
> The philosophical intent of Pact (and other contract testing tools) is to reduce the scope (collaborators, state, etc) of tests to a unit-level, so test cases & suite sizes don?t grow exponentially. that statement is a piece of art

matt.fellows
2021-02-18 01:43
Just found this video, it might be helpful for some: https://www.youtube.com/watch?v=arfwmRNTwp0

wangpei9679
2021-02-18 02:53
Hi team, i am not sure if it is an existing bug, When I publish pacts with tag which contains slash `/` , it won?t work. I have to convert it to `%2F` . but when I am using the tag in verify testing, I have to use `/` instead of `%2F` .

tjones
2021-02-18 02:54
This sounds like a bug. Which framework are you using to publish / verify?

wangpei9679
2021-02-18 02:56
I am using `@pact-foundation/pact:9.15.0` pact-js.

mikewagner21
2021-02-18 03:15
has joined #general

abubics
2021-02-18 04:41
steal it for docs :innocent:


andrzej.igielski
2021-02-18 08:08
thanks Boris!

khandelwalbhushan
2021-02-18 08:10
has joined #general

aniket.agarwal
2021-02-18 09:21
has joined #general

arpit.modani
2021-02-18 09:43
has joined #general

byronth
2021-02-18 11:45
has joined #general

sagupta
2021-02-18 14:34
hi team, i have a general question . Should the `can-i-deploy` job be also included in the feature build pipeline or should only be included on master ?

wangpei9679
2021-02-18 19:06
will do,

matt.fellows
2021-02-18 21:07
Yes, you can use it as a can-i-merge check

matt.fellows
2021-02-18 21:07
See the ci/cd workshop in howtolearn

2021-02-18 21:07
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

isa.levine
2021-02-18 23:37
has joined #general

artur
2021-02-19 07:57
I have two providers, an existing system (ownCloud X) and a rewrite (OCIS). The goal is that the rewrite one day is compatible with the existing system. The consumer is supposed to work with both providers Should I have one pact with two versions of the provider or two pacts?

uglyog
2021-02-19 08:35
Is the API the same? If so, then you only need one

artur
2021-02-19 08:36
not yet, OCIS is still under heavy development, but the goal is that the API will be the same one day

uglyog
2021-02-19 08:37
I would use one pact. You will know when the new service is good when the provider test passes

arpit.modani
2021-02-19 09:47
Hi Team !! I am new to Contract testing. I have a question regarding CI/CD integration of PACT. I was going through with below attached chart and as mentioned in Consumers pipeline , producer's pipeline will also get triggered to validate the contract . So It seems total time of consumer pipeline will get increase by producer pipeline time. Is there any other way to integrate it without increasing pipeline running time?

brendan.donegan
2021-02-19 09:49
Do you use pull requests in your development process?

brian.pfretzschner
2021-02-19 10:15
has joined #general

wesleythomaswilliams
2021-02-19 10:45
We're getting to the point where we're going to fully integrate our flow so that consumer builds trigger provider builds and my initial thought on how to handle this would be to pass a build parameter into the provider build that skips everything apart from the pact test and publishing of results to the pact broker. That seems sensible to me, but I'm happy for someone to tell me how crazy that is. :smile:

brendan.donegan
2021-02-19 10:46
depends which CI system you?re using

brendan.donegan
2021-02-19 10:47
we use Jenkins and our model is to have a separate job which runs the Pact tests

brendan.donegan
2021-02-19 10:47
Then you simply call that job from the provider pipeline

brendan.donegan
2021-02-19 10:47
I would assume most other CI systems can use a similar idea

arpit.modani
2021-02-19 16:41
@brendan.donegan We are using here Gitlab. > our model is to have a separate job which runs the Pact tests If Pact test runner would be on separate job then how can we make it part of every deployment process as it would not be part of deployment pipeline .

arpit.modani
2021-02-19 16:44
@wesleythomaswilliams Your idea looks interesting but I have a doubt, still producer pipeline will run those Pact test so this time would be added into consumer pipeline time as we can't get a green pipeline until producer successfully verified the tests.

wesleythomaswilliams
2021-02-19 16:46
If you want to fully integrate pact I don't think there's away around your pipelines taking longer to run. That provider verification is always going to come with a cost in time. It's really just about minimising it I think.

brendan.donegan
2021-02-19 16:47
@arpit.modani as i mentioned already, Jenkins pipelines can call other jobs and use the result

brendan.donegan
2021-02-19 16:48
i don?t know if Gitlab can do that

arpit.modani
2021-02-19 16:49
Yes , I am also thinking in direction to optimise it . Let's say there are multiple producers , we need to trigger pipeline for every producer in parallel.

brendan.donegan
2021-02-19 16:53
your consumer pipeline should never be directly triggering the provider verification

brendan.donegan
2021-02-19 16:53
this should be done by webhooks

brendan.donegan
2021-02-19 16:54
specifically the contract-content-changed webhook

brendan.donegan
2021-02-19 16:54
that will ensure that all appropriate provider verifications get run

wesleythomaswilliams
2021-02-19 16:57
Although there are reasons why you might not be able to use webhooks. Until recently my org had security restrictions that prevented webhooks being used to trigger jenkins builds.

antonello
2021-02-19 16:58
The webhooks approach is one approach. But not the only one.

antonello
2021-02-19 16:58
I have spoken about what we do at Treatwell in my interview during the pact community event last year.

antonello
2021-02-19 17:00
I will dig it out. That said, if you invoke provider builds directly without some kind of middle man, you will end up running provider tests unnecessarily most of the time. The webhook can be set-up to be triggered only when pact content changes, which in most cases would be infrequently.

antonello
2021-02-19 17:01
We don?t use webhooks and we run provider tests in the pipeline of the consumer.

antonello
2021-02-19 17:03
I don?t go in a huge amount of details, but I?ve explained it here: https://youtu.be/wkld_wRsTDE?t=4405

brendan.donegan
2021-02-19 17:14
i will take some time to watch if, but in terms of why you chose to do it that way, was it because you couldn?t trigger the webooks on your internal CI from Pact flow?

antonello
2021-02-19 17:16
No, it was because we wanted the consumers to be fully in control, have the best possible flow and prevent provider failures after merges of feature branches of the consumers. Now some of that stuff is made easier by the pending pacts features, but our approach works well for us.

bheemreddy181
2021-02-19 17:41
this is what we are doing right now

wesleythomaswilliams
2021-02-19 17:45
One thing I am curious about, what is the best way to pause your consumer build pipeline while you wait for the provider verification to occur and the results to be posted by the provider build?

bheemreddy181
2021-02-19 17:46
that is where pending status above comes in , we can also do that with can-i-deploy tool

bheemreddy181
2021-02-19 17:47
pending status is sent using pact broker webhooks

arpit.modani
2021-02-19 17:48
does pact broker communicate with producer and consumers via webhooks here ?

bheemreddy181
2021-02-19 17:48
yes

matt.fellows
2021-02-20 00:11
yeah, can-i-deploy can poll

matt.fellows
2021-02-20 00:11
personally, I don?t like it that way. I like my Consumer build to be separate from my provider build and not have either depend on another build

matt.fellows
2021-02-20 00:11
yes, webhooks can trigger one, but that?s as far as I want it to go

matt.fellows
2021-02-20 00:11
I don?t have my consumer build blocking, waiting on my provider build

matt.fellows
2021-02-20 00:12
see the CI/CD workshop in howtolearn for our ?standard? guidance, taking into account the very interesting discussions here also

2021-02-20 00:12
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

matt.fellows
2021-02-20 00:13
Consider this case. Consumer A -> Provider B -> Provider C (aka Provider B is also a consumer). How do you set this flow up with the webhooks? Personally, I think it?s a recipe for confusion and build entanglement

arpit.modani
2021-02-20 05:44
@matt.fellows > I don?t have my consumer build blocking, waiting on my provider build But consumer builds result should depend on provider test validations , Right? As if provider fails the validation , consumer pipeline would also be failed / consumer build would not be ready for production deployment. How do you manage this?

matt.fellows
2021-02-20 09:43
Yes that's correct

matt.fellows
2021-02-20 09:44
See the workshop above, it describes the feature pact workflow that most people should use

matt.fellows
2021-02-20 09:44
Also the effective pact setup guide

tjones
2021-02-20 12:08
The question answered by can-i-deploy is ?is this consumer able to communicate with this provider?. Depending on how your deployment ecosystem works, this might be useful to you on feature branches

chitra.adikesavan
2021-02-20 15:50
has joined #general

tjones
2021-02-21 03:26
Interesting question. If you?re planning to have them deployed at the same time, you might need two pacts, or to be super careful with your versioning / pact tags

2021-02-21 04:00
A new post has been created in *Feature Requests*

bheemreddy181
2021-02-21 19:36
why not make consumer build wait until provider build is successful , i don't think it will end up in a circular dependency with this combo ( Consumer A -> Provider B -> Provider C (aka Provider B is also a consumer) ) where consumer A will not run builds for Provider B and Provider C ( aka because of Consumer B ) , there is a possibility that Consumer A wait for Provider B and Provider C and D given it has to satisfy contracts for all and i want to wait before i merge or deploy

matt.fellows
2021-02-22 00:22
Oh, I mean you totally can, but it?s just not necessary. If you have your feature builds setup right, this level of intricacy is unnecessary

matt.fellows
2021-02-22 00:23
this is just my opinion, and as you?ve seen, there are many ways to get there.

ankita.soni
2021-02-22 07:26
has joined #general

jacek.helper
2021-02-22 08:03
has joined #general

sagupta
2021-02-22 14:53
Hey team , I have a question about provider CI workflow when provider needs to make a breaking change i.e. rename an existing property in response . Based on my understanding, The overall process would look like this 1. Consumer creates a feature branch and adds the new expectation from provider (new property name). Consumer pushes this change and publish contract. 2. Contract content changed webhook will trigger provider verification webhook job which will correctly fail as provider has not changed the property name 3. Provider makes changes on feature-branch . Test locally the verification against the feature-branch tag of new feature by consumer. Pushes the change to master . 4. Now master build will verify against the stable version of pact for consumer (which expects old property ) and will fail in this case. Is this expected ? How should we go about this ? When i read the docs , the above scenario is explained by giving example for adding a new property in provider response but not changing the existing property name.

bheemreddy181
2021-02-22 15:23
Ah makes sense

seanw122
2021-02-22 15:36
has joined #general

akennedy
2021-02-22 15:54
has joined #general

esimpson
2021-02-22 16:42
has joined #general

dagrawal
2021-02-22 17:24
has joined #general

venkata.pro
2021-02-22 21:47
has joined #general

matt.fellows
2021-02-22 22:50
if you read the ci/cd workshop in howtolearn, you?ll see the way to verify ?feature pacts? is to use the pending pacts feature

2021-02-22 22:50
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

2021-02-23 00:28
A new post has been created in *Feature Requests*

bethskurrie
2021-02-23 05:16
> but not changing the existing property name. You can only do this in a backwards compatible way by adding the new name in parallel to the old name, deploying that then switching the consumer over to the new name.

vittorio.guerriero
2021-02-23 08:23
Hi, I have a question about the provider verify process. 1. The consumer introduce a new contract and they publish it with a specific tag = 'DEV' 2. The provider listen for new contract published and the verification fails 3. The provider, before honouring the new contract creates a PR to do some refactoring 4 . During the Pull request it will run all the contracts without specifying any tags. this process will fail because there are some contracts that are not satisfied yet 5. The provider will still run `can I deploy` for consumer tag 'PROD' before deploying to avoid breaking any existing contracts Can I use enablePending in order to allow t he provider to continue other work? Is this the correct way to handle contracts that are not compatible yet?

tjones
2021-02-23 08:24
Yes, that?s right

vittorio.guerriero
2021-02-23 08:24
WOW

tjones
2021-02-23 08:24
The use case you?re describing is exactly what enablePending is for

vittorio.guerriero
2021-02-23 08:24
amazing!!!

tjones
2021-02-23 08:24
We think so too!

vittorio.guerriero
2021-02-23 08:44
And, After I've deployed the changes on the provider side shall I run ALL the contract tests (without any tags) with the provider tags = 'prod'? Will enablePending prevent tagging contracts that are not compatibile?

vittorio.guerriero
2021-02-23 08:49
```{ consumerVersionTags: [], pactBrokerUrl: '{url}', pactBrokerToken: process.env.PACT_BROKER_TOKEN, provider: '{providerName}', enablePending: true, providerVersion: process.env.CI_COMMIT_SHA, providerVersionTags: [gitBranch, 'prod'], providerBaseUrl: 'http://localhost:3000/dev', publishVerificationResult: true }```

vittorio.guerriero
2021-02-23 08:50
@tjones I think I need to tag all the contracts with PROD on the Provider side because otherwise the consumer will not be able to run can-i-deploy. The contract is verified but it's not tagged as prod on the provider side yet.

bethskurrie
2021-02-23 08:59
Tagging is completely distinct from the success/failure of the verification results.

vittorio.guerriero
2021-02-23 09:05
Thanks Beth, just to clarify, If I run the verifier with the providerVersionTags = ['prod'] and enablePending: true will the 'pending' contracts/provider matrix contain the prod tag?

bethskurrie
2021-02-23 09:05
ok, now I'm reading your question again.

bethskurrie
2021-02-23 09:06
no

bethskurrie
2021-02-23 09:06
no you should not tag with prod

bethskurrie
2021-02-23 09:06
you only tag with prod when you deploy to prod.

vittorio.guerriero
2021-02-23 09:07
mmmm.. Yes, sorry, I meant to run the verifier with the Provider tagging after is deployed.

bethskurrie
2021-02-23 09:07
that can't be the prod version, because it's not yet deployed

bethskurrie
2021-02-23 09:07
that's unusual. tell me more about your usecase.

vittorio.guerriero
2021-02-23 09:07
Okay, there are not existing contracts.. project is new

bethskurrie
2021-02-23 09:07
btw, once a version is published to the broker and tagged with prod, it's always tagged with prod.

vittorio.guerriero
2021-02-23 09:08
1. The consumer publish a new contract with the tag 'DEV' 2. THe provider listen for the new published contract 3. The proviuder will verify alll the contract (only one) and it will fail

vittorio.guerriero
2021-02-23 09:08
4. The provider decide to honour the new contract

vittorio.guerriero
2021-02-23 09:09
5. The provider open a PR, runs the verification and the consumer contract is verified and passing... no tags here

bethskurrie
2021-02-23 09:09
Why no tags there?

bethskurrie
2021-02-23 09:09
tag with the branch

vittorio.guerriero
2021-02-23 09:09
I am not sure why I need them at this point...

vittorio.guerriero
2021-02-23 09:09
ah yes... good point

vittorio.guerriero
2021-02-23 09:10
I tag the provider with the branch name!

bethskurrie
2021-02-23 09:10
that's the golden rule (though I'm makign that redundant soon, because I'm adding explict branch support).

bethskurrie
2021-02-23 09:10
tag with the branch when you publish, tag with the environment name when you deploy

bethskurrie
2021-02-23 09:10
do those two things, and I think you'll find your way out of your dilemma.

vittorio.guerriero
2021-02-23 09:10
6. The provider check if they can deploy. They can deploy because there are not consumer contracts tagged with 'PROD'

vittorio.guerriero
2021-02-23 09:11
7. After is deployed the provider will tag with 'PROD. My question here is, Do I have to use consumer `consumerVersionTags` or not.. When would you use it?

bethskurrie
2021-02-23 09:12
When you tag the provider version?


bethskurrie
2021-02-23 09:13
Also, have you read the page on tagging? https://docs.pact.io/pact_broker/tags

vittorio.guerriero
2021-02-23 09:14
I will go through the guidelines again. Our current Consumers only tags with PROD after they deployed

vittorio.guerriero
2021-02-23 09:14
thanks.

bethskurrie
2021-02-23 09:14
Only tag with prod when you deploy, not when you verify

bethskurrie
2021-02-23 09:15
The consumerVersionTags are replaced by consumerVersionSelectors. They are used to tell the provider which pacts to verify when you're running the Ci/CD pipeline for the provider.

bethskurrie
2021-02-23 09:15
Here is the docs for how to configure that https://docs.pact.io/provider/recommended_configuration

bethskurrie
2021-02-23 09:15
I do really recommend the workshop. It will make much more sense when you've seen it done.

vittorio.guerriero
2021-02-23 09:17
Thanks!!

vittorio.guerriero
2021-02-23 12:22
Nice, I've also found out about `includeWipPactsSince`

2021-02-23 14:26
A new post has been created in *Feature Requests*

jordan.levin
2021-02-23 19:13
has joined #general

jordan.levin
2021-02-23 19:17
Hi Pact team, I have a question regarding AsyncAPI contract validation. My team is currently using swagger-mock-validator to perform type-diff between the Pact Contract and Swagger OpenAPI specification. This is working great, but our providers/consumers also communicate via asynchronous Kafka messages, which we have written Pact Message contracts (AsyncAPI) for. The problem is that swagger-mock-validator currently only has support for performing the validation on OpenAPI specifications. Ideally we want to be able to perform a simple `diff` between the property types defined in the AsyncAPI specification and the Pact message contract. Has anyone dealt with this problem before or know a good approach to take? I've tried making a contribution to the swagger-mock-validator project but it looks like they rely on third-party NPM libraries to perform the validation. I've also heard that there might be a way to convert the AsyncAPI specification/pact contract to OpenAPI? Has anyone had any experience with this? Any help or advice would be greatly appreciated. Thanks!

tjones
2021-02-24 00:24
I keep planning to write a blog post about this, but there are some subtle but important differences between OpenAPI and a Pact contract. A spec describes the kinds of possible responses (usually much wider than what is actually produced or intended), but doesn?t provide request/response pairs or behaviour. A Pact contract is the other way around - it gives example request response pairs, and some rules around them, but it doesn?t describe all possible responses. For this reason, it?s hard to convert one to the other in a straight forward manner.

tjones
2021-02-24 00:25
I think most teams doing OpenAPI specs are aware of this deficiency, even if not explicitly - because it?s common for an OpenAPI spec to be paired with a Postman collection which does have example request/response pairs. I think a tool to convert between Pact and Postman would be amazing.

tjones
2021-02-24 00:29
As an aside, it sounds like from your question you might be doing swagger validation in place of real provider validation. I wouldn?t recommend this.


tjones
2021-02-24 00:31
(that last link summarises the reasons I would recommend against doing swagger validation in place of provider validation)

tjones
2021-02-24 00:32
Spec-based validation is definitely better than nothing if you?re not able to do contract-based validation, of course. The other day, I was advocating for a `maybe` result from `can-i-deploy` to better describe validations submitted from specs.

tjones
2021-02-24 00:41
If you haven?t read them already @matt.fellows wrote an excellent series of posts about schema testing in the pact ecosystem: https://pactflow.io/blog/contract-testing-using-json-schemas-and-open-api-part-1/

francesco.latorre
2021-02-24 05:59
has joined #general

aniket.g2185
2021-02-24 09:13
has joined #general

sundaresank360
2021-02-24 12:12
has joined #general

jhawthor
2021-02-24 15:18
has joined #general

jordan.levin
2021-02-24 15:24
Hi Tim, thank you for your detailed response, for now we are just using schema validation, however I will bring up these good points you made to my team. In the meantime, however I think I didn?t describe my question clearly enough. We are successfully using openAPI schema validation right now, using swagger-mock-validator. Our question is whether or not there are any tools/starting points we could use to implement Async API schema validation against a pact message contract.

chris.r.thomas
2021-02-24 16:54
has joined #general

peter.cook
2021-02-24 17:05
has joined #general

jayeshguru81
2021-02-24 18:34
has joined #general

ben.kirberger
2021-02-24 19:16
has joined #general


matt.fellows
2021-02-24 22:14
We?re currently integrating a similar approach into Pactflow, but AsyncAPI has not yet been looked into. I?m not aware of tools that can do this comparison yet, so it might need to be modified or a custom tool to do it

jordan.levin
2021-02-24 22:14
Hi Matt, yes that is me.

matt.fellows
2021-02-24 22:14
:slightly_smiling_face:

matt.fellows
2021-02-24 22:14
(brb sorry, meeting!)

jordan.levin
2021-02-24 22:19
That was my conclusion as well...I tried modifying swagger-mock-validator, but I ended up having to modify code from the dependencies that it was using and ended up getting stuck with that error in the issue. We also have 2 other engineers working on a custom Golang AsyncAPI validator but it isn?t trivial :sweat_smile:

tjones
2021-02-24 22:20
^ We had the same experience. I wanted to accompany the issue that I raised with a PR, but it?s not a simple problem.

jordan.levin
2021-02-24 22:20
No worries, I apreciate the help! Glad to know that your team has a similar conclusion in this area

m.stephkan
2021-02-25 05:30
has joined #general

stephen.tjasink
2021-02-25 08:23
has joined #general

philipchardwick
2021-02-25 12:42
Hey, has anyone ever created a flow chart explaining how to diagnose why can-i-deploy is failing? I guess it may be that everyone's set up is so different that a singular "way" to investigate wouldn't be appropriate. But seeing how other people tackle it/think about it might help me put it in clearer terms. I think I need something like this to help the engineers get started with pending pacts and the recent changes. When I make my own I'll try make it generic and share it back here if possible.

brendan.donegan
2021-02-25 13:44
shouldn?t it be as simple as inputting the versions/tags into ?the matrix? and finding out what the status of the verification is?

brendan.donegan
2021-02-25 13:45
either ran and passed, ran and failed, or never ran

brendan.donegan
2021-02-25 13:45
or the 4th possibility, the tag or version doesn?t actually exist

irldev
2021-02-25 13:54
Hello, I have a bit of a general/stupid question, apologies in advance. When we create our contract on the consumer side, we have to create tests at the same time otherwise the contract won't generate. My question is why do we need to create tests on the consumer side when creating the contract and what are those consumer tests supposed to be verifying/testing? :blush:

philipchardwick
2021-02-25 13:54
:thumbsup: that's helpful, thanks!

wesleythomaswilliams
2021-02-25 14:25
Sensible question. The example from our tests is in Java, but loosely looks like: ``` @ExtendWith(PactConsumerTestExt.class) @PactTestFor(providerName = "provider", providerType = ProviderType.ASYNCH) public class MyServiceConsumerPactTest { @BeforeEach void beforeEach() throws Exception { #Using the product code, create the message object (DTO) that the contract should adhere to providerMessageStringFromDto = objectMapper.writeValueAsString(providerMessageDto); } //Create the contract @Pact(provider = "provider", consumer = "myservice") public MessagePact providerMessage(MessagePactBuilder builder) { final DslPart body = new PactDslJsonBody() #Create the message body that forms the contract using pact matchers (e.g. stringType etc) .closeObject(); return builder .expectsToReceive("a provider update") .withContent(body) .toPact(); } //Validate the contract @Test @PactTestFor(pactMethod = "providerMessage") public void testProviderMessage(MessagePact pact) throws JSONException { //Get the message component of the contract final String messageFromPact = pact.getMessages().get(0).contentsAsString(); //Assert the message string against a string built from our DTO //Note: the string replace is required to workaround an issue with instant truncation JSONAssert.assertEquals(messageFromPact, providerMessageStringFromDto, false); } }``` So we're using our product code to validate the outline of our contract, thus ensuring that if something changes in the product code on the consumer side, this assertion will fail. Originally we just used json files for the comparison to get us started, but obviously they can easily drift out of sync with the product code, so we're changing that to the design above, which is similar whether we're testing REST or Message Pacts. Hope that makes sense?


francislainy.campos
2021-02-25 15:29
I understand the tests on the contract to validate whether the contract itself was created properly. Whereas the tests on the provider side validate the api request.

ben.kirberger
2021-02-25 15:59
:wave: :wave: :wave: Hey team! I?ve been digging at pact/pactflow documentation and examples, and I?m having trouble determining if contract testing is for our team or not. For our tech stack, we?re a largely nodeJS shop, but we are using Apollo federated GraphQL to drive most of our apis and our UI, in conjunction with Apache Kafka. Mikro-ORM and postgres for our data layer. Wondering if you have any examples for something like this, or if you have any thoughts. Also, the frontend team doesn?t see the value yet, but I really feel like there could be some? Any advice would be much appreciated!

ben.kirberger
2021-02-25 16:16
More details: I was ripping graphQL mutations from our UI via Chrome Dev Tools. My initial thinking there would be that I could write a contract test against the sending of that full payload. But I am more concerned about the provider changing than the consumer. The UI has a boatload of cypress tests and feels confident in our Typescript, Graphql world, we are fairly type safe, and they (the ui team) say they couldn?t break the schema if they wanted to / their payload ?won?t really change?? (in this case, I am on one of the teams that contributes to our GraphQL schemas, and we?re rewriting an API that did this before, so I?m wanting to make sure we?re at parity for the UI and other GQL consumers)

phil.endsley
2021-02-25 16:18
As far as value goes, have you seen the Convince Me page in the docs? https://docs.pact.io/faq/convinceme/ I frequently referenced this when trying to get buy in from my team when first implementing it.

phil.endsley
2021-02-25 16:19
Equally important is giving this a read too: https://docs.pact.io/faq/#what-is-pact-not-good-for

ben.kirberger
2021-02-25 16:45
Thanks Phil, I think I?ve seen both of those, but will give another read in case I missed something. Ultimately, I?m having trouble finding any examples online of contract testing in an Apollo GraphQL / Kafka world.

phil.endsley
2021-02-25 16:47
Oops, I didn't see your initial reply. Didn't realize you were looking for value specifically for those technologies

wesleythomaswilliams
2021-02-25 17:14
We don't do anything with GraphQL or Apollo, but we do use contract testing for all of our microservices that communicate via kafka.

ben.kirberger
2021-02-25 17:45
Cool @wesleythomaswilliams, do you know of any example articles / guides / repos that may help for testing Kafka? I do still seek some advice on the Apollo federation front, if anyone has that, too?

beatrizwaclawek
2021-02-25 20:27
has joined #general

zhoutianli1234
2021-02-25 21:09
has joined #general

matt.fellows
2021-02-25 22:52
There are some kafka examples here: https://docs.pactflow.io/docs/examples

matt.fellows
2021-02-25 22:53
Here is the ?how pact works? for non-http (called message pact): https://docs.pact.io/getting_started/how_pact_works#non-http-testing-message-pact

matt.fellows
2021-02-25 22:54
See also https://github.com/pactflow/roadmap/issues/4. We?d like to extend this model to GraphQL endpoints, especially federated ones which are mostly pass through

matt.fellows
2021-02-25 22:55
but you can do GraphQL with pact. There is also a #graphql channel, there may be some history on doing it with Apollo Federation

ben.kirberger
2021-02-25 23:00
Hmmm, yeah that?s the tricky part. Seems like a many<=>many problem with providers and consumers.

ben.kirberger
2021-02-25 23:01
Lots of apis contributing to the federated endpoint, so I see that as lots of providers?. And consumers, of course.

ben.kirberger
2021-02-25 23:02
Just trying to figure out where / how I would draw my integration lines there, but it seems it might be counterintuitive to try to contract test?

ben.kirberger
2021-02-25 23:03
I will definitely hit up all of those links ? I believe I?d seen the examples already but I will look again in case there was something I missed.

abubics
2021-02-25 23:50
hopefully that's all :pray: easier to diagnose than some other issues that vary per platform/language

abubics
2021-02-25 23:53
Another perspective: the contract is a side-effect (output) of the consumer tests. Writing the Pact description in code somewhere, without exercising it won't prove that the consumer is calling the API as expected. Likewise, not verifying it on the provider won't prove that it handles each interaction correctly..

abubics
2021-02-26 00:14
In case it hasn't come up in any of the docs you've read, a contract that describes interactions (with varying state) can provide more specific reasoning ability than a schema alone. So, depending where you cut the boundaries of a contract test, and how response shapes change in different states, you can get more useful, granular tests.

ben.kirberger
2021-02-26 01:08
I don?t know that I?ve seen it put like that. Excellent explanation, @abubics

abubics
2021-02-26 01:15
There's a whole discussion thread about schema vs contract from yesterday, if you want more detail ^_^ I'll find you the link in a sec

ben.kirberger
2021-02-26 01:16
Ah, thank you!

abubics
2021-02-26 01:17
Not every post in https://pact-foundation.slack.com/archives/C9VBGLUM9/p1614191329060800 may be relevant, but have a skim, see what you get :slightly_smiling_face:

travis.day
2021-02-26 04:06
has joined #general

andrew.cunningham
2021-02-26 11:13
has joined #general

jayeshguru81
2021-02-26 14:52
Sorry for cross posting as this issue may not be necessarily just related `jest-pact`

brianmasschaele
2021-02-27 13:27
has joined #general

pedroefajardo_pactio
2021-02-27 17:18
has joined #general

pedroefajardo_pactio
2021-02-27 17:21
TL;DR - Establishing Pact, creating Consumer Pacts on Providers that already exist. Good morning y?all. Reading the http://Pact.io documentation, it sounds like in an ideal situation the consumer writes the consumer tests using a provider mock. This I understand is because the Consumer is defining what the Provider should implement. The Provider feature does not exist yet. In some cases the providers already exist and that we are tasked to add Pact testing on these. Writing a mock that replies with complex and different payloads depending on all the different APIs and variations of query parameters seems like unnecessary work given the provider already exists. The questions I have is: Is it good process to create Pacts against the live server (running on my machine)? And if so how is it different than creating the consumer Pacts using a mock Provider? How to make the Pact mock talk to the actual provider other than setting the same port? Are there any gotchas I should look for when doing this?

brendan.donegan
2021-02-27 18:02
Hi @pedroefajardo_pactio. I think you?re misunderstanding how Pact works. The purpose of the mock server is nothing to do with the provider existing or not existing at the time. The mock server is used during the consumer tests to receive the requests and return the responses specified, and then record the contract based on this. It?s neither good practice, or even possible to write the consumer tests to run against the real provider.

brendan.donegan
2021-02-27 18:02
Once the contracts are created on the consumer side they can be replayed against the real provider using the providers testing framework to ensure the provider conforms to that contract.

pedroefajardo_pactio
2021-02-27 18:08
I think you are correct, I do not understand how Pact works. :slightly_smiling_face: I think it is better for me to start from my current understanding, step by step. All the tutorials I?ve read/seen show one creating a Pact object, as far as I understand, configured to monitor/intercept a call with the same path to the mock provider that the test makes. Is that ^^^^ correct?

pedroefajardo_pactio
2021-02-27 18:11
I guess the question boils down to: How do I create the Pact files w/o having to mock complex and existing providers. but you?re right, *I do not understand how Pact works.*

pedroefajardo_pactio
2021-02-27 18:19
I know there is a gap in how to implement Pact. I should have started by asking questions and stating my assumptions.

pedroefajardo_pactio
2021-02-27 18:25
I think the Pact object is a mock itself. I don?t know how to link the path used in the Pact mock and the call to a Provider (another mock in all the tutorials I?ve seen). Especially when the provider under test requires specially configured headers.

brendan.donegan
2021-02-27 18:47
It can be helpful to work through an end-to-end example, have you done that yet?

pedroefajardo_pactio
2021-02-27 18:54
I have done. Taking a course through Udemy and also did an exercise from another web site. The exercises all run great, they all use mock providers. I haven?t seen one that explains the relationship between the configuration of the Pact object, path, port, etc. and the call to the mocked provider. Maybe I should go back and read http://Pact.io?s documentation more carefully

pedroefajardo_pactio
2021-02-27 18:57
again, it really is a gap in my understanding. I am trying to close that gap by asking questions. Since I have made some incorrect assumptions now I need to figure out what questions to ask. :slightly_smiling_face:

pedroefajardo_pactio
2021-02-27 19:07
I think this https://github.com/pact-foundation/pact-provider-verifier#api-with-provider-states add some clarity into what my question is: How do I set up state in the provider?

brendan.donegan
2021-02-28 10:10
Just checking you?ve been through this as well? https://pactflow.io/how-pact-works/?utm_source=ossdocs&utm_campaign=getting_started#slide-1, i guess you probably have?

pedroefajardo_pactio
2021-02-28 19:37
looking at it now. thank you


tjones
2021-02-28 22:55
These diagrams also show the parts that are part of pact vs your real code

tjones
2021-02-28 22:56
the reason we use a mock provider is so that you can write your contracts without spinning up the real provider

tjones
2021-02-28 22:56
then later the contract can be verified against the real provider

tjones
2021-02-28 22:57
During verification, the expectations you set in the contract are replayed against the real provider, and pact checks to make sure the real provider behaved like the mock you set up this is a lighter weight way of ensuring that the consumer and provider can speak to each other

tjones
2021-02-28 22:57
Note that each interaction is independent

tjones
2021-02-28 22:57
this is important because it stops the mock from becoming too complex

tjones
2021-02-28 23:00
ie, you would say: ```When a create user request is sent, it looks like X A successful create user response is received, and it looks like Y``` and ```In the state where user X exists When a get user X request is sent, it looks like Z A successful describe user response is sent, and it looks like W``` ^ In this way, your mock is only mocking individual interactions, and doesn?t need to know how the internal system works or persist anything.


pedroefajardo_pactio
2021-02-28 23:41
oh man. lots of info. Will make time to parse. thank you

tjones
2021-02-28 23:45
Welcome! Let us know if you have more questions

bethskurrie
2021-03-01 00:23
People who work on mobile clients and client libraries that have multiple supported versions at a time, your thoughts on this potential new feature would be appreciated https://github.com/pact-foundation/pact_broker/discussions/398

dominic_herrmann
2021-03-01 06:54
has joined #general

thanuxxxx
2021-03-01 19:32
Hi all, I have a general question about running pact tests. 1. We have configured our pipeline to run our unit test, integration tests and cypress tests (if applicable) for every PR we make. 2. If everything goes well, then we merge to master. 3. After that, we deploy master branch to a dev environment 4. latest tagged commit of master will go to prod Where/when should I run my pact tests? ? Can I run during every PR or run during the deploy to a dev env. What is the best practice?

irldev
2021-03-01 19:40
Is there a list of bugs/work to be done for pact? Am thinking about getting involved :)

elliottmurray
2021-03-01 19:41
So most repos have issues including starter ones. What is your background?

irldev
2021-03-01 19:53
Mostly Java test automation but recently started learning typescript and C#

elliottmurray
2021-03-01 19:55
So the first two have strong support but always need more help. I know that pact net needs some love though so that would be most impactful imo

matt.fellows
2021-03-01 21:54
We try to mark the issues as ?good first issue? and ?help wanted?, so a good starting point would be to head to the language repo(s) you want to help out and look for those

matt.fellows
2021-03-01 21:54
As Elliot said, we?re looking for more .NET contributions so if that?s something you?re interested in, that?d be great

ben.kirberger
2021-03-01 23:00
Trying to go back through the CI/CD setup tutorial for the Kafka examples, I am having a problem on the following page: https://docs.pactflow.io/docs/workshops/ci-cd/set-up-ci/configure-consumer-and-provider-pipelines It states: > Back to the consumerhttps://docs.pactflow.io/docs/workshops/ci-cd/set-up-ci/configure-consumer-and-provider-pipelines#back-to-the-consumer > :white_check_mark: If you would like to see all your builds go green, you can re-trigger the consumer build by selecting ?More options? > ?Trigger build? > ?Trigger custom build?. However, I am unable to get the consumer to go green. When I build the consumer pipeline in TravisCI the second time (after provider ran and successfully verified the master build), it gives the following in logs: ```Tagged version 526145aa063bc49469221f8edcd8a7374dca7bf8 of pactflow-example-consumer-js-kafka as "master" Publishing pactflow-example-consumer-js-kafka/pactflow-example-provider-java-kafka pact to pact broker at https://funemployed.pactflow.io A pact for this consumer version is already published. Overwriting. (Note: Overwriting pacts is not recommended as it can lead to race conditions. Best practice is to provide a unique consumer version number for each publication. For more information, see https://docs.pact.io/versioning)``` Why does it overwrite? Later in the logs: ```There is no verified pact between version 526145aa063bc49469221f8edcd8a7374dca7bf8 of pactflow-example-consumer-js-kafka and the latest version of pactflow-example-provider-java-kafka with tag prod (no such version exists)``` ?which tells me it?s looking for the Prod tag, but when I look over in pactflow, both consumer and provider only have the tag of ?master?. Did I miss something?

ryanlevell
2021-03-02 01:54
Yes, for every PR (the same time you run unit tests). During deployments you are just checking the verification results of past tests via the Pact Broker CLI ?can-i-deploy? (if you are using a Pact Broker). You do not need to run the tests again for deployments.

matthew.long
2021-03-02 14:08
has joined #general

thanuxxxx
2021-03-02 15:32
But is that okay to publish contracts to broker every time we make PR? isn't it overkill?

ryanlevell
2021-03-02 15:41
No it?s not overkill. Yes, publish every time. The contract may not have changed but the contract version (git sha) has changed. If the contract is the same, the Broker is smart enough to know nothing has changed and will auto-update verification results for all versions in the matrix. Uploading the contract has very little overhead and the Broker expects it each time, so it is not a problem.

ryanlevell
2021-03-02 15:43
Our process is the same way. Our PRs trigger a Jenkins job that then runs the tests/publishes the contract.

thanuxxxx
2021-03-02 15:54
I am working on Jenkins pipeline for Pacts. It really helps me a lot. Thank you

ben.kirberger
2021-03-02 16:30
Update on this: Running `make fake_ci` from the provider kafka repo solved the missing `prod` tag problem. Not sure why it?s failing to do that in actual Travis CI?

tmoncm
2021-03-02 17:17
has joined #general

phoenixcampos01
2021-03-02 21:25
has joined #general

matt.fellows
2021-03-03 00:34
Hi Ben, let me take a look

matt.fellows
2021-03-03 00:35
I?m (happily) surprised you worked out how to get them working together. It is supposed to work that way, but they probably aren?t perfectly document

abdul.hussain
2021-03-03 01:12
I've recently become interested in pact as a contract testing framework for my frontend and backend. My CI process uses bitbucket pipelines. I've read through the docs with my understanding summed up by the following diagram in the docs. Could you guys please validate my understanding within my workflow: 1. Frontend consumer publishes pact. 2. Pact broker handles content_changed webhooks which triggers the backend provider verification through a bitbucket pipeline 3. Frontend consumers runs can I deploy with --retry-while-unknown parameter, on success the front end consumer deploys with a tag and version for the deployment in the pact broker 4. When backend provider pact verification is triggered from the frontend, on failure the consumer can I deploy job fails, on success the consumer deploys. 5. On any amendments to the backend pact backend the contract tests are run against the frontend tags i.e. dev, preprod and prod in the broker, on success can I deploy is run with the new version and provider environment, if this is successful the provider is deployed and a version tag is created for the provider in the broker with the provider environment tag.

abdul.hussain
2021-03-03 01:13
You guys think I'm missing anything?

bethskurrie
2021-03-03 02:38
Yes, that sounds right @abdul.hussain

abdul.hussain
2021-03-03 08:28
cool thanks

hugh.paul.mcgowan
2021-03-03 17:52
has joined #general

laxmi.somni508
2021-03-03 20:04
Dear All, This is a Test Documentation related query. We want to document High level test scenarios for Pact Contract testing in Test Scenario management tool . I could think of following high level scenario per Micro-service: 1. Validate that FE Consumer is able to generate the PACT file successfully & hand it over to Pact broker 2. Validate that BE Provider is able to verify the PACT file 3. Result is being updated on PACT Broker UI Kindly let me know if above is sufficient or there's anything else to cover from testing perspective. Also, it will be a great help if you have any sample Test Scenario / Test Case document for Pact testing documentation, that you could share. Many thanks [P.S::round_pushpin: If I send you a message outside your usual working hours, please do not feel that you need to respond immediately.:pray:]

abubics
2021-03-04 00:19
This workflow sounds fine, but I don't really understand what your situation is . . . you want to verify that the pact bits are actually being run during your CI pipeline?

abubics
2021-03-04 00:20
Little aside: if the contract hasn't changed, I don't think you'll see an update in the Pact broker UI. It doesn't necessarily change in every commit.

laxmi.somni508
2021-03-04 10:17
Yes. That's correct. The PACT broker will highlight only when there's disagreement between Consumer(s) and the Provider.

laxmi.somni508
2021-03-04 10:19
We are thinking to write Test case document (manual) to summarise : ? (A) what PACT tests are actually testing ? (B) To test the PACT set-up itself. In order to ensure that PACT mechanism is working correctly. I think, Its more of test process related documentation work to be documented in central Test cases documentation system, as part of implementing PACT. So please let me know if you have any sample / example of such test cases. Also kindly advise if writing tests on (A) will it be justifiable effort/ too exhaustive? Thanks

normanrs
2021-03-04 11:18
has joined #general

abubics
2021-03-04 12:46
I don't usually write tests to verify other tests . . . and if you're writing documentation to tell people how to check that things are set up properly, there's a risk they'll be stale quickly.

abubics
2021-03-04 12:47
Maybe it'd be easier to ask other clarifying questions like ? when do you expect to run these tests? ? what decisions/actions are you going to take when you get results?

thanuxxxx
2021-03-04 15:19
Hi all, I am referring this doc from http://pact.io https://docs.pact.io/pact_nirvana/step_4/#e-configure-pact-to-be-verified-when-contract-changes I completed A, B, C, and D, and I am confused what this E instructions says, Can anyone give an idea how to proceed with E? ? Consumer is a React project ? Provider is a SpringBoot ```Create a new CI job that performs just the provider pact verification step for a given pact URL. Consult the documentation for your chosen language for the syntax of how to configure this - you can find an example here. The job should accept the URL of the changed pact in the HTTP request parameters or body. You can find a library of webhooks that trigger a build in many popular CI systems here, otherwise you'll need to consult the documentation for your CI application to learn how to pass in parameters to a build```

laxmi.somni508
2021-03-04 15:53
Thanks a lot for your response. ? when do you expect to run these tests? --> We haven't finalised about it, but I guess similar to any other Automated tests run it will be on any major change/ on demand basis / periodically (overnight) ? what decisions/actions are you going to take when you get results? --> Take any corrective action, if contract is shown broken on the dashboard

jayson.bailey
2021-03-04 19:18
has joined #general

matt.fellows
2021-03-04 23:00
> when do you expect to run these tests? --> We haven?t finalised about it, but I guess similar to any other Automated tests run it will be on any major change/ on demand basis / periodically (overnight) I wouldn?t advise that. Pact tests are designed to run like unit tests. They are super fast, so there is really no reason not to do it on every build

matt.fellows
2021-03-04 23:11
> what decisions/actions are you going to take when you get results?  --> Take any corrective action, if contract is shown broken on the dashboard If the contract tests are failing, then the integration is broken. So that represents a real compatibility issue and would block your builds anyway. Documentation to help educate people around this could be helpful, to avoid reputation damage of the tool (i.e. it?s reflecting the state of the system)

abubics
2021-03-04 23:33
Yeah, it kinda sounds like you want to build more tests that do the same thing as Pact. I'd suggest integrating Pact as usual to start with, and see how it feels first :slightly_smiling_face:

ryanlevell
2021-03-05 04:18
If you publish a new contract, you as a consumer, cannot deploy that new version until it has been verified by the provider. You can ask the provider team to run their tests to verify the contract, but that?ll get old fast. Instead, this is saying to create a CI job that executes the provider tests that can be ran anytime to verify a new contract right away. To trigger this job you can use the ?contract published? webhook that will be triggered every time there?s a new contract. Now your consumer app won?t be blocked from deployments by unverified contracts.

2021-03-08 08:44
A new post has been created in *Feature Requests*

ananda-kumar.irudhaya
2021-03-08 15:12
hi team, one question..

laxmi.somni508
2021-03-08 15:39
Thanks both for your responses. @matt.fellows do you have a sample example of such document (perhaps in Excel format). Thanks

thanuxxxx
2021-03-08 16:45
I am just curious about this scenario? ? Assume this is the first time we are doing a Pact tests for a consumer and a provider, and all CI/CD are configured for us. ? we have *working branches* and a *master branch.* ? Our default testing env is called *V1*. After every PR, code will merge with master that will trigger a master build. After that, we deploy master to V1. ? Pact version is *git SHA* and pact tag is *current branch name* 1. We create consumer side tests, and make a PR. So all Pact tests will be verify after unit tests and publish the pact to Pact broker. 2. After PR is merged with master, master will be trigged, that also will verify and publish the pacts after unit tests. 3. After that, we are in deploy to V1 phase where we execute can-i-deploy command. As expected our build will fail because provider side never verified. 4. Now, we create our provider side tests, and it will run and publish the results back to broker after unit tests 5. After PR is merged with master, master build's pact test will be executed and results will be published back to broker 6. We are going to deploy provider to V1, so can-i-deploy command will be execute But we want to deploy provider to V1 if and only if consumer's V1 tag is verified against provider. But consumer never deployed to V1 so that we didn't tag consumer with V1. Is that a valid scenario?

wesleythomaswilliams
2021-03-08 16:49
Question for you... ? We have a service in production, let's call it `MyConsumer` , which has a contract with another service we own `MyProvider` ? We haven't got to the point of using webhooks to automate verification yet, so we manually trigger builds for verification. ? Today, another team in our business wanted to deploy a service, `TheirConsumer`, to consume from `MyProvider` and publishing a pact for us to verify. ? Now `MyProvider` has a `Main` branch and at the time, there was also an outstanding `Feature` branch for a piece of work. ? Both the `Main` and the `Feature` branches had verified the latest version of the contract from `MyConsumer`. ? When `TheirConsumer` published their pact, I ran the `Main` branch of `MyProvider` to verify it and it passed. ? However, when they came to run `can-i-deploy` as part of their deployment, they were prevented, because the contract hadn't been verified against the `Feature` branch version, just the `Main` version. ? Running the `Feature` branch verification fixed the issue, but it feels like they should have been able to deploy without that and that we've done something wrong, but I can't work out what. Any ideas?

thanuxxxx
2021-03-08 16:58
I think you should not verify `TheirConsumer` against your `Feature` branch

thanuxxxx
2021-03-08 17:01
From my understanding, they use `--latest` in their can-i-deploy parameter. That's why it is picking your feature branch. You should tag your main branch , and they will verify your main branch via the tag.

ryanlevell
2021-03-08 18:03
Silly question... our teams are confusing their naming because both ways make sense. Anyone have suggestions? For example, let?s take a test folder called ?consumer?. Does this mean ?my consumer tests? or ?tests for my consumers?. Both make sense IMO so some teams are defining the first way and other teams the second way.

ryanlevell
2021-03-08 18:21
(Sorry I am on mobile, I did not mean to send this to the channel as well) So the current state of you example is: 1. Consumer tagged master 2. Provider tagged master 3. Latest master-master contract has been verified 4. No one is deployed to V1 and therefore no contract is tagged V1. Is that right? As you said, this is the first time so you have to start somewhere. Attempt 1: Start with consumer 1. Deploy consumer to V1 2. Can-I-deploy will fail because no provider is present in V1 and the consumer depends on the provider being present. or else all the calls will fail. Attempt 2: Start with provider 1. Deploy provider to V1 2. Can-I-deploy will pass because the provider has no dependencies and no consumers are present yet. As consumer has no V1 tags can-I-deploy knows that and will allow the provider to deploy successfully. However, once you do deploy a consumer and now there is a consumer tagged V1 it will now enforce that the contract has been verified successfully before allowing new provider deployments.

wesleythomaswilliams
2021-03-08 18:24
If I take a service of ours that is both a consumer and provider as an example, our package structure for the tests is: `java.src.test.pact.consumer` `java.src.test.pact.provider` With the consumer package containing tests that create contracts and the provider package containing tests that verify contracts.

thanuxxxx
2021-03-08 18:52
I didn't know that can-i-deploy will allow a provider if no consumers are present yet. Thank you

ryanlevell
2021-03-08 18:59
Yes, I also define it that way, but one of our teams took the ?provider? package to mean ?tests against our providers? i.e. the consumer side tests. Which isn?t really wrong, just a different way to think about it. Thanks for your feedback!

2021-03-08 23:34
A new post has been created in *Feature Requests*

mjsmcp
2021-03-08 23:46
has joined #general

bethskurrie
2021-03-09 00:45
I've added a page titled "Help! My pact verification tests are failing. What do I do?" https://docs.pact.io/provider/how_to_fix_failing_verification_tests It's very basic now, but I'd like to add more helpful tips as time goes on. I'd also love someone who knows how to do the outlined process for JVM to contribute. Please have a read and add anything you think would be helpful for a person who was completely new to pact.

bethskurrie
2021-03-09 00:46
A :taco: for @ryanlevell for sharing about the "letting the provider deploy first" knowledge.